import type { Adapter, QueryRequest } from '@sqb/connect'; import type { NativeDatabase } from './drivers/types.js'; /** * `@sqb/connect` {@link Adapter.Connection} wrapping a {@link * NativeDatabase} (Node's `node:sqlite` or Bun's `bun:sqlite`, behind a * common driver interface - see `./drivers/types.ts`): translates * `QueryRequest`s into driver calls (including cursor-mode iteration and * `RETURNING`-on-`INSERT`/`UPDATE` emulation, since this layer's SQL * generation doesn't rely on SQLite's own `RETURNING` support) and * normalizes results/column metadata back into SQB's portable shape. */ export declare class SqliteConnection implements Adapter.Connection { private _onClose; private intlcon?; constructor(db: NativeDatabase, _onClose: () => void | Promise); /** SQLite has no server-side session concept - always `0`. */ get sessionId(): any; /** Releases this connection's reference to the underlying native database via the closer passed to the constructor (see {@link SqliteAdapter.connect}), closing the file once no connection references it. */ close(): Promise; /** Rolls back any open transaction, readying the connection to be pooled/reused. */ reset(): Promise; /** Begins a transaction (`BEGIN`), swallowing the driver's error for a transaction already being open rather than throwing. */ startTransaction(): Promise; /** Commits the current transaction, swallowing the driver's error for no transaction being open rather than throwing. */ commit(): Promise; /** Rolls back the current transaction, swallowing the driver's error for no transaction being open rather than throwing. */ rollback(): Promise; getInTransaction(): boolean; /** Validates the connection with a trivial `SELECT 1`. */ test(): Promise; /** * Executes one query. For an `INSERT`/`UPDATE` with `returningFields`, * runs the statement then a synthesized follow-up `SELECT` to emulate * `RETURNING` (an `INSERT` is matched back by `ROWID`, an `UPDATE` by * reusing the original `WHERE` clause) - `DELETE` isn't emulated here * since there's nothing left to re-select afterward. A statement that * produces no result set (DDL, `PRAGMA`, ...) is simply run. Otherwise * prepares and iterates the statement, wrapping it in a {@link * SqliteCursor} (returned directly in cursor mode, or eagerly drained up * to `fetchRows` rows otherwise). */ execute(query: QueryRequest): Promise; /** Copies a synthesized `SELECT` statement's rows/fields onto `out` - used to emulate `RETURNING` on `INSERT`/`UPDATE`. */ private _fillSelectResult; /** Converts the driver's column metadata into SQB's portable {@link Adapter.Field} shape via {@link mapDeclaredType}. */ private _convertFields; }