Skip to content

Commit

Permalink
doc: add added tag and fix typo sqlite.md
Browse files Browse the repository at this point in the history
PR-URL: #56012
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
louwers authored and aduh95 committed Nov 27, 2024
1 parent a6c00c2 commit 0f3810f
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 @@ -157,6 +157,10 @@ around [`sqlite3_prepare_v2()`][].

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

<!-- YAML
added: REPLACEME
-->

* `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 @@ -166,14 +170,18 @@ Creates and attaches a session to the database. This method is a wrapper around

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

<!-- YAML
added: REPLACEME
-->

* `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 @@ -199,15 +207,27 @@ targetDb.applyChangeset(changeset);

## Class: `Session`

<!-- YAML
added: REPLACEME
-->

### `session.changeset()`

<!-- YAML
added: REPLACEME
-->

* 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: REPLACEME
-->

* 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 0f3810f

Please sign in to comment.