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

Function runStatement

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

Source from the content-addressed store, hash-verified

124 })
125
126 const runStatement = (
127 statement: Sqlite.Statement,
128 params: ReadonlyArray<unknown>,
129 raw: boolean
130 ) =>
131 Effect.withFiberRuntime<ReadonlyArray<any>, SqlError>((fiber) => {
132 if (Context.get(fiber.currentContext, Client.SafeIntegers)) {
133 statement.safeIntegers(true)
134 }
135 try {
136 if (statement.reader) {
137 return Effect.succeed(statement.all(...params))
138 }
139 const result = statement.run(...params)
140 return Effect.succeed(raw ? result as unknown as ReadonlyArray<any> : [])
141 } catch (cause) {
142 return Effect.fail(new SqlError({ cause, message: "Failed to execute statement" }))
143 }
144 })
145
146 const run = (
147 sql: string,

Callers 2

runFunction · 0.70
executeUnpreparedFunction · 0.70

Calls 3

getMethod · 0.65
failMethod · 0.65
runMethod · 0.45

Tested by

no test coverage detected