Re: LOCK TABLES x COMMIT/ROLLBACK
| From: | Nuno Silva | Date: | Fri, 16 Feb 2001 02:35:08 +0000 |
| Subject: | Re: LOCK TABLES x COMMIT/ROLLBACK | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-40060@lists.php.net to get a copy of this message | ||
Richard Lynch wrote:
[snip...]
I think the idea is this: 1. LOCK TABLES invovled. 2. Get the current values for all records you are about to change. 3. Attempt to make changes. 4. If any of the attempted changes fails, change back the ones that succeded.*you just can't relie on this... imagine that you stop apache just in the middle of the script... or imagine some power outage or some segfault... whatever... you manual "rollback" will not succeed :( the only cenario that a lock can (securelly) replace a transaction is when you're UPDATING (_not_ inserting or deleting) only ONE table.
5. UNLOCK the TABLES * Or maybe UNLOCK lets you somehow rollback?... * And if your attempt to undo the changes you already did fails, you'll need some code to alert a human to straighten out the mess you've made after they fix whatever is making the code not work in the first place. You might have an easier time porting to a database that actually supports transactions...:-) http://postgresql.orgyes, this would be my bet :)
Or, the latest version of MySQL, but I dunno how stable their transaction support is yet... -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm Regards,Nuno Silva