[PHP-DB] [mysql] query atomicity

2002-09-04 Thread :B nerdy

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




Re: [PHP-DB] [mysql] query atomicity

2002-09-04 Thread :B nerdy

i am unfarmillar with InnoDB, i am currently using MyISAM i believe. just
the default one.

i am a complete noobie with InnoDB, do i have to convert my db?

cheers


Andrey Hristov [EMAIL PROTECTED] wrote in message
014d01c2540b$d309bf40$1601a8c0@andreywin">news:014d01c2540b$d309bf40$1601a8c0@andreywin...
 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 [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 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
 




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php