ReadonlykindIdentifier for logging/diagnostics (e.g., 'better-sqlite3', 'postgres').
ReadonlycapabilitiesCapability flags indicating supported features.
Opens the underlying connection or initializes the backing store.
Optionaloptions: SupabaseAdapterOptionsExecutes 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
Stream large result sets.
Optionalparameters: unknownOptionaloptions: StreamOptionsApply database migrations.
Get performance metrics.
Core SQL storage adapter interface.
Every adapter implementation must fulfill this contract to ensure compatibility across different SQL backends. Check the
capabilitiesproperty to determine which optional features are supported.Error Handling
All methods should throw meaningful errors when operations fail. Adapters should not silently fail or return undefined on errors.
Thread Safety
Adapters should document their thread-safety guarantees. SQLite adapters typically don't support concurrent writes, while PostgreSQL does.