(sql, params, transformRows)
| 215 | executeUnprepared(sql, params, transformRows) { |
| 216 | return this.execute(sql, params, transformRows) |
| 217 | }, |
| 218 | executeStream(sql, params, transformRows) { |
| 219 | function* stream() { |
| 220 | for (const stmt of sqlite3.statements(db, sql)) { |
| 221 | let columns: Array<string> | undefined |
| 222 | sqlite3.bind_collection(stmt, params as any) |
| 223 | while (sqlite3.step(stmt) === WaSqlite.SQLITE_ROW) { |
| 224 | columns = columns ?? sqlite3.column_names(stmt) |
| 225 | const row = sqlite3.row(stmt) |
| 226 | const obj: Record<string, any> = {} |
| 227 | for (let i = 0; i < columns.length; i++) { |
| 228 | Rec.assignProperty(obj, columns[i], row[i]) |
| 229 | } |
| 230 | yield obj |
| 231 | } |
| 232 | } |
| 233 | } |
| 234 | return Stream.suspend(() => Stream.fromIteratorSucceed(stream()[Symbol.iterator]())).pipe( |
| 235 | transformRows |
| 236 | ? Stream.mapArray((chunk) => transformRows(chunk) as any) |
| 237 | : identity, |
| 238 | Stream.mapError((cause) => |
| 239 | new SqlError({ reason: classifyError(cause, "Failed to execute statement", "stream") }) |
| 240 | ) |
| 241 | ) |
| 242 | }, |
| 243 | export: Effect.try({ |
| 244 | try: () => sqlite3.serialize(db, "main"), |
nothing calls this directly
no test coverage detected
searching dependent graphs…