【发布时间】:2012-08-22 22:38:37
【问题描述】:
在这里,我正在尝试删除电子邮件/用户名中包含“”的所有用户。
def removeQuote(self, tbl,record):
""" Updates the record """
statmt="select id from %s WHERE `email` LIKE '%%\"%%'" % (tbl)
self.cursor.execute(statmt)
rows=list(self.cursor.fetchall())
for idx, val in enumerate(rows):
id= val[0]
delstatmt = "DELETE FROM `maillist_subscription` WHERE id = '%s'" % id
print delstatmt
self.cursor.execute(delstatmt)
此操作的输出显示好像操作已成功完成,但记录仍保留在数据库中。 输出还显示了正确的 mysql 语句:
DELETE FROM `maillist_subscription` WHERE id = '8288754'
感谢您的帮助!
【问题讨论】:
标签: python sql transactional