MCPcopy Index your code
hub / github.com/Effect-TS/effect / runStatement

Function runStatement

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

Source from the content-addressed store, hash-verified

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