[pysqlite] [APSW] "SQLError: cannot rollback - no transaction is active"
Fred <[email protected]> Sat, 29 Nov 2008 05:43:04 +0100
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
Roger Binns > In general it is a really bad idea to do a blanket except statement like you have since it catches all exceptions. In this case it is also redundant as you want to rollback and exit. When a connection is shutdown with a transaction in progress it is rolled back. (This would happen as a normal part of the Python interpreter shutdown). Even if you forced an abrupt process termination (eg os._exit) then the next SQLite open will rollback the transaction. So I can just remove the ROLLBACK line, and just close down the connection to get SQLite to ignore any UPDATE since the last BEGIN? I just want to make sure the database is left in a clean state before ending the script. Dennis Lee Bieber > DON'T supply your data value in such a manner! It is unsafe -- ignoring potential injection attacks, if /value/ contains a " you will have invalid SQL. Right, but 1) this script is for personal use, not running on some web site, and 2) the problem with the "?" construct is that I can't display the actual SQL statement on the screen to check what it looks like. Thank you.