Actions
Task #457
openuse driver-native autocommit mode instead of our custom autocommit implementation
Start date:
07/30/2012
Due date:
% Done:
0%
Estimated time:
Activity type:
Description
- Should improve performance by avoiding creating unnecessary transactions
- In commit mode, also removes the need to auto-rollback failed queries
In sql.py: DbConn._db(): Configure connection, replace1:
# Record that a transaction is already open
self._savepoint += 1
# Configure connection
if hasattr(self.db, 'set_isolation_level'):
import psycopg2.extensions
self.db.set_isolation_level(
psycopg2.extensions.ISOLATION_LEVEL_READ_COMMITTED)
with: # Record that a transaction is already open
if not self.autocommit: self._savepoint += 1
# Configure connection
# Set autocommit mode
if self.autocommit:
if hasattr(self.db, 'set_isolation_level'):
import psycopg2.extensions
self.db.set_isolation_level(
psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
elif hasattr(self.db, 'autocommit'): self.db.autocommit(1)
In sql.py: DbConn.close(): Record that the automatic transaction is now closed, replace1:
self._savepoint -= 1
with: if not self.autocommit: self._savepoint -= 1
1 r3689
Actions