Readonly
isIndicates whether the database connection is open.
Readonly
isIndicates whether a transaction is currently active.
Dispose of the database resources using the explicit resource management protocol.
This method creates SQLite aggregate functions, wrapping sqlite3_create_window_function().
The name of the SQLite aggregate function to create.
Configuration object containing step function and other settings.
Apply a changeset to the database.
The changeset data to apply.
Optional
options: ChangesetApplyOptionsOptional configuration for applying the changeset.
true if successful, false if aborted.
Makes a backup of the database. This method abstracts the sqlite3_backup_init(), sqlite3_backup_step() and sqlite3_backup_finish() functions.
The backed-up database can be used normally during the backup process. Mutations coming from the same connection will be reflected in the backup right away. However, mutations from other connections will cause the backup process to restart.
The path where the backup will be created. If the file already exists, the contents will be overwritten.
Optional
options: {Optional configuration for the backup operation.
Optional
progress?: (info: { remainingPages: number; totalPages: number }) => voidCallback function that will be called with the number of pages copied and the total number of pages.
Optional
rate?: numberNumber of pages to be transmitted in each batch of the backup.
Optional
source?: stringName of the source database. This can be 'main' (the default primary database) or any other database that have been added with ATTACH DATABASE.
Optional
target?: stringName of the target database. This can be 'main' (the default primary database) or any other database that have been added with ATTACH DATABASE.
A promise that resolves when the backup is completed and rejects if an error occurs.
Closes the database connection. This method should be called to ensure that the database connection is properly cleaned up. Once a database is closed, it cannot be used again.
Create a new session to record database changes.
Optional
options: SessionOptionsOptional configuration for the session.
A Session object for recording changes.
Enables or disables the loading of SQLite extensions.
If true, enables extension loading. If false, disables it.
This method allows one or more SQL statements to be executed without returning any results. This is useful for commands like CREATE TABLE, INSERT, UPDATE, or DELETE.
The SQL statement(s) to execute.
This method creates SQLite user-defined functions, wrapping sqlite3_create_function_v2().
The name of the SQLite function to create.
The JavaScript function to call when the SQLite function is invoked.
This method creates SQLite user-defined functions, wrapping sqlite3_create_function_v2().
The name of the SQLite function to create.
Optional configuration settings.
The JavaScript function to call when the SQLite function is invoked.
Loads an SQLite extension from the specified file path.
The path to the extension library.
Optional
entryPoint: stringOptional entry point function name. If not provided, uses the default entry point.
Returns the location of the database file. For attached databases, you can specify the database name. Returns null for in-memory databases.
Optional
dbName: stringThe name of the database. Defaults to 'main' (the primary database).
The file path of the database, or null for in-memory databases.
Opens a database connection. This method is called automatically when creating a DatabaseSync instance, so typically should not be called directly.
Optional
configuration: DatabaseSyncOptionsOptional configuration for opening the database.
Compiles an SQL statement and returns a StatementSyncInstance object.
The SQL statement to prepare.
Optional
options: StatementOptionsOptional configuration for the statement.
A StatementSyncInstance object that can be executed multiple times.
Represents a SQLite database connection. This interface represents an instance of the DatabaseSync class.