mirror of
https://github.com/isar/rusqlite.git
synced 2025-08-20 12:59:28 +08:00
Add Connection::release_memory
method
This is behind a new `release_memory` feature flag. It simply calls `sqlite3_db_release_memory` on the raw handle.
This commit is contained in:
committed by
Thom Chiovoloni
parent
7fb2d378af
commit
4d06d2222f
15
src/lib.rs
15
src/lib.rs
@@ -595,6 +595,21 @@ impl Connection {
|
||||
self.path.as_deref()
|
||||
}
|
||||
|
||||
/// Attempts to free as much heap memory as possible from the database
|
||||
/// connection.
|
||||
///
|
||||
/// This calls [`sqlite3_db_release_memory`](https://www.sqlite.org/c3ref/db_release_memory.html).
|
||||
#[inline]
|
||||
#[cfg(feature = "release_memory")]
|
||||
pub fn release_memory(&self) -> Result<()> {
|
||||
unsafe {
|
||||
match crate::ffi::sqlite3_db_release_memory(self.handle()) {
|
||||
ffi::SQLITE_OK => Ok(()),
|
||||
error => Err(error_from_sqlite_code(error)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Convenience method to prepare and execute a single SQL statement with
|
||||
/// named parameter(s).
|
||||
///
|
||||
|
Reference in New Issue
Block a user