Access to sqlite3_db_cacheflush via Connection

Fix #984
This commit is contained in:
gwenn 2021-07-03 16:41:55 +02:00
parent b3bd775f90
commit 653e64ab98
2 changed files with 13 additions and 0 deletions

View File

@ -302,6 +302,12 @@ impl InnerConnection {
false false
} }
#[cfg(feature = "modern_sqlite")] // 3.10.0
pub fn cache_flush(&mut self) -> Result<()> {
check!(unsafe { ffi::sqlite3_db_cacheflush(self.db()) });
Ok(())
}
#[cfg(not(feature = "hooks"))] #[cfg(not(feature = "hooks"))]
#[inline] #[inline]
fn remove_hooks(&mut self) {} fn remove_hooks(&mut self) {}

View File

@ -868,6 +868,13 @@ impl Connection {
pub fn is_busy(&self) -> bool { pub fn is_busy(&self) -> bool {
self.db.borrow().is_busy() self.db.borrow().is_busy()
} }
/// Flush caches to disk mid-transaction
#[cfg(feature = "modern_sqlite")] // 3.10.0
#[cfg_attr(docsrs, doc(cfg(feature = "modern_sqlite")))]
pub fn cache_flush(&self) -> Result<()> {
self.db.borrow_mut().cache_flush()
}
} }
impl fmt::Debug for Connection { impl fmt::Debug for Connection {