SQLiteClient
Class: SQLiteClient
Defined in: sqlite/src/connection.ts:98
Adapter of a DatabaseSync to the SQLClient interface, with a bounded prepared statement cache
Implements
SQLClient
Constructors
Constructor
new SQLiteClient(
db,cacheSize?):SQLiteClient
Defined in: sqlite/src/connection.ts:105
Parameters
db
DatabaseSync
the open database
cacheSize?
number = 256
max prepared statements kept
Returns
SQLiteClient
Properties
cacheSize
protectedreadonlycacheSize:number=256
Defined in: sqlite/src/connection.ts:107
max prepared statements kept
db
readonlydb:DatabaseSync
Defined in: sqlite/src/connection.ts:106
the open database
statements
protectedstatements:Map<string,StatementSync>
Defined in: sqlite/src/connection.ts:99
Methods
query()
query(
sql,values?):Promise<{rowCount:number;rows:any[]; }>
Defined in: sqlite/src/connection.ts:134
SELECT / WITH / PRAGMA statements run with all(), the others with run(); the method is async to honor SQLClient
The statement kind is read from its first keyword only: a value inlined in a WHERE clause can never change it. Use rows for a write statement with a RETURNING clause.
Parameters
sql
string
the statement
values?
any[] = []
the parameters
Returns
Promise<{ rowCount: number; rows: any[]; }>
the rows, or the number of changed rows
Implementation of
SQLClient.query
rows()
rows(
sql,values?):Promise<any[]>
Defined in: sqlite/src/connection.ts:151
Run a statement returning rows, a write with a RETURNING clause included
Parameters
sql
string
the statement
values?
any[] = []
the parameters
Returns
Promise<any[]>
the rows
run()
protectedrun<R>(sql,execute):R
Defined in: sqlite/src/connection.ts:161
Run a statement, translating the engine errors
Type Parameters
R
R
Parameters
sql
string
the statement
execute
() => R
the execution
Returns
R
the execution result
statement()
protectedstatement(sql):StatementSync
Defined in: sqlite/src/connection.ts:114
Parameters
sql
string
the statement
Returns
StatementSync
the prepared statement, cached