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

Method execute

__tests__/telemetry-services.test.ts:67–76  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65 }
66
67 execute(): { success: true; results: Row[]; meta: { changes: number; duration: number } } {
68 this.d1.onStatement?.(this.sql);
69 const stmt = this.d1.db.prepare(this.sql);
70 const params = this.params.map(bindable) as never[];
71 if (/^\s*(SELECT|WITH)\b/i.test(this.sql)) {
72 return { success: true, results: stmt.all(...params) as Row[], meta: { changes: 0, duration: this.d1.statementMs } };
73 }
74 const info = stmt.run(...params);
75 return { success: true, results: [], meta: { changes: Number(info.changes), duration: this.d1.statementMs } };
76 }
77
78 async first<T>(): Promise<T | null> {
79 return (this.execute().results[0] as T | undefined) ?? null;

Callers 15

firstMethod · 0.95
allMethod · 0.95
runMethod · 0.95
exploreFunction · 0.45
exploreFunction · 0.45

Calls 5

NumberInterface · 0.85
mapMethod · 0.80
prepareMethod · 0.65
allMethod · 0.65
runMethod · 0.65

Tested by

no test coverage detected