[pypy-commit] pypy py3.6: CPython Issue #16864: Cursor.lastrowid now supports REPLACE statement

amauryfa pypy.commits at gmail.com
Mon Dec 18 03:37:51 EST 2017


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3.6
Changeset: r93457:b9413da29d91
Date: 2017-12-14 22:52 +0100
http://bitbucket.org/pypy/pypy/changeset/b9413da29d91/

Log:	CPython Issue #16864: Cursor.lastrowid now supports REPLACE
	statement

diff --git a/lib_pypy/_sqlite3.py b/lib_pypy/_sqlite3.py
--- a/lib_pypy/_sqlite3.py
+++ b/lib_pypy/_sqlite3.py
@@ -930,7 +930,9 @@
                         self.__rowcount = 0
                     self.__rowcount += _lib.sqlite3_changes(self.__connection._db)
 
-                if not multiple and self.__statement._type == _STMT_TYPE_INSERT:
+                if not multiple and self.__statement._type in (
+                        # REPLACE is an alias for INSERT OR REPLACE
+                        _STMT_TYPE_INSERT, _STMT_TYPE_REPLACE):
                     self.__lastrowid = _lib.sqlite3_last_insert_rowid(self.__connection._db)
                 else:
                     self.__lastrowid = None


More information about the pypy-commit mailing list