(
sql: string,
params: ReadonlyArray<unknown> = []
)
| 185 | }) |
| 186 | |
| 187 | const runValues = ( |
| 188 | sql: string, |
| 189 | params: ReadonlyArray<unknown> = [] |
| 190 | ) => |
| 191 | Effect.withFiber<Array<any>, SqlError>((fiber) => { |
| 192 | if (fiber.getRef(AsyncQuery)) { |
| 193 | return Effect.map( |
| 194 | Effect.tryPromise({ |
| 195 | try: () => db.executeRaw(sql, params as Array<any>), |
| 196 | catch: (cause) => |
| 197 | new SqlError({ reason: classifyError(cause, "Failed to execute statement (async)", "execute") }) |
| 198 | }), |
| 199 | (result) => result.rawRows |
| 200 | ) |
| 201 | } |
| 202 | return Effect.try({ |
| 203 | try: () => db.executeRawSync(sql, params as Array<any>).rawRows, |
| 204 | catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to execute statement", "execute") }) |
| 205 | }) |
| 206 | }) |
| 207 | |
| 208 | return identity<SqliteConnection>({ |
| 209 | execute(sql, params, transformRows) { |
no test coverage detected