diff --git a/src/connection.rs b/src/connection.rs index 4dfd154..923d2ea 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -55,10 +55,6 @@ impl Connection { } } - pub fn set_memory_limit(limit: i64) -> i64 { - unsafe { ffi::sqlite3_hard_heap_limit64(limit) } - } - /// Execute a statement without processing the resulting rows if any. #[inline] pub fn execute>(&self, statement: T) -> Result<()> { @@ -93,6 +89,7 @@ impl Connection { /// Create a prepared statement. #[inline] + pub fn prepare>(&self, statement: T) -> Result { pub fn prepare>(&self, statement: T) -> Result { crate::statement::new(self.raw, statement) } diff --git a/src/lib.rs b/src/lib.rs index 43af367..f84597e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -304,3 +304,24 @@ fn last_error(raw: ffi::Sqlite3DbHandle) -> Option { }) } } + +/// From the SQLite docs: +/// +/// The sqlite3_soft_heap_limit64() interface sets and/or queries the soft limit on the amount of +/// heap memory that may be allocated by SQLite. SQLite strives to keep heap memory utilization +/// below the soft heap limit by reducing the number of pages held in the page cache as heap memory +/// usages approaches the limit. The soft heap limit is "soft" because even though SQLite strives +/// to stay below the limit, it will exceed the limit rather than generate an SQLITE_NOMEM error. +/// In other words, the soft heap limit is advisory only. +pub fn soft_heap_limit64(limit: i64) -> i64 { + unsafe { ffi::sqlite3_hard_heap_limit64(limit) } +} + +/// From the SQLite docs: +/// +/// This interface sets a hard upper bound of N bytes on the amount of memory that will be +/// allocated. The set_hard_heap_limit64 interface is similar to soft_heap_limit64 +/// except that memory allocations will fail when the hard heap limit is reached. +pub fn set_hard_heap_limit64(limit: i64) -> i64 { + unsafe { ffi::sqlite3_hard_heap_limit64(limit) } +}