MCPcopy Create free account
hub / github.com/erans/pgsqlite / test_statement_pool_execute

Function test_statement_pool_execute

src/cache/statement_pool.rs:293–311  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

291
292 #[test]
293 fn test_statement_pool_execute() {
294 let pool = StatementPool::new(10);
295 let conn = Connection::open_in_memory().unwrap();
296
297 conn.execute("CREATE TABLE test (id INTEGER, name TEXT)", []).unwrap();
298
299 // Test execute through pool
300 let rows_affected = pool.execute_cached(&conn,
301 "INSERT INTO test (id, name) VALUES (?, ?)",
302 [&1i32 as &dyn rusqlite::ToSql, &"Alice"]).unwrap();
303 assert_eq!(rows_affected, 1);
304
305 // Test query through pool
306 let (columns, rows) = pool.query_cached(&conn,
307 "SELECT id, name FROM test WHERE id = ?",
308 [&1i32 as &dyn rusqlite::ToSql]).unwrap();
309 assert_eq!(columns, vec!["id", "name"]);
310 assert_eq!(rows.len(), 1);
311 }
312
313 #[test]
314 fn test_batch_insert_fingerprint() {

Callers

nothing calls this directly

Calls 3

execute_cachedMethod · 0.80
query_cachedMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected