If you have a reason not to use InnoDB tables (e.g., speed, licensing, fulltext indexes), you can implement pretty good client-side rollback in PHP. Just send all calls through a database class (insert(), update(), delete()) and if a transaction flag is set then they store in a stack a little query to reverse the effects of the first query (this may mean using a 'select' before each update/insert/delete to find out what data was there beforehand).

I have a class does this happily, 4 & a half pages of PHP. Only real drawback is that you can't do anything like "INSERT ... SELECT".

Tom.
Andy Hall wrote:

Hi,

I have a PHP script that is running 4 queries. If the 4th fails, ideally I would like the other 3 queires to roll back and leave the database as if they were never run at all.

Can anyone advise on any technique that would do this easily, as opposed to manually writing and running queries to set the database back (which would be messy IMO).

This project is being developed on MySQL 3.23.37.

Any help is appreciated, thanks.

Andy Hall.






-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to