Subject | editing a header/detail document. |
---|---|
Author | Sergio H. Gonzalez |
Post date | 2008-08-30T18:06:38Z |
Hello, I'd like to know if I'm doing things properly... All the modules that
edit some document in my app, load the records from the DB into the edit form (I
use local temporary tables) and when the user saves the doc. I run a "delete
from header where id = _my_old_id" (the FK would also delete the child records)
and then I insert all the records again. Is this a good way to do it? I could
use "update" for the header record (because is only one) but an update wouldn't
work for the child records, because the user can add or delete some of them. So
the easiest way is to delete all of them and insert the new versions. I
construct all the SQL locally and send a script to the database with all the
changes (deletes and inserts). So far this is working fine, but I don't know if
the deletes may have any impact on future performance. I'd love to hear some
opinions about this !!! Thanks! -sergio
edit some document in my app, load the records from the DB into the edit form (I
use local temporary tables) and when the user saves the doc. I run a "delete
from header where id = _my_old_id" (the FK would also delete the child records)
and then I insert all the records again. Is this a good way to do it? I could
use "update" for the header record (because is only one) but an update wouldn't
work for the child records, because the user can add or delete some of them. So
the easiest way is to delete all of them and insert the new versions. I
construct all the SQL locally and send a script to the database with all the
changes (deletes and inserts). So far this is working fine, but I don't know if
the deletes may have any impact on future performance. I'd love to hear some
opinions about this !!! Thanks! -sergio