Merge branch 'flush_prepared_cached' of https://github.com/edelangh/rusqlite into edelangh-flush_prepared_cached

This commit is contained in:
John Gallagher 2017-11-12 16:23:59 -07:00
commit d000aa52d7

View File

@ -185,6 +185,12 @@ pub struct Connection {
unsafe impl Send for Connection {}
impl Drop for Connection {
fn drop(&mut self) {
self.flush_prepared_statement_cache();
}
}
impl Connection {
/// Open a new connection to a SQLite database.
///
@ -868,7 +874,15 @@ impl InnerConnection {
impl Drop for InnerConnection {
#[allow(unused_must_use)]
fn drop(&mut self) {
self.close();
use std::thread::panicking;
if let Err(e) = self.close() {
if panicking() {
eprintln!("Error while closing SQLite connection: {:?}", e);
} else {
panic!("Error while closing SQLite connection: {:?}", e);
}
}
}
}