[pysqlite] [APSW] "SQLError: cannot rollback - no transaction is active"
Fred <[email protected]> Sat, 29 Nov 2008 04:16:10 +0100
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
Hello
Out of curiosity, why does APSW raise this error in this try/except block?
=========
cursor.execute("BEGIN")
for name, pattern in patterns:
m = pattern.search(content)
if m:
value = m.group(1).strip()
sql = 'UPDATE membres SET %s="%s" WHERE id=%s' % (name,value,id)
sql = sql.decode('iso-8859-1')
try:
cursor.execute(sql)
except:
print "Failed %s" % sql
connection.close(True)
sys.exit()
try:
cursor.execute("COMMIT")
time.sleep(1)
except:
print "Failed %s" % sql
File "src/cursor.c", line 230, in resetcursor apsw.SQLError:
SQLError: cannot rollback - no transaction is active
cursor.execute("ROLLBACK")
connection.close(True)
sys.exit()
=========
Since the COMMIT failed, I assumed the ROLLBACK would be ran in the
except section that follows.
Thank you.