mirror of
https://github.com/isar/rusqlite.git
synced 2025-02-01 13:00:51 +08:00
Merge remote-tracking branch 'jgallagher/master' into vtab
This commit is contained in:
commit
8b9437ff35
@ -33,7 +33,7 @@ serde_json = { version = "0.8", optional = true }
|
|||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempdir = "0.3"
|
tempdir = "0.3"
|
||||||
lazy_static = "0.2"
|
lazy_static = "0.2"
|
||||||
regex = "0.1"
|
regex = "0.2"
|
||||||
|
|
||||||
[dependencies.libsqlite3-sys]
|
[dependencies.libsqlite3-sys]
|
||||||
path = "libsqlite3-sys"
|
path = "libsqlite3-sys"
|
||||||
|
15
src/lib.rs
15
src/lib.rs
@ -90,6 +90,7 @@ pub use error::Error;
|
|||||||
pub use cache::CachedStatement;
|
pub use cache::CachedStatement;
|
||||||
|
|
||||||
#[cfg(feature = "load_extension")]
|
#[cfg(feature = "load_extension")]
|
||||||
|
#[allow(deprecated)]
|
||||||
pub use load_extension_guard::{SqliteLoadExtensionGuard, LoadExtensionGuard};
|
pub use load_extension_guard::{SqliteLoadExtensionGuard, LoadExtensionGuard};
|
||||||
|
|
||||||
pub mod types;
|
pub mod types;
|
||||||
@ -615,8 +616,11 @@ impl InnerConnection {
|
|||||||
fn close(&mut self) -> Result<()> {
|
fn close(&mut self) -> Result<()> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let r = ffi::sqlite3_close(self.db());
|
let r = ffi::sqlite3_close(self.db());
|
||||||
|
let r = self.decode_result(r);
|
||||||
|
if r.is_ok() {
|
||||||
self.db = ptr::null_mut();
|
self.db = ptr::null_mut();
|
||||||
self.decode_result(r)
|
}
|
||||||
|
r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1286,13 +1290,14 @@ mod test {
|
|||||||
raw_stmt
|
raw_stmt
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = db.close();
|
// now that we have an open statement, trying (and retrying) to close should fail.
|
||||||
assert!(result.is_err());
|
let (db, _) = db.close().unwrap_err();
|
||||||
|
let (db, _) = db.close().unwrap_err();
|
||||||
|
let (db, _) = db.close().unwrap_err();
|
||||||
|
|
||||||
// finalize the open statement so a second close will succeed
|
// finalize the open statement so a final close will succeed
|
||||||
assert_eq!(ffi::SQLITE_OK, unsafe { ffi::sqlite3_finalize(raw_stmt) });
|
assert_eq!(ffi::SQLITE_OK, unsafe { ffi::sqlite3_finalize(raw_stmt) });
|
||||||
|
|
||||||
let (db, _) = result.unwrap_err();
|
|
||||||
db.close().unwrap();
|
db.close().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user