MCPcopy Create free account
hub / github.com/Effect-TS/effect / runStatement

Function runStatement

packages/sql/sqlite-node/src/SqliteClient.ts:213–231  ·  view source on GitHub ↗
(
        statement: StatementSync,
        params: ReadonlyArray<unknown>,
        raw: boolean
      )

Source from the content-addressed store, hash-verified

211 })
212
213 const runStatement = (
214 statement: StatementSync,
215 params: ReadonlyArray<unknown>,
216 raw: boolean
217 ) =>
218 Effect.withFiber<ReadonlyArray<any>, SqlError>((fiber) => {
219 const useSafeIntegers = Context.get(fiber.context, Client.SafeIntegers)
220 return Effect.try({
221 try: () => {
222 statement.setReadBigInts(useSafeIntegers)
223 if (!raw || statement.columns().length > 0) {
224 return statement.all(...(params as Array<any>)) as ReadonlyArray<any>
225 }
226 const result = statement.run(...(params as Array<any>))
227 return { changes: result.changes, lastInsertRowid: result.lastInsertRowid } as any
228 },
229 catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to execute statement", "execute") })
230 })
231 })
232
233 const runStatementValues = (
234 statement: StatementSync,

Callers 2

runFunction · 0.70
executeUnpreparedFunction · 0.70

Calls 4

classifyErrorFunction · 0.70
getMethod · 0.65
allMethod · 0.65
runMethod · 0.65

Tested by

no test coverage detected