@@ -454,7 +454,7 @@ connection_close(pysqlite_Connection *self)
454454
455455 int rc = 0 ;
456456 if (self -> autocommit == AUTOCOMMIT_DISABLED &&
457- !sqlite3_get_autocommit (self -> db ))
457+ !pysqlite_get_autocommit (self -> db ))
458458 {
459459 if (connection_exec_stmt (self , "ROLLBACK" ) < 0 ) {
460460 rc = -1 ;
@@ -759,7 +759,7 @@ pysqlite_connection_commit_impl(pysqlite_Connection *self)
759759 }
760760
761761 if (self -> autocommit == AUTOCOMMIT_LEGACY ) {
762- if (!sqlite3_get_autocommit (self -> db )) {
762+ if (!pysqlite_get_autocommit (self -> db )) {
763763 if (connection_exec_stmt (self , "COMMIT" ) < 0 ) {
764764 return NULL ;
765765 }
@@ -793,7 +793,7 @@ pysqlite_connection_rollback_impl(pysqlite_Connection *self)
793793 }
794794
795795 if (self -> autocommit == AUTOCOMMIT_LEGACY ) {
796- if (!sqlite3_get_autocommit (self -> db )) {
796+ if (!pysqlite_get_autocommit (self -> db )) {
797797 if (connection_exec_stmt (self , "ROLLBACK" ) < 0 ) {
798798 return NULL ;
799799 }
@@ -1184,7 +1184,7 @@ destructor_callback(void *ctx)
11841184static int
11851185check_num_params (pysqlite_Connection * self , const int n , const char * name )
11861186{
1187- int limit = sqlite3_limit (self -> db , SQLITE_LIMIT_FUNCTION_ARG , -1 );
1187+ int limit = pysqlite_limit (self -> db , SQLITE_LIMIT_FUNCTION_ARG , -1 );
11881188 assert (limit >= 0 );
11891189 if (n < -1 || n > limit ) {
11901190 PyErr_Format (self -> ProgrammingError ,
@@ -1838,7 +1838,10 @@ pysqlite_connection_get_total_changes(PyObject *op, void *Py_UNUSED(closure))
18381838 if (!pysqlite_check_connection (self )) {
18391839 return NULL ;
18401840 }
1841- return PyLong_FromLong (sqlite3_total_changes (self -> db ));
1841+ pysqlite_db_mutex_enter (self -> db );
1842+ int changes = sqlite3_total_changes (self -> db );
1843+ pysqlite_db_mutex_leave (self -> db );
1844+ return PyLong_FromLong (changes );
18421845}
18431846
18441847static PyObject *
@@ -1848,7 +1851,7 @@ pysqlite_connection_get_in_transaction(PyObject *op, void *Py_UNUSED(closure))
18481851 if (!pysqlite_check_connection (self )) {
18491852 return NULL ;
18501853 }
1851- if (!sqlite3_get_autocommit (self -> db )) {
1854+ if (!pysqlite_get_autocommit (self -> db )) {
18521855 Py_RETURN_TRUE ;
18531856 }
18541857 Py_RETURN_FALSE ;
@@ -2508,7 +2511,7 @@ setlimit_impl(pysqlite_Connection *self, int category, int limit)
25082511 return NULL ;
25092512 }
25102513
2511- int old_limit = sqlite3_limit (self -> db , category , limit );
2514+ int old_limit = pysqlite_limit (self -> db , category , limit );
25122515 if (old_limit < 0 ) {
25132516 PyErr_SetString (self -> ProgrammingError , "'category' is out of bounds" );
25142517 return NULL ;
@@ -2679,14 +2682,14 @@ set_autocommit(PyObject *op, PyObject *val, void *Py_UNUSED(closure))
26792682 return -1 ;
26802683 }
26812684 if (self -> autocommit == AUTOCOMMIT_ENABLED ) {
2682- if (!sqlite3_get_autocommit (self -> db )) {
2685+ if (!pysqlite_get_autocommit (self -> db )) {
26832686 if (connection_exec_stmt (self , "COMMIT" ) < 0 ) {
26842687 return -1 ;
26852688 }
26862689 }
26872690 }
26882691 else if (self -> autocommit == AUTOCOMMIT_DISABLED ) {
2689- if (sqlite3_get_autocommit (self -> db )) {
2692+ if (pysqlite_get_autocommit (self -> db )) {
26902693 if (connection_exec_stmt (self , "BEGIN" ) < 0 ) {
26912694 return -1 ;
26922695 }
0 commit comments