[Python-au] Python and MySQlDb

Graeme Matthew graeme_matthew@hotmail.com
Wed, 29 Jan 2003 08:30:53 +1100


I ll, hope the week is going well

Im trying to execute a batch of statements via MysqlDb.

Im using Mysql, InnoDb tables enabled and AUTOCOMMIT is off

I need to execute INSERTS for an ORDER DETAILS statment followed by a number 
of ORDERLINE statements, if all of these (i.e. all statements related to the 
ORDER) succeed I then want to commit it

for example (test only !):

try:
cursor.execute("INSERT INTO ORDER(ORDERNO) VALUES(12345);
                INSERT INTO ORDERLINE(ORDERNO,QTY) VALUES(12345,20);
                INSERT INTO ORDERLINE(ORDERNO,QTY) VALUES(12345,50);")
except:
conn.rollBack()

any help or previous experience in doing this would be much appreciated
sorry bout the formatting !! :0


_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8.  
http://join.msn.com/?page=features/junkmail