Re: [mysql] query atomicity
| From: | Andrey Hristov | Date: | Wed, 04 Sep 2002 12:08:47 +0000 |
| Subject: | Re: [mysql] query atomicity | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-21564@lists.php.net to get a copy of this message | ||
Choices
1) Use InnoDB
2) If you cannot use innodb than you can write your code in the way you add
in an array
queries that will rollback the change :
if you do
$r1 = mysql_query('insert into some_table (k1,k2) values (4,2);');
$r1 = mysql_query('insert into some_table (k1,k2) values (5,3);');
you must have in the rollback array this
$rollback_ar = array('DELETE FROM some_table WHERE k1=4 and k2=2;',
'DELETE FROM some_table WHERE k1=5 and k2=3');
Hope this is clear.
Best regards
Andrey Hristov
----- Original Message -----
From: ":B nerdy" <thoa0025@mail.usyd.edu.au>
To: <php-db@lists.php.net>
Sent: Wednesday, September 04, 2002 3:04 PM
Subject: [PHP-DB] [mysql] query atomicity
> how would i go about making a few queries into a transaction - that is, if
> one of them fails, the previous queries get rolled back...
>
> cheers
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>