int rc;
int numcols;
PyObject* column_name;
- sqlite_int64 lastrowid;
if (!check_cursor(self)) {
goto error;
self->rowcount= -1L;
}
- if (!multiple) {
- Py_BEGIN_ALLOW_THREADS
- lastrowid = sqlite3_last_insert_rowid(self->connection->db);
- Py_END_ALLOW_THREADS
- Py_SETREF(self->lastrowid, PyLong_FromLongLong(lastrowid));
- if (self->lastrowid == NULL) {
- goto error;
- }
- }
-
if (rc == SQLITE_DONE && !multiple) {
pysqlite_statement_reset(self->statement);
Py_CLEAR(self->statement);
Py_XDECREF(parameters);
}
+ if (!multiple) {
+ sqlite_int64 lastrowid;
+
+ Py_BEGIN_ALLOW_THREADS
+ lastrowid = sqlite3_last_insert_rowid(self->connection->db);
+ Py_END_ALLOW_THREADS
+
+ Py_SETREF(self->lastrowid, PyLong_FromLongLong(lastrowid));
+ // Fall through on error.
+ }
+
error:
Py_XDECREF(parameters);
Py_XDECREF(parameters_iter);