What should i do when i want to insert related data to different tables and one the insertions fail. So only a portion of the important related data is inserted to one of the tables. Then i obviously don’t want that data fracture to stay in the table because it is not useful by itself. What are the best ways and technique to implement this kind of behaviour?
Share
One of the best things that you can do is set the auto commit to 0. From there you can nest it in a transaction. That way you can provide a conditional that if the table doesn’t fully update, roll back and it is not saved to your disk.
I got this from the MYSQL website: http://dev.mysql.com/doc/refman/5.0/en/commit.html