Creates a new better-sqlite3 adapter instance.
Absolute path to the SQLite database file. Will be created if it doesn't exist.
ReadonlykindIdentifier for logging/diagnostics (e.g., 'better-sqlite3', 'postgres').
ReadonlycapabilitiesCapability flags indicating supported features.
Open (or no-op if already open) the underlying native database.
Throws a descriptive error if called in a browser environment.
Optionaloptions: StorageOpenOptionsExecutes a mutation statement (INSERT, UPDATE, DELETE).
SQL statement to execute
Optionalparameters: StorageParametersOptional parameters for the statement
Metadata about affected rows
Retrieves a single row (or null if none found).
SQL SELECT statement
Optionalparameters: StorageParametersOptional parameters for the statement
First row or null if no results
Retrieves all rows returned by the statement.
WARNING: For large result sets, this loads everything into memory. Consider using streaming (if supported) for large queries.
SQL SELECT statement
Optionalparameters: StorageParametersOptional parameters for the statement
Array of all matching rows (empty array if none)
Executes a script containing multiple SQL statements.
Statements are typically delimited by semicolons. This is useful for running migrations or initialization scripts. No results are returned.
SQL script with multiple statements
Executes a callback within a database transaction.
The transaction is automatically committed on success or rolled back on error. Nested transactions may not be supported by all adapters.
Async callback to execute within the transaction
Result of the callback function
Execute multiple operations efficiently in a single transaction.
Much faster than executing operations individually, especially for bulk inserts. Automatically wraps in a transaction.
Array of SQL operations to execute
Results of the batch operation
Native SQLite adapter backed by the
better-sqlite3module.Features:
Browser Safety: This class can be imported in browser bundles without immediate failure. A runtime error is only thrown if
open()is invoked in a browser context.