| 213 | /* ── Build ──────────────────────────────────────────────────────── */ |
| 214 | |
| 215 | static bool gm_bounds(sqlite3 *db, int64_t *max_node, int64_t *max_edge) { |
| 216 | sqlite3_stmt *st = NULL; |
| 217 | if (sqlite3_prepare_v2(db, "SELECT (SELECT max(id) FROM nodes), (SELECT max(id) FROM edges);", |
| 218 | -1, &st, NULL) != SQLITE_OK) { |
| 219 | sqlite3_finalize(st); |
| 220 | return false; |
| 221 | } |
| 222 | bool ok = sqlite3_step(st) == SQLITE_ROW; |
| 223 | if (ok) { |
| 224 | *max_node = sqlite3_column_int64(st, 0); |
| 225 | *max_edge = sqlite3_column_int64(st, 1); |
| 226 | } |
| 227 | sqlite3_finalize(st); |
| 228 | return ok && *max_node >= 0 && *max_edge >= 0 && *max_node < GM_ID_LIMIT && |
| 229 | *max_edge < GM_ID_LIMIT; |
| 230 | } |
| 231 | |
| 232 | /* Upper bound of a layer's bytes: edge ids are unique positive rowids, so the |
| 233 | * edge count never exceeds max(edges.id). */ |
no outgoing calls
no test coverage detected