summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/sqlite
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-03-15 13:08:31 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-03-15 13:08:31 -0400
commit5dcc32fd5a81c41b50bc35573d190a60a344c3c6 (patch)
tree10b57e17f0a724b63c9ae122d60b7036c50029df /lib/sqlalchemy/dialects/sqlite
parentb3ba365eea4984882f6f5f71aa97ac454bc7d96d (diff)
downloadsqlalchemy-5dcc32fd5a81c41b50bc35573d190a60a344c3c6.tar.gz
- The visit_pool() method of Dialect is removed, and replaced with
on_connect(). This method returns a callable which receives the raw DBAPI connection after each one is created. The callable is assembled into a first_connect/connect pool listener by the connection strategy if non-None. Provides a simpler interface for dialects.
Diffstat (limited to 'lib/sqlalchemy/dialects/sqlite')
-rw-r--r--lib/sqlalchemy/dialects/sqlite/base.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/sqlalchemy/dialects/sqlite/base.py b/lib/sqlalchemy/dialects/sqlite/base.py
index 5bcf90151..dfc09f025 100644
--- a/lib/sqlalchemy/dialects/sqlite/base.py
+++ b/lib/sqlalchemy/dialects/sqlite/base.py
@@ -360,21 +360,21 @@ class SQLiteDialect(default.DefaultDialect):
# hypothetical driver ?)
self.native_datetime = native_datetime
- def visit_pool(self, pool):
+ def on_connect(self):
if self.isolation_level is not None:
- class SetIsolationLevel(object):
- def __init__(self, isolation_level):
- if isolation_level == 'READ UNCOMMITTED':
- self.isolation_level = 1
- else:
- self.isolation_level = 0
-
- def connect(self, conn, rec):
- cursor = conn.cursor()
- cursor.execute("PRAGMA read_uncommitted = %d" % self.isolation_level)
- cursor.close()
- pool.add_listener(SetIsolationLevel(self.isolation_level))
-
+ if self.isolation_level == 'READ UNCOMMITTED':
+ isolation_level = 1
+ else:
+ isolation_level = 0
+
+ def connect(conn):
+ cursor = conn.cursor()
+ cursor.execute("PRAGMA read_uncommitted = %d" % isolation_level)
+ cursor.close()
+ return connect
+ else:
+ return None
+
def table_names(self, connection, schema):
if schema is not None:
qschema = self.identifier_preparer.quote_identifier(schema)