summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/cursor.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_sqlite/cursor.c')
-rw-r--r--Modules/_sqlite/cursor.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index 8d9f20d..cbf4718 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -130,14 +130,10 @@ stmt_reset(pysqlite_Statement *self)
{
int rc = SQLITE_OK;
- if (self->in_use && self->st) {
+ if (self->st != NULL) {
Py_BEGIN_ALLOW_THREADS
rc = sqlite3_reset(self->st);
Py_END_ALLOW_THREADS
-
- if (rc == SQLITE_OK) {
- self->in_use = 0;
- }
}
return rc;
@@ -770,12 +766,6 @@ bind_parameters(pysqlite_state *state, pysqlite_Statement *self,
}
}
-static inline void
-stmt_mark_dirty(pysqlite_Statement *self)
-{
- self->in_use = 1;
-}
-
PyObject *
_pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation, PyObject* second_argument)
{
@@ -852,7 +842,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation
goto error;
}
- if (self->statement->in_use) {
+ if (sqlite3_stmt_busy(self->statement->st)) {
Py_SETREF(self->statement,
pysqlite_statement_create(self->connection, operation));
if (self->statement == NULL) {
@@ -860,8 +850,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation
}
}
- stmt_reset(self->statement);
- stmt_mark_dirty(self->statement);
+ (void)stmt_reset(self->statement);
self->rowcount = self->statement->is_dml ? 0L : -1L;
/* We start a transaction implicitly before a DML statement.
@@ -882,8 +871,6 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation
break;
}
- stmt_mark_dirty(self->statement);
-
bind_parameters(state, self->statement, parameters);
if (PyErr_Occurred()) {
goto error;