True when SQLite runs `sql` as the single index search `plan`. */
| 3445 | |
| 3446 | /* True when SQLite runs `sql` as the single index search `plan`. */ |
| 3447 | static bool node_scan_plan_is(cbm_store_t *s, const char *sql, const char *plan) { |
| 3448 | char eqp[CBM_SZ_512]; |
| 3449 | snprintf(eqp, sizeof(eqp), "EXPLAIN QUERY PLAN %s", sql); |
| 3450 | sqlite3_stmt *stmt = NULL; |
| 3451 | if (sqlite3_prepare_v2(s->db, eqp, CBM_NOT_FOUND, &stmt, NULL) != SQLITE_OK) { |
| 3452 | sqlite3_finalize(stmt); |
| 3453 | return false; |
| 3454 | } |
| 3455 | int rows = 0; |
| 3456 | bool match = false; |
| 3457 | while (sqlite3_step(stmt) == SQLITE_ROW) { |
| 3458 | const char *detail = (const char *)sqlite3_column_text(stmt, ST_COL_3); |
| 3459 | match = rows == 0 && detail && strcmp(detail, plan) == 0; |
| 3460 | rows++; |
| 3461 | } |
| 3462 | sqlite3_finalize(stmt); |
| 3463 | return match && rows == SKIP_ONE; |
| 3464 | } |
| 3465 | |
| 3466 | cbm_store_node_scan_t *cbm_store_node_scan_open(cbm_store_t *s, const char *project, |
| 3467 | const char *label) { |
no outgoing calls
no test coverage detected