A failed SQL query must never look like an absent false edge. */
| 10647 | |
| 10648 | /* A failed SQL query must never look like an absent false edge. */ |
| 10649 | static int navigation_probe_count(cbm_store_t *store, const char *sql, const char *project, |
| 10650 | const char *value, const char *source_name) { |
| 10651 | sqlite3_stmt *st = NULL; |
| 10652 | sqlite3 *db = cbm_store_get_db(store); |
| 10653 | if (!db || sqlite3_prepare_v2(db, sql, -1, &st, NULL) != SQLITE_OK) { |
| 10654 | sqlite3_finalize(st); |
| 10655 | return -1; |
| 10656 | } |
| 10657 | int count = -1; |
| 10658 | bool bound = sqlite3_bind_text(st, 1, project, -1, SQLITE_TRANSIENT) == SQLITE_OK && |
| 10659 | sqlite3_bind_text(st, 2, value, -1, SQLITE_TRANSIENT) == SQLITE_OK; |
| 10660 | if (bound && source_name) { |
| 10661 | bound = sqlite3_bind_text(st, 3, source_name, -1, SQLITE_TRANSIENT) == SQLITE_OK; |
| 10662 | } |
| 10663 | if (bound && sqlite3_step(st) == SQLITE_ROW) { |
| 10664 | count = sqlite3_column_int(st, 0); |
| 10665 | if (sqlite3_step(st) != SQLITE_DONE) { |
| 10666 | count = -1; |
| 10667 | } |
| 10668 | } |
| 10669 | if (sqlite3_finalize(st) != SQLITE_OK) { |
| 10670 | count = -1; |
| 10671 | } |
| 10672 | return count; |
| 10673 | } |
| 10674 | |
| 10675 | /* #1250: exercise the generic URL heuristic with real extracted occurrences |
| 10676 | * and real source nodes. More than 50 files selects the parallel resolver. |
no test coverage detected