About EasyMorph Tutorials & Examples Web-help

Updating database rows

The other element I have just thought about is that when updating database rows. In some forum posts, it has been mentioned to delete rows before adding them again. I am worried that I could have users accessing the database and suddenly when they are looking for data it has disappeared. Is there a better way?

Not at this point. There will be a new action that implements natural SQL updates, but not in the next few months.

OK thank you. I had a thought to create a sub-module that did one or a few rows at a time. What do you think of this idea? Any drawbacks you can think of?

No particular drawbacks come to my mind. I would only recommend saving rows into a temporary .dset file before deleting them from the database. The temporary file can be deleted after updated rows are inserted back successfully. In this case, if something goes wrong your data won’t be lost.

So the sequence would be as follows:

  1. Import into EasyMorph the rows to be updated
  2. Save them into a temporary .dset file
  3. Update the rows in EasyMorph
  4. Delete the rows in the database table
  5. Export updated rows into the database table
  6. Delete the temporary .dset file

If it fails for some reason on steps 4 or 5 then it won’t reach step 6 and the temporary file won’t be deleted. In this case load data from the temporary file back into the database manually.

To learn more about EasyMorph visit easymorph.com.