()
| 267 | |
| 268 | #[test] |
| 269 | fn test_statement_pool_basic() { |
| 270 | let pool = StatementPool::new(10); |
| 271 | let conn = Connection::open_in_memory().unwrap(); |
| 272 | |
| 273 | // Create a test table |
| 274 | conn.execute("CREATE TABLE test (id INTEGER, name TEXT)", []).unwrap(); |
| 275 | conn.execute("INSERT INTO test VALUES (1, 'Alice'), (2, 'Bob')", []).unwrap(); |
| 276 | |
| 277 | // Test caching behavior |
| 278 | let query = "SELECT id, name FROM test WHERE id = ?"; |
| 279 | |
| 280 | // First execution should cache metadata |
| 281 | let (_stmt1, metadata1) = pool.prepare_and_cache(&conn, query).unwrap(); |
| 282 | assert_eq!(metadata1.column_names, vec!["id", "name"]); |
| 283 | assert_eq!(metadata1.parameter_count, 1); |
| 284 | assert!(metadata1.is_select); |
| 285 | |
| 286 | // Second execution should reuse cached metadata |
| 287 | let (_stmt2, metadata2) = pool.prepare_and_cache(&conn, query).unwrap(); |
| 288 | assert_eq!(metadata1.column_names, metadata2.column_names); |
| 289 | assert_eq!(metadata1.parameter_count, metadata2.parameter_count); |
| 290 | } |
| 291 | |
| 292 | #[test] |
| 293 | fn test_statement_pool_execute() { |
nothing calls this directly
no test coverage detected