(
sql: string,
params: ReadonlyArray<unknown> = []
)
| 115 | }) |
| 116 | |
| 117 | const runValues = ( |
| 118 | sql: string, |
| 119 | params: ReadonlyArray<unknown> = [] |
| 120 | ) => |
| 121 | Effect.withFiberRuntime<Array<any>, SqlError>((fiber) => { |
| 122 | const useSafeIntegers = Context.get(fiber.currentContext, Client.SafeIntegers) |
| 123 | try { |
| 124 | const statement = db.query(sql) |
| 125 | // @ts-ignore bun-types missing safeIntegers method, fixed in https://github.com/oven-sh/bun/pull/26627 |
| 126 | statement.safeIntegers(useSafeIntegers) |
| 127 | return Effect.succeed((statement.values(...(params as any)) ?? []) as Array<any>) |
| 128 | } catch (cause) { |
| 129 | return Effect.fail(new SqlError({ cause, message: "Failed to execute statement" })) |
| 130 | } |
| 131 | }) |
| 132 | |
| 133 | return identity<SqliteConnection>({ |
| 134 | execute(sql, params, transformRows) { |
no test coverage detected