Files
orca/src/main/sqlite/node-sqlite-statement.ts
T
OrcaWin 6fc3cdcad6 Bundle Bun for headless Orca and profile persistence (#22635)
Bundle a pinned, verified Bun runtime for headless Orca so existing Node launch commands can hand off before opening a profile. Keep desktop execution on Electron.

Add the Bun SQLite adapter and terminal backend, bounded shutdown, process inspection and cross-platform artifact qualification. Keep future managed SSH deployment separate from current production launch paths.
2026-09-25 22:49:06 -07:00

40 lines
1.3 KiB
TypeScript

import type { StatementResultingChanges } from 'node:sqlite'
import { SqliteIntegerReader } from './sqlite-integer-reader'
import type { SqliteBindings, SqliteRow, SqliteStatement } from './sqlite-statement'
export class NodeSqliteStatement implements SqliteStatement {
private readonly integers = new SqliteIntegerReader()
constructor(private readonly statement: SqliteStatement) {
// Native number reads overflow their INT64_MIN guard on some builds and round insert rowids.
statement.setReadBigInts(true)
}
all(...parameters: SqliteBindings): SqliteRow[] {
const rows = this.statement.all(...parameters)
for (const row of rows) {
this.integers.row(row)
}
return rows
}
get(...parameters: SqliteBindings): SqliteRow | undefined {
const row = this.statement.get(...parameters)
return row === undefined ? undefined : this.integers.row(row)
}
run(...parameters: SqliteBindings): StatementResultingChanges {
return this.integers.result(this.statement.run(...parameters))
}
*iterate(...parameters: SqliteBindings): IterableIterator<SqliteRow> {
for (const row of this.statement.iterate(...parameters)) {
yield this.integers.row(row)
}
}
setReadBigInts(enabled: boolean): void {
this.integers.readBigInts = enabled
}
}