mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-26 11:31:37 +08:00
Add test with cacheable set to false
This commit is contained in:
parent
cb1951c21a
commit
5876be3d48
16
src/cache.rs
16
src/cache.rs
@ -145,4 +145,20 @@ mod test {
|
|||||||
assert_eq!(0, cache.len());
|
assert_eq!(0, cache.len());
|
||||||
assert_eq!(15, cache.capacity());
|
assert_eq!(15, cache.capacity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_cacheable() {
|
||||||
|
let db = Connection::open_in_memory().unwrap();
|
||||||
|
let cache = StatementCache::new(&db, 15);
|
||||||
|
|
||||||
|
let sql = "PRAGMA schema_version";
|
||||||
|
{
|
||||||
|
let mut stmt = cache.get(sql).unwrap();
|
||||||
|
assert_eq!(0, cache.len());
|
||||||
|
assert_eq!(0,
|
||||||
|
stmt.query(&[]).unwrap().get_expected_row().unwrap().get::<i64>(0));
|
||||||
|
stmt.cacheable = false;
|
||||||
|
}
|
||||||
|
assert_eq!(0, cache.len());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user