Skip to content

Commit

Permalink
sqlite: add added tag and fix typo sqlite.md
Browse files Browse the repository at this point in the history
  • Loading branch information
louwers committed Nov 27, 2024
1 parent 7450332 commit 0974660
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion doc/api/sqlite.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ around [`sqlite3_prepare_v2()`][].

### `database.createSession([options])`

<!-- YAML
added: v23.0.0
-->

* `options` {Object} The configuration options for the session.
* `table` {string} A specific table to track changes for. By default, changes to all tables are tracked.
* `db` {string} Name of the database to track. This is useful when multiple databases have been added using [`ATTACH DATABASE`][]. **Default**: `'main'`.
Expand All @@ -165,14 +169,18 @@ Creates and attaches a session to the database. This method is a wrapper around

### `database.applyChangeset(changeset[, options])`

<!-- YAML
added: v23.0.0
-->

* `changeset` {Uint8Array} A binary changeset or patchset.
* `options` {Object} The configuration options for how the changes will be applied.
* `filter` {Function} Skip changes that, when targeted table name is supplied to this function, return a truthy value.
By default, all changes are attempted.
* `onConflict` {number} Determines how conflicts are handled. **Default**: `SQLITE_CHANGESET_ABORT`.
* `SQLITE_CHANGESET_OMIT`: conflicting changes are omitted.
* `SQLITE_CHANGESET_REPLACE`: conflicting changes replace existing values.
* `SQLITE_CHANGESET_ABORT`: abort on conflict and roll back databsase.
* `SQLITE_CHANGESET_ABORT`: abort on conflict and roll back database.
* Returns: {boolean} Whether the changeset was applied succesfully without being aborted.

An exception is thrown if the database is not
Expand All @@ -198,15 +206,27 @@ targetDb.applyChangeset(changeset);

## Class: `Session`

<!-- YAML
added: v23.0.0
-->

### `session.changeset()`

<!-- YAML
added: v23.0.0
-->

* Returns: {Uint8Array} Binary changeset that can be applied to other databases.

Retrieves a changeset containing all changes since the changeset was created. Can be called multiple times.
An exception is thrown if the database or the session is not open. This method is a wrapper around [`sqlite3session_changeset()`][].

### `session.patchset()`

<!-- YAML
added: v23.0.0
-->

* Returns: {Uint8Array} Binary patchset that can be applied to other databases.

Similar to the method above, but generates a more compact patchset. See [Changesets and Patchsets][]
Expand Down

0 comments on commit 0974660

Please sign in to comment.