Every doc_link_candidates row in a store (0 without the table); -1 on an * error. */
| 22158 | /* Every doc_link_candidates row in a store (0 without the table); -1 on an |
| 22159 | * error. */ |
| 22160 | static int doc_candidate_row_count(cbm_store_t *s) { |
| 22161 | sqlite3 *db = cbm_store_get_db(s); |
| 22162 | sqlite3_stmt *st = NULL; |
| 22163 | if (sqlite3_prepare_v2(db, |
| 22164 | "SELECT count(*) FROM sqlite_master WHERE type='table' AND " |
| 22165 | "name='doc_link_candidates'", |
| 22166 | -1, &st, NULL) != SQLITE_OK) { |
| 22167 | return -1; |
| 22168 | } |
| 22169 | bool has_table = sqlite3_step(st) == SQLITE_ROW && sqlite3_column_int(st, 0) > 0; |
| 22170 | sqlite3_finalize(st); |
| 22171 | if (!has_table) { |
| 22172 | return 0; |
| 22173 | } |
| 22174 | if (sqlite3_prepare_v2(db, "SELECT count(*) FROM doc_link_candidates", -1, &st, NULL) != |
| 22175 | SQLITE_OK) { |
| 22176 | return -1; |
| 22177 | } |
| 22178 | int n = sqlite3_step(st) == SQLITE_ROW ? sqlite3_column_int(st, 0) : -1; |
| 22179 | sqlite3_finalize(st); |
| 22180 | return n; |
| 22181 | } |
| 22182 | |
| 22183 | /* doc_candidates off: the same repository indexed with the switch off has no |
| 22184 | * candidate rows and exactly the nodes and edges of the default run, which has |
no test coverage detected