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

Function imports_binding_count

tests/test_pipeline.c:11616–11636  ·  view source on GitHub ↗

IMPORTS edges out of `file_path` that bind `local_name`; -1 on a failed query. */

Source from the content-addressed store, hash-verified

11614
11615/* IMPORTS edges out of `file_path` that bind `local_name`; -1 on a failed query. */
11616static int imports_binding_count(cbm_store_t *s, const char *project, const char *file_path,
11617 const char *local_name) {
11618 static const char sql[] =
11619 "SELECT count(*) FROM edges e JOIN nodes f ON f.id=e.source_id WHERE e.project=?1 "
11620 "AND e.type='IMPORTS' AND f.file_path=?2 AND json_extract(e.properties,'$.local_name')=?3";
11621 sqlite3 *db = cbm_store_get_db(s);
11622 sqlite3_stmt *st = NULL;
11623 if (!db || sqlite3_prepare_v2(db, sql, -1, &st, NULL) != SQLITE_OK) {
11624 sqlite3_finalize(st);
11625 return -1;
11626 }
11627 int count = -1;
11628 if (sqlite3_bind_text(st, 1, project, -1, SQLITE_TRANSIENT) == SQLITE_OK &&
11629 sqlite3_bind_text(st, 2, file_path, -1, SQLITE_TRANSIENT) == SQLITE_OK &&
11630 sqlite3_bind_text(st, 3, local_name, -1, SQLITE_TRANSIENT) == SQLITE_OK &&
11631 sqlite3_step(st) == SQLITE_ROW) {
11632 count = sqlite3_column_int(st, 0);
11633 }
11634 sqlite3_finalize(st);
11635 return count;
11636}
11637
11638/* A call through an import of an EXTERNAL client library is that library's
11639 * call: `fetchIt` from `{ get as fetchIt } from 'axios'` is a typed GET,

Callers 1

test_pipeline.cFile · 0.85

Calls 1

cbm_store_get_dbFunction · 0.85

Tested by

no test coverage detected