Fix autocommit mode in oursql. default tip
authorRadek Brich <radek.brich@devl.cz>
Fri, 25 Jul 2014 15:15:16 +0200
changeset 106 db4c582a2abd
parent 105 10551741f61f
Fix autocommit mode in oursql.
pydbkit/mymanager_oursql.py
--- a/pydbkit/mymanager_oursql.py	Wed Jul 09 18:04:11 2014 +0200
+++ b/pydbkit/mymanager_oursql.py	Fri Jul 25 15:15:16 2014 +0200
@@ -289,7 +289,10 @@
         conn = oursql.connect(default_cursor=Cursor, **ci.parameters)
         if not ci.isolation_level is None:
             if ci.isolation_level == 'AUTOCOMMIT':
-                conn.autocommit(True)
+                # This is default in MySQL, but to be sure...
+                curs = conn.cursor()
+                curs.execute('SET autocommit = 1;')
+                curs.close()
             else:
                 curs = conn.cursor()
                 curs.execute('SET SESSION TRANSACTION ISOLATION LEVEL ' + ci.isolation_level)