Optimize named params via caching and use of smallvec

This commit is contained in:
Thom Chiovoloni
2020-04-13 23:47:12 -07:00
committed by Thom Chiovoloni
parent cf9b6e9ae2
commit 552416039e
7 changed files with 213 additions and 12 deletions

View File

@@ -128,6 +128,8 @@ mod version;
#[cfg(feature = "vtab")]
pub mod vtab;
pub(crate) mod util;
// Number of cached prepared statements we'll hold on to.
const STATEMENT_CACHE_DEFAULT_CAPACITY: usize = 16;
/// To be used when your statement has no [parameter](https://sqlite.org/lang_expr.html#varparam).
@@ -274,7 +276,7 @@ fn path_to_cstring(p: &Path) -> Result<CString> {
#[cfg(not(unix))]
fn path_to_cstring(p: &Path) -> Result<CString> {
let s = p.to_str().ok_or_else(|| Error::InvalidPath(p.to_owned()))?;
str_to_cstring(s)
Ok(CString::new(s)?)
}
/// Name for a database within a SQLite connection.