| 3222 | /* ── NodeDegree ────────────────────────────────────────────────── */ |
| 3223 | |
| 3224 | void cbm_store_node_degree(cbm_store_t *s, int64_t node_id, int *in_deg, int *out_deg) { |
| 3225 | if (!s) { |
| 3226 | if (in_deg) |
| 3227 | *in_deg = 0; |
| 3228 | if (out_deg) |
| 3229 | *out_deg = 0; |
| 3230 | return; |
| 3231 | } |
| 3232 | *in_deg = 0; |
| 3233 | *out_deg = 0; |
| 3234 | |
| 3235 | const char *in_sql = "SELECT COUNT(*) FROM edges WHERE target_id = ?1 AND type = 'CALLS'"; |
| 3236 | sqlite3_stmt *stmt = NULL; |
| 3237 | if (sqlite3_prepare_v2(s->db, in_sql, CBM_NOT_FOUND, &stmt, NULL) == SQLITE_OK) { |
| 3238 | sqlite3_bind_int64(stmt, SKIP_ONE, node_id); |
| 3239 | if (sqlite3_step(stmt) == SQLITE_ROW) { |
| 3240 | *in_deg = sqlite3_column_int(stmt, 0); |
| 3241 | } |
| 3242 | sqlite3_finalize(stmt); |
| 3243 | } |
| 3244 | |
| 3245 | const char *out_sql = "SELECT COUNT(*) FROM edges WHERE source_id = ?1 AND type = 'CALLS'"; |
| 3246 | if (sqlite3_prepare_v2(s->db, out_sql, CBM_NOT_FOUND, &stmt, NULL) == SQLITE_OK) { |
| 3247 | sqlite3_bind_int64(stmt, SKIP_ONE, node_id); |
| 3248 | if (sqlite3_step(stmt) == SQLITE_ROW) { |
| 3249 | *out_deg = sqlite3_column_int(stmt, 0); |
| 3250 | } |
| 3251 | sqlite3_finalize(stmt); |
| 3252 | } |
| 3253 | } |
| 3254 | |
| 3255 | /* ── List distinct file paths ────────────────────────────────── */ |
| 3256 |
no outgoing calls
no test coverage detected