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

Method deleteReferencesByRowIds

src/db/queries.ts:4811–4838  ·  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

4809 * created (#1269).
4810 */
4811 deleteReferencesByRowIds(rowIds: number[]): number {
4812 if (rowIds.length === 0) return 0;
4813 // One transaction for all chunks (each chunk was previously its own
4814 // implicit transaction = its own WAL commit — measurable on 100k+-ref
4815 // resolution persists), and the full-size chunk statement is cached so
4816 // repeat calls skip the re-prepare; only the final partial chunk (if any)
4817 // prepares ad hoc. Returns rows actually removed (summed `changes`) for
4818 // the batched loop's non-progress guard (§7a.2).
4819 let changed = 0;
4820 this.db.transaction(() => {
4821 for (let i = 0; i < rowIds.length; i += SQLITE_PARAM_CHUNK_SIZE) {
4822 const chunk = rowIds.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
4823 if (chunk.length === SQLITE_PARAM_CHUNK_SIZE) {
4824 if (!this.stmts.deleteRefsByRowIdsFull) {
4825 const placeholders = new Array(SQLITE_PARAM_CHUNK_SIZE).fill('?').join(',');
4826 this.stmts.deleteRefsByRowIdsFull = this.db.prepare(
4827 `DELETE FROM unresolved_refs WHERE id IN (${placeholders})`
4828 );
4829 }
4830 changed += this.stmts.deleteRefsByRowIdsFull.run(...chunk).changes;
4831 } else {
4832 const placeholders = chunk.map(() => '?').join(',');
4833 changed += this.db.prepare(`DELETE FROM unresolved_refs WHERE id IN (${placeholders})`).run(...chunk).changes;
4834 }
4835 }
4836 })();
4837 return changed;
4838 }
4839
4840 /**
4841 * 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