MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / constructor

Method constructor

src/codegraph/schema.ts:77–98  ·  view source on GitHub ↗
(dbPath: string)

Source from the content-addressed store, hash-verified

75 private deleteFileByPath: Database.Statement;
76
77 constructor(dbPath: string) {
78 this.db = openDatabase(dbPath);
79 this.db.exec(SCHEMA);
80
81 this.upsertFile = this.db.prepare(`
82 INSERT INTO files (path, language, mtime_ms, size_bytes, content_hash, indexed_at)
83 VALUES (?, ?, ?, ?, ?, CURRENT_TIMESTAMP)
84 ON CONFLICT(path) DO UPDATE SET
85 language=excluded.language,
86 mtime_ms=excluded.mtime_ms,
87 size_bytes=excluded.size_bytes,
88 content_hash=excluded.content_hash,
89 indexed_at=CURRENT_TIMESTAMP
90 `);
91 this.deleteSymbolsForFile = this.db.prepare(`DELETE FROM symbols WHERE file_id = ?`);
92 this.insertSymbol = this.db.prepare(`
93 INSERT INTO symbols (file_id, name, kind, start_line, end_line, start_col, parent_symbol_id, signature)
94 VALUES (?, ?, ?, ?, ?, ?, ?, ?)
95 `);
96 this.findFileByPath = this.db.prepare(`SELECT * FROM files WHERE path = ?`);
97 this.deleteFileByPath = this.db.prepare(`DELETE FROM files WHERE path = ?`);
98 }
99
100 /** Returns true if the file's mtime+size+hash match our cached entry → can be skipped. */
101 isFileFresh(path: string, mtimeMs: number, sizeBytes: number, contentHash: string | null): boolean {

Callers

nothing calls this directly

Calls 1

openDatabaseFunction · 0.85

Tested by

no test coverage detected