| 3433 | /* ── NodeDegree ────────────────────────────────────────────────── */ |
| 3434 | |
| 3435 | void cbm_store_node_degree(cbm_store_t *s, int64_t node_id, int *in_deg, int *out_deg) { |
| 3436 | if (!s) { |
| 3437 | if (in_deg) |
| 3438 | *in_deg = 0; |
| 3439 | if (out_deg) |
| 3440 | *out_deg = 0; |
| 3441 | return; |
| 3442 | } |
| 3443 | *in_deg = 0; |
| 3444 | *out_deg = 0; |
| 3445 | |
| 3446 | const char *in_sql = "SELECT COUNT(*) FROM edges WHERE target_id = ?1 AND type = 'CALLS'"; |
| 3447 | sqlite3_stmt *stmt = NULL; |
| 3448 | if (sqlite3_prepare_v2(s->db, in_sql, CBM_NOT_FOUND, &stmt, NULL) == SQLITE_OK) { |
| 3449 | sqlite3_bind_int64(stmt, SKIP_ONE, node_id); |
| 3450 | if (sqlite3_step(stmt) == SQLITE_ROW) { |
| 3451 | *in_deg = sqlite3_column_int(stmt, 0); |
| 3452 | } |
| 3453 | sqlite3_finalize(stmt); |
| 3454 | } |
| 3455 | |
| 3456 | const char *out_sql = "SELECT COUNT(*) FROM edges WHERE source_id = ?1 AND type = 'CALLS'"; |
| 3457 | if (sqlite3_prepare_v2(s->db, out_sql, CBM_NOT_FOUND, &stmt, NULL) == SQLITE_OK) { |
| 3458 | sqlite3_bind_int64(stmt, SKIP_ONE, node_id); |
| 3459 | if (sqlite3_step(stmt) == SQLITE_ROW) { |
| 3460 | *out_deg = sqlite3_column_int(stmt, 0); |
| 3461 | } |
| 3462 | sqlite3_finalize(stmt); |
| 3463 | } |
| 3464 | } |
| 3465 | |
| 3466 | /* ── List distinct file paths ────────────────────────────────── */ |
| 3467 |
no outgoing calls
no test coverage detected