(
statement: Sqlite.Statement,
params: ReadonlyArray<unknown>,
raw: boolean
)
| 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, |
no test coverage detected