Task #457
Updated by Aaron Marcuse-Kubitza over 12 years ago
* 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, replace[1]: <pre><code class="Python"> # 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) </code></pre>with: <pre><code </code><pre><code class="Python"> # 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) </code></pre> In sql.py: DbConn.close(): Record that the automatic transaction is now closed, replace[1]: <pre><code class="Python"> self._savepoint -= 1 </code></pre>with: <pre><code class="Python"> if not self.autocommit: self._savepoint -= 1 </code></pre> </pre> fn1. r3689