| 248 | } |
| 249 | |
| 250 | static int sp_count(sp_proj_t *p, const char *sql, const char *a, const char *b) { |
| 251 | sqlite3 *db = cbm_store_get_db(p->store); |
| 252 | sqlite3_stmt *stmt = NULL; |
| 253 | if (!db || sqlite3_prepare_v2(db, sql, -1, &stmt, NULL) != SQLITE_OK) { |
| 254 | sqlite3_finalize(stmt); |
| 255 | return -1; |
| 256 | } |
| 257 | int n = sqlite3_bind_parameter_count(stmt); |
| 258 | const char *values[] = {p->project, a, b}; |
| 259 | for (int i = 0; i < n && i < 3; i++) { |
| 260 | sqlite3_bind_text(stmt, i + 1, values[i], -1, SQLITE_TRANSIENT); |
| 261 | } |
| 262 | int count = sqlite3_step(stmt) == SQLITE_ROW ? sqlite3_column_int(stmt, 0) : -1; |
| 263 | sqlite3_finalize(stmt); |
| 264 | return count; |
| 265 | } |
| 266 | |
| 267 | /* SPAWNS edges from the definition named `caller` to the Process `program`. */ |
| 268 | static int sp_spawns(sp_proj_t *p, const char *caller, const char *program) { |
no test coverage detected