@@ -188,7 +188,7 @@ connection_exec_stmt(pysqlite_Connection *self, const char *sql)
188
188
Py_END_ALLOW_THREADS
189
189
190
190
if (rc != SQLITE_OK ) {
191
- ( void ) _pysqlite_seterror (self -> state , self -> db );
191
+ set_error_from_db (self -> state , self -> db );
192
192
return -1 ;
193
193
}
194
194
return 0 ;
@@ -274,7 +274,7 @@ pysqlite_connection_init_impl(pysqlite_Connection *self, PyObject *database,
274
274
275
275
pysqlite_state * state = pysqlite_get_state_by_type (Py_TYPE (self ));
276
276
if (rc != SQLITE_OK ) {
277
- _pysqlite_seterror (state , db );
277
+ set_error_from_db (state , db );
278
278
goto error ;
279
279
}
280
280
@@ -607,11 +607,11 @@ blobopen_impl(pysqlite_Connection *self, const char *table, const char *col,
607
607
Py_END_ALLOW_THREADS
608
608
609
609
if (rc == SQLITE_MISUSE ) {
610
- PyErr_Format (self -> state -> InterfaceError , sqlite3_errstr ( rc ) );
610
+ set_error_from_code (self -> state , rc );
611
611
return NULL ;
612
612
}
613
613
else if (rc != SQLITE_OK ) {
614
- _pysqlite_seterror (self -> state , self -> db );
614
+ set_error_from_db (self -> state , self -> db );
615
615
return NULL ;
616
616
}
617
617
@@ -1352,9 +1352,9 @@ create_window_function_impl(pysqlite_Connection *self, PyTypeObject *cls,
1352
1352
}
1353
1353
1354
1354
if (rc != SQLITE_OK ) {
1355
- // Errors are not set on the database connection, so we cannot
1356
- // use _pysqlite_seterror().
1357
- PyErr_SetString (self -> ProgrammingError , sqlite3_errstr ( rc ) );
1355
+ /* Errors are not set on the database connection; use result code
1356
+ * instead. */
1357
+ set_error_from_code (self -> state , rc );
1358
1358
return NULL ;
1359
1359
}
1360
1360
Py_RETURN_NONE ;
@@ -2112,7 +2112,7 @@ pysqlite_connection_backup_impl(pysqlite_Connection *self,
2112
2112
Py_END_ALLOW_THREADS
2113
2113
2114
2114
if (bck_handle == NULL) {
2115
- _pysqlite_seterror (self -> state , bck_conn );
2115
+ set_error_from_db (self -> state , bck_conn );
2116
2116
return NULL ;
2117
2117
}
2118
2118
@@ -2150,7 +2150,7 @@ pysqlite_connection_backup_impl(pysqlite_Connection *self,
2150
2150
Py_END_ALLOW_THREADS
2151
2151
2152
2152
if (rc != SQLITE_OK ) {
2153
- _pysqlite_seterror (self -> state , bck_conn );
2153
+ set_error_from_db (self -> state , bck_conn );
2154
2154
return NULL ;
2155
2155
}
2156
2156
@@ -2208,7 +2208,7 @@ pysqlite_connection_create_collation_impl(pysqlite_Connection *self,
2208
2208
if (callable != Py_None ) {
2209
2209
free_callback_context (ctx );
2210
2210
}
2211
- _pysqlite_seterror (self -> state , self -> db );
2211
+ set_error_from_db (self -> state , self -> db );
2212
2212
return NULL ;
2213
2213
}
2214
2214
@@ -2326,7 +2326,7 @@ deserialize_impl(pysqlite_Connection *self, Py_buffer *data,
2326
2326
Py_END_ALLOW_THREADS
2327
2327
2328
2328
if (rc != SQLITE_OK ) {
2329
- ( void ) _pysqlite_seterror (self -> state , self -> db );
2329
+ set_error_from_db (self -> state , self -> db );
2330
2330
return NULL ;
2331
2331
}
2332
2332
Py_RETURN_NONE ;
@@ -2521,7 +2521,7 @@ setconfig_impl(pysqlite_Connection *self, int op, int enable)
2521
2521
int actual ;
2522
2522
int rc = sqlite3_db_config (self -> db , op , enable , & actual );
2523
2523
if (rc != SQLITE_OK ) {
2524
- ( void ) _pysqlite_seterror (self -> state , self -> db );
2524
+ set_error_from_db (self -> state , self -> db );
2525
2525
return NULL ;
2526
2526
}
2527
2527
if (enable != actual ) {
@@ -2556,7 +2556,7 @@ getconfig_impl(pysqlite_Connection *self, int op)
2556
2556
int current ;
2557
2557
int rc = sqlite3_db_config (self -> db , op , -1 , & current );
2558
2558
if (rc != SQLITE_OK ) {
2559
- ( void ) _pysqlite_seterror (self -> state , self -> db );
2559
+ set_error_from_db (self -> state , self -> db );
2560
2560
return -1 ;
2561
2561
}
2562
2562
return current ;
0 commit comments