MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / oa_db_mentions

Function oa_db_mentions

tests/test_openapi.c:129–150  ·  view source on GitHub ↗

MENTIONS edges from the Route `route_qn` to a node whose QN ends with `tgt`. */

Source from the content-addressed store, hash-verified

127
128/* MENTIONS edges from the Route `route_qn` to a node whose QN ends with `tgt`. */
129static int oa_db_mentions(const char *db, const char *route_qn, const char *tgt) {
130 sqlite3 *h = NULL;
131 int n = 0;
132 if (sqlite3_open_v2(db, &h, SQLITE_OPEN_READONLY, NULL) != SQLITE_OK) {
133 sqlite3_close(h);
134 return -1;
135 }
136 sqlite3_stmt *st = NULL;
137 const char *sql = "SELECT count(*) FROM edges e JOIN nodes s ON s.id = e.source_id "
138 "JOIN nodes t ON t.id = e.target_id WHERE e.type = 'MENTIONS' "
139 "AND s.qualified_name = ?1 AND t.qualified_name LIKE '%' || ?2";
140 if (sqlite3_prepare_v2(h, sql, -1, &st, NULL) == SQLITE_OK) {
141 sqlite3_bind_text(st, 1, route_qn, -1, SQLITE_TRANSIENT);
142 sqlite3_bind_text(st, 2, tgt, -1, SQLITE_TRANSIENT);
143 if (sqlite3_step(st) == SQLITE_ROW) {
144 n = sqlite3_column_int(st, 0);
145 }
146 }
147 sqlite3_finalize(st);
148 sqlite3_close(h);
149 return n;
150}
151
152/* MENTIONS edges from the Route `route_qn` whose properties hold `part`. */
153static int oa_db_mentions_props(const char *db, const char *route_qn, const char *part) {

Callers 1

test_openapi.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected