API reference › @evolu/sqlite-wasm › SqliteStatement

Defined in: packages/sqlite-wasm/src/Database.ts:427

A prepared statement. Running or disposing it during its own run, as from a callback, throws.

Extends

Properties

iterate

readonly iterate: (parameters: readonly (
  | string
  | Uint8Array<ArrayBufferLike>
  | number & Brand<"NonNaN"> & Brand<"Finite">
| null)[], onRow: (row: SqliteRow) => boolean) => Result<void, SqliteRunError>;

Defined in: packages/sqlite-wasm/src/Database.ts:451

Binds the parameters and steps the rows one at a time, passing each to onRow until it returns false or the rows end, so no row after the one it stops at is stepped. A query whose plan sorts, groups or aggregates still reads all its input before the first row. Then it resets the statement, also when a step fails or onRow throws, which it rethrows. When onRow stops a write with RETURNING early, the reset commits it, and iterate returns that commit's error.

The callback can run other statements and operations of the same database, but not run, iterate or dispose this statement, which throws.


parameterCount

readonly parameterCount: number;

Defined in: packages/sqlite-wasm/src/Database.ts:429

The number of SQL parameters, which each run must supply exactly.


run

readonly run: (parameters: readonly (
  | string
  | Uint8Array<ArrayBufferLike>
  | number & Brand<"NonNaN"> & Brand<"Finite">
| null)[]) => Result<SqliteRunResult, SqliteRunError>;

Defined in: packages/sqlite-wasm/src/Database.ts:435

Binds the parameters, steps to completion, collects the rows and resets the statement, also when a step fails.

Methods

[dispose]()

[dispose](): void;

Defined in: node_modules/@typescript/old/lib/lib.esnext.disposable.d.ts:34

Inherited from

Disposable.[dispose]