我想用一个命令运行多个语句。有可能吗?
这是SQL命令:
UPDATE toggle SET state='0' WHERE feature_name=‘feature_1;
UPDATE toggle SET state=‘1’ WHERE feature_name=‘feature_2’;
UPDATE toggle SET state=‘1’ WHERE feature_name=‘feature_3’;
对于一个命令,我运行类似的内容:
import MySQLdb
myDB = MySQLdb.connect(host=host, port=db_port, user=user, passwd=db_password, db=db)
cHandler = myDB.cursor()
cHandler.execute(query)
但这显然仅适用于单个语句
谢谢!