summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-06-14 12:25:36 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2016-06-14 12:25:36 (GMT)
commite0b70cd8a986aaeec74f5647c7ffc4200f2e14f3 (patch)
treeee6330d78f8e667768a708ba90896528e24728af /Modules
parent34f12d73158de5ad37c08009832d68ff7b8eeb7a (diff)
downloadcpython-e0b70cd8a986aaeec74f5647c7ffc4200f2e14f3.zip
cpython-e0b70cd8a986aaeec74f5647c7ffc4200f2e14f3.tar.gz
cpython-e0b70cd8a986aaeec74f5647c7ffc4200f2e14f3.tar.bz2
Issue #16864: Cursor.lastrowid now supports REPLACE statement
Initial patch by Alex LordThorsen.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_sqlite/cursor.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index 23f3057..9b20678 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -698,7 +698,9 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject*
}
Py_DECREF(self->lastrowid);
- if (!multiple && statement_type == STATEMENT_INSERT) {
+ if (!multiple &&
+ /* REPLACE is an alias for INSERT OR REPLACE */
+ (statement_type == STATEMENT_INSERT || statement_type == STATEMENT_REPLACE)) {
sqlite_int64 lastrowid;
Py_BEGIN_ALLOW_THREADS
lastrowid = sqlite3_last_insert_rowid(self->connection->db);