[API reference](https://evolu.dev/docs/api-reference) › [@evolu/sqlite-wasm](https://evolu.dev/docs/api-reference/sqlite-wasm) › SqliteDatabase

Defined in: [packages/sqlite-wasm/src/Database.ts:367](https://github.com/evoluhq/evolu/blob/bc4578a260dd15d5bbf94b83765ca05984d194cb/packages/sqlite-wasm/src/Database.ts#L367)

An open SQLite database. Disposing it while one of its operations runs, as
from a callback, throws.

## Extends

- [`Disposable`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management)

## Properties

<a id="exec"></a>

### exec

```ts
readonly exec: (sql: string) => Result<void, SqliteExecError>;
```

Defined in: [packages/sqlite-wasm/src/Database.ts:405](https://github.com/evoluhq/evolu/blob/bc4578a260dd15d5bbf94b83765ca05984d194cb/packages/sqlite-wasm/src/Database.ts#L405)

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](https://evolu.dev/docs/api-reference/sqlite-wasm/interfaces/SqliteParameterCountError)
without running, so no parameter silently binds NULL.

---

<a id="export"></a>

### export

```ts
readonly export: () => Result<Uint8Array<ArrayBuffer>, SqliteError>;
```

Defined in: [packages/sqlite-wasm/src/Database.ts:411](https://github.com/evoluhq/evolu/blob/bc4578a260dd15d5bbf94b83765ca05984d194cb/packages/sqlite-wasm/src/Database.ts#L411)

Returns the whole database as bytes backed by their own `ArrayBuffer`, so
they can be transferred to another worker.

---

<a id="isautocommit"></a>

### isAutocommit

```ts
readonly isAutocommit: () => boolean;
```

Defined in: [packages/sqlite-wasm/src/Database.ts:420](https://github.com/evoluhq/evolu/blob/bc4578a260dd15d5bbf94b83765ca05984d194cb/packages/sqlite-wasm/src/Database.ts#L420)

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.

---

<a id="iterate"></a>

### iterate

```ts
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](https://github.com/evoluhq/evolu/blob/bc4578a260dd15d5bbf94b83765ca05984d194cb/packages/sqlite-wasm/src/Database.ts#L391)

Prepares one statement, iterates it once as [SqliteStatement.iterate](https://evolu.dev/docs/api-reference/sqlite-wasm/interfaces/SqliteStatement#iterate)
does and finalizes it, also when `onRow` throws.

---

<a id="prepare"></a>

### prepare

```ts
readonly prepare: (sql: string) => Result<SqliteStatement, SqlitePrepareError>;
```

Defined in: [packages/sqlite-wasm/src/Database.ts:369](https://github.com/evoluhq/evolu/blob/bc4578a260dd15d5bbf94b83765ca05984d194cb/packages/sqlite-wasm/src/Database.ts#L369)

Prepares one statement for repeated runs.

---

<a id="run"></a>

### run

```ts
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](https://github.com/evoluhq/evolu/blob/bc4578a260dd15d5bbf94b83765ca05984d194cb/packages/sqlite-wasm/src/Database.ts#L382)

Prepares one statement, runs it once as [SqliteStatement.run](https://evolu.dev/docs/api-reference/sqlite-wasm/interfaces/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](https://evolu.dev/docs/api-reference/sqlite-wasm/interfaces/SqliteDatabase#prepare): about 20% for a typical query in Node.js 24.

## Methods

<a id="dispose"></a>

### \[dispose\]()

```ts
[dispose](): void;
```

Defined in: node\_modules/@typescript/old/lib/lib.esnext.disposable.d.ts:34

#### Inherited from

```ts
Disposable.[dispose]
```