From: Luke O. <lu...@me...> - 2003-10-08 21:35:48
|
To clarify my situation: Mistyped, this is PySQLite 0.4.3. SQLObject 0.4 and from CVS yesterday both show this problem for me. Not using transactions, this is with the autocommit conn.commit() in DBAPI.releaseConnection() only. It wasn't so much the threadsafety=1 issue, but that combined with the comment: # uses only one connection for sqlite - supports multiple # cursors per connection in DBConnection.py , SQLiteConnection.__init__, and the subsequent makeConnection(self): return self._conn that got me thinking. Specific errors: return self._runWithConnection(self._queryOne, s) File "SQLObject\DBConnection.py", line 69, in _runWithConnection val = meth(conn, *args) File "SQLObject\DBConnection.py", line 139, in _queryOne c.execute(s) File "C:\Python22\Lib\site-packages\sqlite\main.py", line 237, in execute self.con._begin() File "C:\Python22\Lib\site-packages\sqlite\main.py", line 508, in _begin self.db.execute("BEGIN") DatabaseError: cannot start a transaction within a transaction followed from then on by: File "C:\Python22\Lib\site-packages\sqlite\main.py", line 532, in commit self.db.execute("COMMIT") DatabaseError: cannot commit - no transaction is active Reading the pysqlite, these happen because of the connection-level inTransaction flag. I tried quickly getting around this by simply removing the assumption in __init__, and in makeConnection returning a new connection each time, but these same errors keeps happening. Next, tried to turn on the pysqlite autocommit functionality (sqlite.connect(self.filename, autocommit=1)), and commented out the conn.commit() in releaseConnection(), and it now works for me. But not sure if I'm just masking another problem, and don't have time right now to generalize/cleanup this hack if it's actually a solution. - Luke |