MySQL Forums
Forum List  »  PHP

Re: Double Insert
Posted by: James Wilson
Date: October 15, 2019 10:54AM

Peter, thanks for your reply. I probably titled the issue incorrectly. The problem is not a 'Double Insert' but rather a 'Double Update.' My bad!

1. Being somewhat of a mySQL novice, I'm not sure what you mean by a 'transaction block.' But, being an old school programmer (can you spell FORTRAN 2?) I have written some unique code to handle all database actions to modify the 60+ tables in the database. Basically, the serialized data of the form is passed to a routine that then builds the desired type of action (Insert/Update/Delete). I've been using the method for over 10 years on one site (www.txfannin.org) and now over a year on a second site (www.msholmes.org) and have had no problems until recently.

2. A 'dummy row' is not produced (bad title). What is 'produced' is the 'updated' record contains NULL in each field of the record. When a record is written to the table I write a record to a transaction_log table that contains the query string used to update the record. A good record is written to the log and then a few milliseconds later another record is written to the log as follows...

UPDATE interments_data SET per_cemid = NULL, per_surname = NULL, per_givenname = NULL, per_middlename = NULL, per_maidenname = NULL, per_surname_prior = NULL, per_prefix = NULL, per_suffix = NULL, per_nickname = NULL, per_birthdate = NULL, per_deathdate = NULL, per_marriagedate = NULL, per_burialdate = NULL, per_birthplace = NULL, per_deathplace = NULL, per_marriageplace = NULL, per_burialplot = NULL, per_plot_lat = NULL, per_plot_lon = NULL, per_tmbstn_img = NULL, per_tmbdtl_img = NULL, per_ftstn_img = NULL, per_plot_img = NULL, per_person_img = NULL, per_mil_img = NULL, per_mil_inscription = NULL, per_mil_notes = NULL, per_inscription = NULL, per_rech_notes = NULL, per_img_credits = NULL, per_deathcert = NULL, per_obit = NULL, per_obit_img = NULL, per_bio = NULL, per_bio_img = NULL, per_funcd_img = NULL, per_family_page = NULL, per_parents = NULL, per_siblings = NULL, per_spouse = NULL, per_children = NULL, per_timestamp = NULL WHERE per_id = 1824;

Note that all the fields are NULL. Before submitting a record I first check to ensure that selected fields are not NULL, so somehow this check is getting bypassed. Is there something that I can add to the query that will prevent the NULL update for happening?

Again, thanks for your reply. Any thoughts you have are greatly appreciated.

--
James A Wilson
msgwcc@msholmes.org

Options: ReplyQuote


Subject
Written By
Posted
October 14, 2019 12:16AM
October 15, 2019 10:11AM
Re: Double Insert
October 15, 2019 10:54AM
October 15, 2019 11:06AM
October 15, 2019 12:16PM
October 15, 2019 12:30PM
October 15, 2019 12:42PM
October 15, 2019 12:53PM
October 15, 2019 01:04PM
October 15, 2019 09:21PM
October 15, 2019 10:17PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.