SqliteAdapter
SqliteAdapter is the Adapter implementation shipped by
@sqb/sqlite, connecting to embedded SQLite via the runtime's own native bindings
(node:sqlite on Node.js, bun:sqlite on Bun). It self-registers with AdapterRegistry as a
side effect of importing @sqb/sqlite — see the
SQLite (native) adapter guide for setup, runtime
requirements, and configuration.
import '@sqb/sqlite';
Requires Node.js >= 22.5 (or Bun) — see the guide linked above.
Constructor
new SqliteAdapter()
Takes no arguments. You normally never construct this directly — importing @sqb/sqlite
registers a shared instance with AdapterRegistry for you.
Properties
| Property | Type | Description |
|---|---|---|
driver | 'sqlite' | The driver name, matched against ClientConfiguration.driver. |
dialect | 'sqlite' | The dialect name, matched against ClientConfiguration.dialect. |
features | Adapter.Features | { cursor: true }. |
Methods
connect()
connect(config: ClientConfiguration): Promise<Adapter.Connection>
Requires config.database (throws if missing). Resolves it to an absolute file path, unless it
matches :memory: (optionally suffixed, e.g. :memory:name), in which case an in-memory
database is opened instead. Detects Bun vs. Node.js at runtime and dynamically imports the
matching native driver module. Non-memory databases are cached and reference-counted by resolved
path, so multiple connections to the same file share one native database handle. Returns a
SqliteConnection wrapping the opened (or reused) database handle.
Other exports
closeMemoryDatabase()
function closeMemoryDatabase(name?: string): Promise<void>
Force-closes and evicts a cached in-memory database (:memory: by default, or the given
:memory:name variant) from the adapter's internal cache.
See also
- SQLite (native) adapter guide
SqljsAdapter— the WebAssembly alternativeAdapterinterfaceAdapterRegistry