| 29 | } |
| 30 | |
| 31 | fn build(in_memory: bool) -> ResultBench<Self> |
| 32 | where |
| 33 | Self: Sized, |
| 34 | { |
| 35 | let temp_dir = TempDir::new("sqlite_test")?; |
| 36 | let db = if in_memory { |
| 37 | Connection::open_in_memory()? |
| 38 | } else { |
| 39 | Connection::open(temp_dir.path().join("test.db"))? |
| 40 | }; |
| 41 | // For sqlite benchmarks we should set synchronous to off which more |
| 42 | // closely aligns with wal_fsync=false in stdb. |
| 43 | db.execute_batch("PRAGMA journal_mode = WAL; PRAGMA synchronous = off;")?; |
| 44 | |
| 45 | Ok(SQLite { |
| 46 | db, |
| 47 | _temp_dir: temp_dir, |
| 48 | }) |
| 49 | } |
| 50 | |
| 51 | type TableId = TableName; |
| 52 | |