Skip to content

Class: PreparedStatement ​

Defined in: packages/core/src/api/prepared.ts:17

An explicitly prepared statement, pinned outside the LRU cache. Re-execution costs a single round trip. Close it when done.

Properties ​

PropertyModifierTypeDefined in
sqlreadonlystringpackages/core/src/api/prepared.ts:26

Accessors ​

inputs ​

Get Signature ​

ts
get inputs(): readonly SqlVarDesc[];

Defined in: packages/core/src/api/prepared.ts:48

Described input parameters.

Returns ​

readonly SqlVarDesc[]


outputs ​

Get Signature ​

ts
get outputs(): readonly SqlVarDesc[];

Defined in: packages/core/src/api/prepared.ts:53

Described output columns.

Returns ​

readonly SqlVarDesc[]

Methods ​

[asyncDispose]() ​

ts
asyncDispose: Promise<void>;

Defined in: packages/core/src/api/prepared.ts:151

await using stmt = await db.prepare(…) → closes at scope exit.

Returns ​

Promise<void>


close() ​

ts
close(): Promise<void>;

Defined in: packages/core/src/api/prepared.ts:156

Release the server-side handle (deferred; rides with the next packet).

Returns ​

Promise<void>


execute() ​

ts
execute(
   params?, 
   tx?, 
options?): Promise<number>;

Defined in: packages/core/src/api/prepared.ts:114

Parameters ​

ParameterTypeDefault value
paramsQueryParams[]
tx?Transactionundefined
options?QueryOptionsundefined

Returns ​

Promise<number>


executeBatch() ​

ts
executeBatch(
   rows, 
   tx?, 
options?): Promise<BatchResult>;

Defined in: packages/core/src/api/prepared.ts:124

Bulk-run this statement against many parameter rows via the wire batch API (Firebird 4+) — in the given transaction, or a one-shot one. Repeat calls reuse the prepared handle: zero prepare cost per batch. See Attachment.executeBatch.

Parameters ​

ParameterType
rowsBatchRows
tx?Transaction
options?BatchOptions

Returns ​

Promise<BatchResult>


query() ​

ts
query<T>(
   params?, 
   tx?, 
options?): Promise<T[]>;

Defined in: packages/core/src/api/prepared.ts:105

Type Parameters ​

Type ParameterDefault type
TRow

Parameters ​

ParameterTypeDefault value
paramsQueryParams[]
tx?Transactionundefined
options?QueryOptionsundefined

Returns ​

Promise<T[]>


queryOne() ​

ts
queryOne<T>(
   params?, 
   tx?, 
options?): Promise<T | undefined>;

Defined in: packages/core/src/api/prepared.ts:110

First row or undefined (see Attachment.queryOne).

Type Parameters ​

Type ParameterDefault type
TRow

Parameters ​

ParameterTypeDefault value
paramsQueryParams[]
tx?Transactionundefined
options?QueryOptionsundefined

Returns ​

Promise<T | undefined>


run() ​

ts
run<T>(
   params?, 
   tx?, 
options?): Promise<QueryResult<T>>;

Defined in: packages/core/src/api/prepared.ts:67

Run inside an explicit transaction, or a one-shot one when omitted.

Type Parameters ​

Type ParameterDefault type
TRow

Parameters ​

ParameterTypeDefault value
paramsQueryParams[]
tx?Transactionundefined
options?QueryOptionsundefined

Returns ​

Promise<QueryResult<T>>

MIT Licensed. Contains data derived from the Firebird project under IDPL/IPL.