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

Function runStatement

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

Source from the content-addressed store, hash-verified

162 })
163
164 const runStatement = (
165 statement: StatementSync,
166 params: ReadonlyArray<unknown>,
167 raw: boolean
168 ) =>
169 Effect.withFiber<ReadonlyArray<any>, SqlError>((fiber) => {
170 const useSafeIntegers = Context.get(fiber.context, Client.SafeIntegers)
171 return Effect.try({
172 try: () => {
173 statement.setReadBigInts(useSafeIntegers)
174 if (statement.columns().length > 0) {
175 return statement.all(...(params as Array<any>)) as ReadonlyArray<any>
176 }
177 const result = statement.run(...(params as Array<any>))
178 return raw ? { changes: result.changes, lastInsertRowid: result.lastInsertRowid } as any : []
179 },
180 catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to execute statement", "execute") })
181 })
182 })
183
184 const runStatementValues = (
185 statement: StatementSync,

Callers 2

runFunction · 0.70
executeUnpreparedFunction · 0.70

Calls 4

allMethod · 0.80
classifyErrorFunction · 0.70
getMethod · 0.65
runMethod · 0.45

Tested by

no test coverage detected