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

Function sp_edge_set

tests/test_spawns.c:285–304  ·  view source on GitHub ↗

Every SPAWNS edge as "caller>program|api" lines, sorted, into `out`. */

Source from the content-addressed store, hash-verified

283
284/* Every SPAWNS edge as "caller>program|api" lines, sorted, into `out`. */
285static bool sp_edge_set(sp_proj_t *p, char *out, size_t n) {
286 sqlite3 *db = cbm_store_get_db(p->store);
287 sqlite3_stmt *stmt = NULL;
288 const char *sql = "SELECT s.name || '>' || t.name || '|' || json_extract(e.properties,'$.api') "
289 "FROM edges e JOIN nodes s ON s.id=e.source_id JOIN nodes t ON "
290 "t.id=e.target_id WHERE e.project=?1 AND e.type='SPAWNS' ORDER BY 1";
291 if (!db || sqlite3_prepare_v2(db, sql, -1, &stmt, NULL) != SQLITE_OK) {
292 sqlite3_finalize(stmt);
293 return false;
294 }
295 sqlite3_bind_text(stmt, 1, p->project, -1, SQLITE_TRANSIENT);
296 out[0] = '\0';
297 while (sqlite3_step(stmt) == SQLITE_ROW) {
298 const char *row = (const char *)sqlite3_column_text(stmt, 0);
299 size_t used = strlen(out);
300 snprintf(out + used, n - used, "%s\n", row ? row : "?");
301 }
302 sqlite3_finalize(stmt);
303 return true;
304}
305
306static const sp_file_t SP_FILES[] = {
307 /* subprocess.run inside the module's own `def run`: the resolver's

Callers 1

test_spawns.cFile · 0.85

Calls 1

cbm_store_get_dbFunction · 0.85

Tested by

no test coverage detected