diff --git a/src/inner_connection.rs b/src/inner_connection.rs index 1bd641c..47dd7ea 100644 --- a/src/inner_connection.rs +++ b/src/inner_connection.rs @@ -302,6 +302,12 @@ impl InnerConnection { 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"))] #[inline] fn remove_hooks(&mut self) {} diff --git a/src/lib.rs b/src/lib.rs index f7f463c..e642ed0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -868,6 +868,13 @@ impl Connection { pub fn is_busy(&self) -> bool { 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 {