ReadonlykindIdentifier for logging/diagnostics (e.g., 'better-sqlite3', 'postgres').
ReadonlycapabilitiesCapability flags indicating supported features.
Opens the underlying connection or initializes the backing store.
Optionaloptions: StorageOpenOptionsRuns one statement. With a filePath, the database is saved to the file
after it unless SQLite has a transaction open; a transaction's statements
are saved by the save after its COMMIT. A statement that fails part way
(INSERT OR FAIL, UPDATE OR FAIL) keeps the rows it changed before the
failure, as SQLite's FAIL resolution does, and they are saved too.
Optionalparameters: StorageParametersRetrieves a single row (or null if none found).
SQL SELECT statement
Optionalparameters: StorageParametersOptional parameters for the statement
First row or null if no results
Runs a statement and returns its rows. A statement that writes (INSERT ... RETURNING, a PRAGMA that sets a header field such as
user_version) is saved to the file as a run() is; see queryWrites.
Optionalparameters: StorageParametersRuns a script of one or more statements. With a filePath, the database
is saved after it unless SQLite has a transaction open, which a script
can begin (BEGIN; INSERT ...) or end (INSERT ...; COMMIT). A script
that fails part way keeps the statements before the failure, and they are
saved as a script's that succeeds are; the script's error is the one
thrown.
Runs fn in a transaction: COMMIT when it resolves, ROLLBACK when it
throws. Callbacks run one at a time, since they share the connection, and
the database is saved to the file once the transaction has ended. A nested
transaction() on the handle runs in the open transaction.
Saves the committed state to the file and closes the database. A transaction still open is rolled back first, as closing a SQLite connection does, so the save holds committed writes only. A call made while a close is running waits for that close. The adapter can be opened again.
Makes a JavaScript function callable from SQL under name. It is
registered again whenever sql.js reopens the connection (each save to a
file), which drops the functions it had.
Storage adapter backed by sql.js (WebAssembly) for environments without native SQLite bindings.
With a
filePath, the adapter writes the database image to the file after each write, once SQLite has no transaction open: a statement through run(), a script through exec() (the statements before a failure included), a statement through all() or get() that can write (see queryWrites, which the IndexedDB adapter reads too), and the end of a transaction(). It does not save while SQLite has a transaction open, whatever began it (transaction(), BEGIN or SAVEPOINT through run(), or a script), since sql.js's export() closes and reopens the connection, which would roll the transaction back; the save after its COMMIT or RELEASE writes it. The connection's PRAGMA settings are read before each export and set again after it, and the functions registerFunction() made are registered again. TEMP tables, attached databases and functions registered on the sql.js database itself do not survive a save; the adapter warns once, through the host logger, when a save drops TEMP objects.