[pypy-commit] pypy default: detect BEGIN. (CPython does check of statement type)

fijal noreply at buildbot.pypy.org
Thu Apr 4 08:51:25 CEST 2013


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: 
Changeset: r62999:c1c610355c04
Date: 2013-04-04 08:51 +0200
http://bitbucket.org/pypy/pypy/changeset/c1c610355c04/

Log:	detect BEGIN. (CPython does check of statement type)

diff --git a/lib_pypy/_sqlite3.py b/lib_pypy/_sqlite3.py
--- a/lib_pypy/_sqlite3.py
+++ b/lib_pypy/_sqlite3.py
@@ -892,6 +892,11 @@
                 raise ValueError("operation parameter must be str or unicode")
             self.__description = None
             self.__rowcount = -1
+
+            if sql == 'BEGIN':
+                self.__connection._begin()
+                return
+
             self.__statement = self.__connection._statement_cache.get(
                 sql, self.row_factory)
 
@@ -1050,6 +1055,9 @@
         self.__con = connection
         self.__con._remember_statement(self)
 
+        self._in_use = False
+        self._row_factory = None
+
         if not isinstance(sql, basestring):
             raise Warning("SQL is of wrong type. Must be string or unicode.")
         first_word = self._statement_kind = sql.lstrip().split(" ")[0].upper()
@@ -1060,9 +1068,6 @@
         else:
             self._kind = Statement._DDL
 
-        self._in_use = False
-        self._row_factory = None
-
         if isinstance(sql, unicode):
             sql = sql.encode('utf-8')
         statement_star = _ffi.new('sqlite3_stmt **')


More information about the pypy-commit mailing list