mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-23 19:24:19 +01:00
sqlite3: Clean up sqlite3_extended_errcode() function
This commit is contained in:
@@ -970,17 +970,20 @@ pub unsafe extern "C" fn sqlite3_errmsg(db: *mut sqlite3) -> *const ffi::c_char
|
||||
err_msg
|
||||
}
|
||||
|
||||
/// Returns the extended error code for the most recent failed API call to connection.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn sqlite3_extended_errcode(_db: *mut sqlite3) -> ffi::c_int {
|
||||
if !_db.is_null() && !sqlite3_safety_check_sick_or_ok(&*_db) {
|
||||
pub unsafe extern "C" fn sqlite3_extended_errcode(db: *mut sqlite3) -> ffi::c_int {
|
||||
if db.is_null() {
|
||||
return SQLITE_MISUSE;
|
||||
}
|
||||
|
||||
if _db.is_null() || (*_db).malloc_failed {
|
||||
let db: &mut sqlite3 = &mut *db;
|
||||
if !sqlite3_safety_check_sick_or_ok(db) {
|
||||
return SQLITE_MISUSE;
|
||||
}
|
||||
if db.malloc_failed {
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
|
||||
(*_db).err_code & (*_db).err_mask
|
||||
db.err_code & db.err_mask
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
||||
Reference in New Issue
Block a user