MCPcopy Index your code
hub / github.com/cortexkit/magic-context / prepare

Method prepare

packages/plugin/src/shared/sqlite.ts:124–134  ·  view source on GitHub ↗
(sql: string)

Source from the content-addressed store, hash-verified

122 // measured at ~12ns/call against real node:sqlite (negligible).
123 // biome-ignore lint/suspicious/noExplicitAny: node:sqlite StatementSync has no shipped types here.
124 prepare(sql: string): any {
125 const stmt = super.prepare(sql);
126 for (const method of ["run", "get", "all"] as const) {
127 const original = stmt[method].bind(stmt);
128 stmt[method] = (...args: unknown[]): unknown =>
129 args.length === 1 && Array.isArray(args[0])
130 ? original(...args[0])
131 : original(...args);
132 }
133 return stmt;
134 }
135
136 // biome-ignore lint/suspicious/noExplicitAny: mirrors better-sqlite3's generic transaction(fn) signature.
137 transaction<F extends (...args: any[]) => any>(fn: F): F {

Callers 15

serverFunction · 0.45
tools.test.tsFile · 0.45
tools.test.tsFile · 0.45
projectPathForMemoryIdFunction · 0.45
seedTagFunction · 0.45
seedTagsFunction · 0.45
getPendingOpsFunction · 0.45
getLastNudgeTokensFunction · 0.45
tools.test.tsFile · 0.45

Calls

no outgoing calls

Tested by 15

seedTagFunction · 0.36
seedTagsFunction · 0.36
getPendingOpsFunction · 0.36
getLastNudgeTokensFunction · 0.36
getCounterFunction · 0.36
tableExistsFunction · 0.36
indexExistsFunction · 0.36
columnsFunction · 0.36
tableNamesFunction · 0.36
indexNamesFunction · 0.36
columnNamesFunction · 0.36
insertMessageTagFunction · 0.36