[Python-au] mysqlDb Problem

Graeme Matthew graeme_matthew@hotmail.com
Wed, 29 Jan 2003 11:10:12 +1100


Hi all

I am trying to execute multiple sql statements in one execute call
My first aim is too get multiple calls working then wrap it up in a 
transation. I cannot use executeMany() as the sql statements will be writing 
to different tables later.

The problem is occuring at the ; character as it wont accept multiples, the 
code below works fine for single statements, any ideas, tks


import MySQLdb

conn = MySQLdb.connect (host = "localhost",user = "Root",passwd = "",db = 
"mic")
cursor = conn.cursor ()
cursor.execute ("""INSERT INTO client (client_name) VALUES('Mike');
                   INSERT INTO client (client_name) VALUES('Tom');
                   INSERT INTO client (client_name) VALUES('Peter');
                """)
conn.close()




_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online  
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963