| 246 | enum { ST_READ_BATCH_MS = 100 }; |
| 247 | |
| 248 | bool cbm_store_read_batch_begin(cbm_store_t *s) { |
| 249 | if (!s || !s->db || s->read_batch || !sqlite3_get_autocommit(s->db)) { |
| 250 | return false; |
| 251 | } |
| 252 | if (sqlite3_exec(s->db, "BEGIN DEFERRED;", NULL, NULL, NULL) != SQLITE_OK) { |
| 253 | return false; |
| 254 | } |
| 255 | s->read_batch = true; |
| 256 | s->read_batch_started_ms = cbm_now_ms(); |
| 257 | return true; |
| 258 | } |
| 259 | |
| 260 | void cbm_store_read_batch_end(cbm_store_t *s) { |
| 261 | if (!s || !s->read_batch) { |
no test coverage detected