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

Function cv_signature

tests/test_conditional_variants.c:645–672  ·  view source on GitHub ↗

CALLS edges by qualified name, every node's variant spans and every node's * variant_key, one line each. */

Source from the content-addressed store, hash-verified

643/* CALLS edges by qualified name, every node's variant spans and every node's
644 * variant_key, one line each. */
645static bool cv_signature(const char *db_path, char *out, size_t n) {
646 sqlite3 *db = NULL;
647 if (sqlite3_open_v2(db_path, &db, SQLITE_OPEN_READONLY, NULL) != SQLITE_OK) {
648 sqlite3_close(db);
649 return false;
650 }
651 const char *sql =
652 "SELECT line FROM (SELECT s.qualified_name || '>' || t.qualified_name AS line "
653 "FROM edges e JOIN nodes s ON s.id=e.source_id JOIN nodes t ON t.id=e.target_id "
654 "WHERE e.type='CALLS' "
655 "UNION ALL SELECT 'variants ' || qualified_name || ' ' || "
656 "json_extract(properties,'$.variants') FROM nodes "
657 "WHERE json_extract(properties,'$.variants') IS NOT NULL "
658 "UNION ALL SELECT 'key ' || qualified_name || ' ' || "
659 "json_extract(properties,'$.variant_key') FROM nodes "
660 "WHERE json_extract(properties,'$.variant_key') IS NOT NULL) ORDER BY line";
661 sqlite3_stmt *stmt = NULL;
662 bool ok = sqlite3_prepare_v2(db, sql, -1, &stmt, NULL) == SQLITE_OK;
663 out[0] = '\0';
664 while (ok && sqlite3_step(stmt) == SQLITE_ROW) {
665 const char *line = (const char *)sqlite3_column_text(stmt, 0);
666 size_t used = strlen(out);
667 snprintf(out + used, n - used, "%s\n", line ? line : "?");
668 }
669 sqlite3_finalize(stmt);
670 sqlite3_close(db);
671 return ok;
672}
673
674/* Rewrite `name` in `repo`, repair the incremental DB, index the same tree
675 * from scratch, and compare. */

Callers 1

cv_edit_matches_fullFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected