| 3416 | /* ── NodeDegree ────────────────────────────────────────────────── */ |
| 3417 | |
| 3418 | void cbm_store_node_degree(cbm_store_t *s, int64_t node_id, int *in_deg, int *out_deg) { |
| 3419 | if (!s) { |
| 3420 | if (in_deg) |
| 3421 | *in_deg = 0; |
| 3422 | if (out_deg) |
| 3423 | *out_deg = 0; |
| 3424 | return; |
| 3425 | } |
| 3426 | *in_deg = 0; |
| 3427 | *out_deg = 0; |
| 3428 | |
| 3429 | const char *in_sql = "SELECT COUNT(*) FROM edges WHERE target_id = ?1 AND type = 'CALLS'"; |
| 3430 | sqlite3_stmt *stmt = NULL; |
| 3431 | if (sqlite3_prepare_v2(s->db, in_sql, CBM_NOT_FOUND, &stmt, NULL) == SQLITE_OK) { |
| 3432 | sqlite3_bind_int64(stmt, SKIP_ONE, node_id); |
| 3433 | if (sqlite3_step(stmt) == SQLITE_ROW) { |
| 3434 | *in_deg = sqlite3_column_int(stmt, 0); |
| 3435 | } |
| 3436 | sqlite3_finalize(stmt); |
| 3437 | } |
| 3438 | |
| 3439 | const char *out_sql = "SELECT COUNT(*) FROM edges WHERE source_id = ?1 AND type = 'CALLS'"; |
| 3440 | if (sqlite3_prepare_v2(s->db, out_sql, CBM_NOT_FOUND, &stmt, NULL) == SQLITE_OK) { |
| 3441 | sqlite3_bind_int64(stmt, SKIP_ONE, node_id); |
| 3442 | if (sqlite3_step(stmt) == SQLITE_ROW) { |
| 3443 | *out_deg = sqlite3_column_int(stmt, 0); |
| 3444 | } |
| 3445 | sqlite3_finalize(stmt); |
| 3446 | } |
| 3447 | } |
| 3448 | |
| 3449 | /* ── List distinct file paths ────────────────────────────────── */ |
| 3450 |
no outgoing calls
no test coverage detected