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