Query journal_mode via a separate read-only connection so the result is * independent of any state held inside the cbm_store_t under test. */
| 29 | /* Query journal_mode via a separate read-only connection so the result is |
| 30 | * independent of any state held inside the cbm_store_t under test. */ |
| 31 | static char *get_journal_mode(const char *db_path) { |
| 32 | sqlite3 *db; |
| 33 | if (sqlite3_open_v2(db_path, &db, SQLITE_OPEN_READONLY, NULL) != SQLITE_OK) |
| 34 | return NULL; |
| 35 | sqlite3_stmt *stmt; |
| 36 | char *mode = NULL; |
| 37 | if (sqlite3_prepare_v2(db, "PRAGMA journal_mode;", -1, &stmt, NULL) == SQLITE_OK) { |
| 38 | if (sqlite3_step(stmt) == SQLITE_ROW) |
| 39 | mode = strdup((const char *)sqlite3_column_text(stmt, 0)); |
| 40 | sqlite3_finalize(stmt); |
| 41 | } |
| 42 | sqlite3_close(db); |
| 43 | return mode; |
| 44 | } |
| 45 | |
| 46 | static void make_temp_path(char *buf, size_t n) { |
| 47 | snprintf(buf, n, "%s/cmm_bulk_test_%d.db", cbm_tmpdir(), (int)getpid()); |