Merge branch 'stmt-cache' of https://github.com/gwenn/rusqlite into gwenn-stmt-cache

This commit is contained in:
John Gallagher
2016-01-07 11:19:59 -05:00
6 changed files with 211 additions and 2 deletions

View File

@@ -87,6 +87,7 @@ mod error;
#[cfg(feature = "load_extension")]mod load_extension_guard;
#[cfg(feature = "trace")]pub mod trace;
#[cfg(feature = "backup")]pub mod backup;
#[cfg(feature = "cache")] pub mod cache;
#[cfg(feature = "functions")] pub mod functions;
#[cfg(feature = "blob")] pub mod blob;
@@ -912,6 +913,21 @@ impl<'conn> Statement<'conn> {
}
}
#[cfg(feature = "cache")]
fn clear_bindings(&mut self) {
unsafe {
ffi::sqlite3_clear_bindings(self.stmt);
};
}
#[cfg(feature = "cache")]
fn eq(&self, sql: &str) -> bool {
unsafe {
let c_slice = CStr::from_ptr(ffi::sqlite3_sql(self.stmt)).to_bytes();
str::from_utf8(c_slice).unwrap().eq(sql)
}
}
fn finalize_(&mut self) -> Result<()> {
let r = unsafe { ffi::sqlite3_finalize(self.stmt) };
self.stmt = ptr::null_mut();