Issue #16864: Cursor.lastrowid now supports REPLACE statement

Initial patch by Alex LordThorsen.
This commit is contained in:
Berker Peksag 2016-06-14 15:25:36 +03:00
parent 34f12d7315
commit e0b70cd8a9
6 changed files with 66 additions and 5 deletions

View file

@ -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);