@@ -13,6 +13,11 @@ export interface Options {
1313 encryptionCipher ?: string
1414 encryptionKey ?: string
1515 remoteEncryptionKey ?: string
16+ queryTimeout ?: number
17+ }
18+ /** Per-query execution options. */
19+ export interface QueryOptions {
20+ queryTimeout ?: number
1621}
1722export declare function connect ( path : string , opts ?: Options | undefined | null ) : Promise < Database >
1823/** Result of a database sync operation. */
@@ -27,12 +32,12 @@ export declare function databasePrepareSync(db: Database, sql: string): Statemen
2732/** Syncs the database in blocking mode. */
2833export declare function databaseSyncSync ( db : Database ) : SyncResult
2934/** Executes SQL in blocking mode. */
30- export declare function databaseExecSync ( db : Database , sql : string ) : void
35+ export declare function databaseExecSync ( db : Database , sql : string , queryOptions ?: QueryOptions | undefined | null ) : void
3136/** Gets first row from statement in blocking mode. */
32- export declare function statementGetSync ( stmt : Statement , params ?: unknown | undefined | null ) : unknown
37+ export declare function statementGetSync ( stmt : Statement , params ?: unknown | undefined | null , queryOptions ?: QueryOptions | undefined | null ) : unknown
3338/** Runs a statement in blocking mode. */
34- export declare function statementRunSync ( stmt : Statement , params ?: unknown | undefined | null ) : RunResult
35- export declare function statementIterateSync ( stmt : Statement , params ?: unknown | undefined | null ) : RowsIterator
39+ export declare function statementRunSync ( stmt : Statement , params ?: unknown | undefined | null , queryOptions ?: QueryOptions | undefined | null ) : RunResult
40+ export declare function statementIterateSync ( stmt : Statement , params ?: unknown | undefined | null , queryOptions ?: QueryOptions | undefined | null ) : RowsIterator
3641/** SQLite `run()` result object */
3742export interface RunResult {
3843 changes : number
@@ -116,7 +121,7 @@ export declare class Database {
116121 * * `env` - The environment.
117122 * * `sql` - The SQL statement to execute.
118123 */
119- exec ( sql : string ) : Promise < void >
124+ exec ( sql : string , queryOptions ?: QueryOptions | undefined | null ) : Promise < void >
120125 /**
121126 * Syncs the database.
122127 *
@@ -153,7 +158,7 @@ export declare class Statement {
153158 *
154159 * * `params` - The parameters to bind to the statement.
155160 */
156- run ( params ?: unknown | undefined | null ) : RunResult
161+ run ( params ?: unknown | undefined | null , queryOptions ?: QueryOptions | undefined | null ) : RunResult
157162 /**
158163 * Executes a SQL statement and returns the first row.
159164 *
@@ -162,7 +167,7 @@ export declare class Statement {
162167 * * `env` - The environment.
163168 * * `params` - The parameters to bind to the statement.
164169 */
165- get ( params ?: unknown | undefined | null ) : object
170+ get ( params ?: unknown | undefined | null , queryOptions ?: QueryOptions | undefined | null ) : object
166171 /**
167172 * Create an iterator over the rows of a statement.
168173 *
@@ -171,7 +176,7 @@ export declare class Statement {
171176 * * `env` - The environment.
172177 * * `params` - The parameters to bind to the statement.
173178 */
174- iterate ( params ?: unknown | undefined | null ) : object
179+ iterate ( params ?: unknown | undefined | null , queryOptions ?: QueryOptions | undefined | null ) : object
175180 raw ( raw ?: boolean | undefined | null ) : this
176181 pluck ( pluck ?: boolean | undefined | null ) : this
177182 timing ( timing ?: boolean | undefined | null ) : this
0 commit comments