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

Function dm_edge

tests/test_doc_mentions_helpers.h:81–106  ·  view source on GitHub ↗

Properties of the MENTIONS edge whose endpoints' qualified names END with * the given local paths ("Widget", "Helper.Once"); "" when absent; count via * *n. */

Source from the content-addressed store, hash-verified

79 * the given local paths ("Widget", "Helper.Once"); "" when absent; count via
80 * *n. */
81static inline void dm_edge(const char *db, const char *src_suffix, const char *tgt_suffix,
82 char *props, size_t cap, int *n) {
83 props[0] = '\0';
84 *n = 0;
85 sqlite3 *h = NULL;
86 if (sqlite3_open_v2(db, &h, SQLITE_OPEN_READONLY, NULL) != SQLITE_OK) {
87 sqlite3_close(h);
88 *n = -1;
89 return;
90 }
91 sqlite3_stmt *st = NULL;
92 const char *sql =
93 "SELECT e.properties FROM edges e JOIN nodes s ON s.id = e.source_id "
94 "JOIN nodes t ON t.id = e.target_id WHERE e.type = 'MENTIONS' "
95 "AND (s.qualified_name LIKE '%.' || ?1) AND (t.qualified_name LIKE '%.' || ?2)";
96 if (sqlite3_prepare_v2(h, sql, -1, &st, NULL) == SQLITE_OK) {
97 sqlite3_bind_text(st, 1, src_suffix, -1, SQLITE_TRANSIENT);
98 sqlite3_bind_text(st, 2, tgt_suffix, -1, SQLITE_TRANSIENT);
99 while (sqlite3_step(st) == SQLITE_ROW) {
100 (*n)++;
101 snprintf(props, cap, "%s", (const char *)sqlite3_column_text(st, 0));
102 }
103 }
104 sqlite3_finalize(st);
105 sqlite3_close(h);
106}
107
108/* Number of MENTIONS edges leaving the definition whose qualified name ends
109 * with `src_suffix`; -1 when the database cannot be read. */

Callers 15

c_edgeFunction · 0.85
adoc_edgeFunction · 0.85
pl_edgeFunction · 0.85
md_edgeFunction · 0.85
jt_edgeFunction · 0.85
go_tierFunction · 0.85
ts_edgeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected