Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert 64-bit API support
  • Loading branch information
erlend-aasland committed Jun 8, 2022
commit 02bd83f17f242c091c6f2f1555abdf22d556667c
16 changes: 3 additions & 13 deletions Modules/_sqlite/cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,16 +776,6 @@ stmt_mark_dirty(pysqlite_Statement *self)
self->in_use = 1;
}

static inline sqlite3_int64
changes(sqlite3 *db)
{
#if SQLITE_VERSION_NUMBER >= 3037000
return sqlite3_changes64(db);
#else
return (sqlite3_int64)sqlite3_changes(db);
#endif
}

PyObject *
_pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation, PyObject* second_argument)
{
Expand Down Expand Up @@ -955,12 +945,12 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation
}

if (self->statement->is_dml && rc == SQLITE_DONE && multiple) {
self->rowcount += changes(self->connection->db);
self->rowcount += (long)sqlite3_changes(self->connection->db);
}

if (rc == SQLITE_DONE && !multiple) {
if (self->statement->is_dml) {
self->rowcount = changes(self->connection->db);
self->rowcount = (long)sqlite3_changes(self->connection->db);
}
stmt_reset(self->statement);
Py_CLEAR(self->statement);
Expand Down Expand Up @@ -1137,7 +1127,7 @@ pysqlite_cursor_iternext(pysqlite_Cursor *self)
int rc = stmt_step(stmt);
if (rc == SQLITE_DONE) {
if (self->statement->is_dml) {
self->rowcount = changes(self->connection->db);
self->rowcount = (long)sqlite3_changes(self->connection->db);
}
(void)stmt_reset(self->statement);
}
Expand Down
2 changes: 1 addition & 1 deletion Modules/_sqlite/cursor.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ typedef struct
PyObject* row_cast_map;
int arraysize;
PyObject* lastrowid;
sqlite3_int64 rowcount;
long rowcount;
PyObject* row_factory;
pysqlite_Statement* statement;
int closed;
Expand Down