MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / deleteReferencesByRowIds

Method deleteReferencesByRowIds

src/db/queries.ts:4922–4949  ·  view source on GitHub ↗

* Delete unresolved-ref rows by row id — the precise cleanup for refs a * resolution pass actually processed. The key-tuple variant above also * deletes SIBLING rows (same caller calling the same callee at other lines) * that a later batch hasn't attempted yet, so when a batch boundary spli

(rowIds: number[])

Source from the content-addressed store, hash-verified

4920 * created (#1269).
4921 */
4922 deleteReferencesByRowIds(rowIds: number[]): number {
4923 if (rowIds.length === 0) return 0;
4924 // One transaction for all chunks (each chunk was previously its own
4925 // implicit transaction = its own WAL commit — measurable on 100k+-ref
4926 // resolution persists), and the full-size chunk statement is cached so
4927 // repeat calls skip the re-prepare; only the final partial chunk (if any)
4928 // prepares ad hoc. Returns rows actually removed (summed `changes`) for
4929 // the batched loop's non-progress guard (§7a.2).
4930 let changed = 0;
4931 this.db.transaction(() => {
4932 for (let i = 0; i < rowIds.length; i += SQLITE_PARAM_CHUNK_SIZE) {
4933 const chunk = rowIds.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
4934 if (chunk.length === SQLITE_PARAM_CHUNK_SIZE) {
4935 if (!this.stmts.deleteRefsByRowIdsFull) {
4936 const placeholders = new Array(SQLITE_PARAM_CHUNK_SIZE).fill('?').join(',');
4937 this.stmts.deleteRefsByRowIdsFull = this.db.prepare(
4938 `DELETE FROM unresolved_refs WHERE id IN (${placeholders})`
4939 );
4940 }
4941 changed += this.stmts.deleteRefsByRowIdsFull.run(...chunk).changes;
4942 } else {
4943 const placeholders = chunk.map(() => '?').join(',');
4944 changed += this.db.prepare(`DELETE FROM unresolved_refs WHERE id IN (${placeholders})`).run(...chunk).changes;
4945 }
4946 }
4947 })();
4948 return changed;
4949 }
4950
4951 /**
4952 * Mark refs a completed resolution pass could not resolve as status='failed'

Callers 5

resolveAndPersistMethod · 0.80
retargetCallsMethod · 0.80
restoreCallsMethod · 0.80

Calls 6

fillMethod · 0.80
mapMethod · 0.80
transactionMethod · 0.65
prepareMethod · 0.65
runMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected