API reference › @evolu/sqlite-wasm › SqliteDatabase
Defined in: packages/sqlite-wasm/src/Database.ts:367
An open SQLite database. Disposing it while one of its operations runs, as from a callback, throws.
Extends
Properties
exec
readonly exec: (sql: string) => Result<void, SqliteExecError>;
Defined in: packages/sqlite-wasm/src/Database.ts:405
Runs SQL that can hold several statements, without parameters, and discards any rows. Meant for schema changes and pragmas.
It runs the statements in order and stops at the first that fails. A statement with a parameter fails with SqliteParameterCountError without running, so no parameter silently binds NULL.
export
readonly export: () => Result<Uint8Array<ArrayBuffer>, SqliteError>;
Defined in: packages/sqlite-wasm/src/Database.ts:411
Returns the whole database as bytes backed by their own ArrayBuffer, so
they can be transferred to another worker.
isAutocommit
readonly isAutocommit: () => boolean;
Defined in: packages/sqlite-wasm/src/Database.ts:420
Whether no transaction is open.
After errors such as SQLITE_FULL, SQLITE_IOERR or SQLITE_NOMEM, SQLite may roll back the transaction itself, and a ROLLBACK then fails. A transaction helper checks this before rolling back.
iterate
readonly iterate: (sql: string, parameters: readonly (
| string
| Uint8Array<ArrayBufferLike>
| number & Brand<"NonNaN"> & Brand<"Finite">
| null)[], onRow: (row: SqliteRow) => boolean) => Result<void,
| SqliteError
| SqliteEmptySqlError
| SqliteMultipleStatementsError
| SqliteInvalidSqlTextError
| SqliteParameterCountError>;
Defined in: packages/sqlite-wasm/src/Database.ts:391
Prepares one statement, iterates it once as SqliteStatement.iterate
does and finalizes it, also when onRow throws.
prepare
readonly prepare: (sql: string) => Result<SqliteStatement, SqlitePrepareError>;
Defined in: packages/sqlite-wasm/src/Database.ts:369
Prepares one statement for repeated runs.
run
readonly run: (sql: string, parameters: readonly (
| string
| Uint8Array<ArrayBufferLike>
| number & Brand<"NonNaN"> & Brand<"Finite">
| null)[]) => Result<SqliteRunResult,
| SqliteError
| SqliteEmptySqlError
| SqliteMultipleStatementsError
| SqliteInvalidSqlTextError
| SqliteParameterCountError>;
Defined in: packages/sqlite-wasm/src/Database.ts:382
Prepares one statement, runs it once as SqliteStatement.run does and finalizes it.
Without SQLITE_PREPARE_PERSISTENT, SQLite prepares it from its lookaside memory, so a statement that runs once is faster than one from SqliteDatabase.prepare: about 20% for a typical query in Node.js 24.
Methods
[dispose]()
[dispose](): void;
Defined in: node_modules/@typescript/old/lib/lib.esnext.disposable.d.ts:34
Inherited from
Disposable.[dispose]