| 5956 | /* ── NodeDegree ────────────────────────────────────────────────── */ |
| 5957 | |
| 5958 | void cbm_store_node_degree(cbm_store_t *s, int64_t node_id, int *in_deg, int *out_deg) { |
| 5959 | if (!s) { |
| 5960 | if (in_deg) |
| 5961 | *in_deg = 0; |
| 5962 | if (out_deg) |
| 5963 | *out_deg = 0; |
| 5964 | return; |
| 5965 | } |
| 5966 | *in_deg = 0; |
| 5967 | *out_deg = 0; |
| 5968 | |
| 5969 | const char *in_sql = "SELECT COUNT(*) FROM edges WHERE target_id = ?1 AND type = 'CALLS'"; |
| 5970 | sqlite3_stmt *stmt = NULL; |
| 5971 | if (sqlite3_prepare_v2(s->db, in_sql, CBM_NOT_FOUND, &stmt, NULL) == SQLITE_OK) { |
| 5972 | sqlite3_bind_int64(stmt, SKIP_ONE, node_id); |
| 5973 | if (sqlite3_step(stmt) == SQLITE_ROW) { |
| 5974 | *in_deg = sqlite3_column_int(stmt, 0); |
| 5975 | } |
| 5976 | sqlite3_finalize(stmt); |
| 5977 | } |
| 5978 | |
| 5979 | const char *out_sql = "SELECT COUNT(*) FROM edges WHERE source_id = ?1 AND type = 'CALLS'"; |
| 5980 | if (sqlite3_prepare_v2(s->db, out_sql, CBM_NOT_FOUND, &stmt, NULL) == SQLITE_OK) { |
| 5981 | sqlite3_bind_int64(stmt, SKIP_ONE, node_id); |
| 5982 | if (sqlite3_step(stmt) == SQLITE_ROW) { |
| 5983 | *out_deg = sqlite3_column_int(stmt, 0); |
| 5984 | } |
| 5985 | sqlite3_finalize(stmt); |
| 5986 | } |
| 5987 | } |
| 5988 | |
| 5989 | /* ── List distinct file paths ────────────────────────────────── */ |
| 5990 |
no outgoing calls
no test coverage detected