Posted by ImOk on 12/18/60 11:48
Easiest way is to delete and then insert. But you should do it one
record at a time. You dont want to delete all at once and then insert.
Otherwise if you have a system crash right after the delete you could
lose massive amounts of data instead of just one record.
To do this you need to add a new character type 'delete' flag column in
your items table which would be used for this purpose.
1) Update all the records you want to delete by putting in X in the
deleteFlag.
..
2) Delete the first one whose key matches the one you are inserting
from the list.
3) Insert the new one from the list (leave the deleteFlag column null
or put a blank)
Repeat the 1-3 process until you've inserted all your records from the
list.
4) Now delete all the records that still have an X in the delete flag
column. These would be the left over records.
You can also use Transactions but its only safe as long as your server
will not crash during commit.
Navigation:
[Reply to this message]
|