summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-01-16 13:15:26 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2011-01-16 13:15:26 -0500
commita233638268d5991ec1f4f928104a041e607bb4fc (patch)
tree95e89a31e183411b2211f33068f4fd923292d8da /lib/sqlalchemy
parentaa62a3a83387d4b346731e199b2cbe386193c91b (diff)
downloadsqlalchemy-a233638268d5991ec1f4f928104a041e607bb4fc.tar.gz
- add dialect.reset_isolation_level(), reverts
- base not implemented methods on Dialect
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/engine/base.py15
-rw-r--r--lib/sqlalchemy/engine/default.py11
2 files changed, 26 insertions, 0 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py
index 9eb1b8b40..1727e6905 100644
--- a/lib/sqlalchemy/engine/base.py
+++ b/lib/sqlalchemy/engine/base.py
@@ -524,6 +524,21 @@ class Dialect(object):
"""
return None
+ def reset_isolation_level(self, dbapi_conn):
+ """Given a DBAPI connection, revert its isolation to the default."""
+
+ raise NotImplementedError()
+
+ def set_isolation_level(self, dbapi_conn, level):
+ """Given a DBAPI connection, set its isolation level."""
+
+ raise NotImplementedError()
+
+ def get_isolation_level(self, dbapi_conn):
+ """Given a DBAPI connection, return its isolation level."""
+
+ raise NotImplementedError()
+
class ExecutionContext(object):
"""A messenger object for a Dialect that corresponds to a single
diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py
index da6ed12a6..30a53bb20 100644
--- a/lib/sqlalchemy/engine/default.py
+++ b/lib/sqlalchemy/engine/default.py
@@ -175,6 +175,12 @@ class DefaultDialect(base.Dialect):
except NotImplementedError:
self.default_schema_name = None
+ try:
+ self.default_isolation_level = \
+ self.get_isolation_level(connection.connection)
+ except NotImplementedError:
+ self.default_isolation_level = None
+
self.returns_unicode_strings = self._check_unicode_returns(connection)
self.do_rollback(connection.connection)
@@ -320,6 +326,11 @@ class DefaultDialect(base.Dialect):
def is_disconnect(self, e):
return False
+ def reset_isolation_level(self, dbapi_conn):
+ self.set_isolation_level(dbapi_conn,
+ self.isolation_level or self.default_isolation_level)
+
+
class DefaultExecutionContext(base.ExecutionContext):
isinsert = False