ReadonlykindIdentifier for logging/diagnostics (e.g., 'better-sqlite3', 'postgres').
ReadonlycapabilitiesCapability flags indicating supported features.
Runs fn in a transaction on this connection. One transaction at a time.
Optionaloptions: PostgresTransactionOptionsOpens the underlying connection or initializes the backing store.
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
OptionalbatchExecutes multiple operations in a batch (if supported).
This is more efficient than executing operations individually, especially for bulk inserts. Check if 'batch' capability is present.
Array of operations to execute
Batch execution results
OptionalprepareReturns a prepared statement for repeated execution (if supported).
Prepared statements improve performance for frequently executed queries and provide better protection against SQL injection. Check if 'prepared' capability is present.
SQL statement to prepare
Prepared statement handle
OptionalregisterMakes a JavaScript function callable from SQL under name (if supported:
the better-sqlite3, sql.js and IndexedDB adapters). The function takes as
many arguments as it declares (fn.length).
An identifier: letters, digits and underscores
The function; SQL values arrive as its arguments
Optionaloptions: SqlFunctionOptionsdeterministic (better-sqlite3)
One pooled connection, held for a
withConnection()callback. Its statements run outside a transaction unless the callback opens one, and session state (SET, session advisory locks, temporary tables) lasts until the connection closes.