diff --git a/src/inner_connection.rs b/src/inner_connection.rs index 0070b75..056f83a 100644 --- a/src/inner_connection.rs +++ b/src/inner_connection.rs @@ -12,6 +12,7 @@ use super::{Connection, InterruptHandle, OpenFlags, PrepFlags, Result}; use crate::error::{error_from_handle, error_from_sqlite_code, error_with_offset, Error}; use crate::raw_statement::RawStatement; use crate::statement::Statement; +use crate::version_number; pub struct InnerConnection { pub db: *mut ffi::sqlite3, @@ -99,7 +100,9 @@ impl InnerConnection { } // attempt to turn on extended results code; don't fail if we can't. - ffi::sqlite3_extended_result_codes(db, 1); + if version_number() < 3_037_000 || !flags.contains(OpenFlags::SQLITE_OPEN_EXRESCODE) { + ffi::sqlite3_extended_result_codes(db, 1); + } let r = ffi::sqlite3_busy_timeout(db, 5000); if r != ffi::SQLITE_OK { @@ -210,7 +213,6 @@ impl InnerConnection { let mut c_stmt: *mut ffi::sqlite3_stmt = ptr::null_mut(); let (c_sql, len, _) = str_for_sqlite(sql.as_bytes())?; let mut c_tail: *const c_char = ptr::null(); - // TODO sqlite3_prepare_v3 (https://sqlite.org/c3ref/c_prepare_normalize.html) // 3.20.0, #728 #[cfg(not(feature = "unlock_notify"))] let r = unsafe { self.prepare_(c_sql, len, flags, &mut c_stmt, &mut c_tail) }; #[cfg(feature = "unlock_notify")] diff --git a/src/lib.rs b/src/lib.rs index 7572908..2ca74bc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1214,6 +1214,7 @@ impl Default for OpenFlags { | OpenFlags::SQLITE_OPEN_CREATE | OpenFlags::SQLITE_OPEN_NO_MUTEX | OpenFlags::SQLITE_OPEN_URI + | OpenFlags::SQLITE_OPEN_EXRESCODE } }