]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Accept None from SQLite cursor.fetchone() when
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 4 Jun 2011 23:53:24 +0000 (19:53 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 4 Jun 2011 23:53:24 +0000 (19:53 -0400)
"PRAGMA read_uncommitted" is called to determine
current isolation mode at connect time and
default to SERIALIZABLE; this to support SQLite
versions pre-3.3.0 that did not have this
feature.  [ticket:2173]

CHANGES
lib/sqlalchemy/dialects/sqlite/base.py

diff --git a/CHANGES b/CHANGES
index 3a2dedc4f5afcfafdaf2cbfe2c00727430602a41..72c8c86a127e4c7715deac4a9ce2bbf1d84c7df5 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -37,6 +37,14 @@ CHANGES
     and are redundant:  reflecttable(), create(), 
     drop(), text(), engine.func
 
+- sqlite
+  - Accept None from cursor.fetchone() when
+    "PRAGMA read_uncommitted" is called to determine
+    current isolation mode at connect time and
+    default to SERIALIZABLE; this to support SQLite 
+    versions pre-3.3.0 that did not have this 
+    feature.  [ticket:2173]
+
 - mysql
   - Unit tests pass 100% on MySQL installed
     on windows.
index 4ab509318d4f3d3d2b89b48c1c5174ba8e219024..331ab92d0af09e90a6bb8226312bd60041c7d9b6 100644 (file)
@@ -505,7 +505,17 @@ class SQLiteDialect(default.DefaultDialect):
     def get_isolation_level(self, connection):
         cursor = connection.cursor()
         cursor.execute('PRAGMA read_uncommitted')
-        value = cursor.fetchone()[0]
+        res = cursor.fetchone()
+        if res:
+            value = res[0]
+        else: 
+            # http://www.sqlite.org/changes.html#version_3_3_3
+            # "Optional READ UNCOMMITTED isolation (instead of the 
+            # default isolation level of SERIALIZABLE) and 
+            # table level locking when database connections 
+            # share a common cache.""
+            # pre-SQLite 3.3.0 default to 0
+            value = 0
         cursor.close()
         if value == 0:
             return "SERIALIZABLE"