/** * SMI-2180: better-sqlite3 Driver Implementation * * Wraps the better-sqlite3 library to implement the Database abstraction interface. * This driver is used when native modules are available (Docker, Linux, CI). * * better-sqlite3 is synchronous and provides excellent performance for local SQLite. * * @see https://github.com/WiseLibs/better-sqlite3 */ import type BetterSqlite3 from 'better-sqlite3'; import type { Database, Statement, DatabaseOptions } from '../database-interface.js'; /** * Wraps a better-sqlite3 Database to implement our Database interface */ export declare class BetterSqlite3Database implements Database { private readonly db; constructor(db: BetterSqlite3.Database); exec(sql: string): void; prepare(sql: string): Statement; transaction(fn: (...args: Args) => T): (...args: Args) => T; pragma(pragma: string): unknown; close(): void; get open(): boolean; get name(): string; get memory(): boolean; get readonly(): boolean; /** * Get the underlying better-sqlite3 database instance * Use with caution - this bypasses the abstraction layer */ get native(): BetterSqlite3.Database; } /** * Create a database connection using better-sqlite3 * * @param path - Path to database file, or ':memory:' for in-memory database * @param options - Database connection options * @returns A Database instance wrapping better-sqlite3 * @throws Error if better-sqlite3 native module is not available */ export declare function createBetterSqlite3Database(path?: string, options?: DatabaseOptions): BetterSqlite3Database; /** * Get the reason the native better-sqlite3 module last failed to load. * * @returns The failure message, or `undefined` if the native module loaded * successfully or has not been checked yet. */ export declare function getBetterSqlite3FailureReason(): string | undefined; /** * Check if better-sqlite3 native module is available * @returns true if the native module can be loaded */ export declare function isBetterSqlite3Available(): boolean; //# sourceMappingURL=betterSqlite3Driver.d.ts.map