QueryBinder Class

Bind values to an ECSQL query.

All binding class methods accept an indexOrName parameter as a string | number type and a value to bind to it. A binding must be mapped either by a positional index or a string/name. See the examples below.

@example Parameter By Index:

SELECT a, v FROM test.Foo WHERE a=? AND b=?

The first ? is index 1 and the second ? is index 2. The parameter index starts with 1 and not 0.

@example Parameter By Name:

SELECT a, v FROM test.Foo WHERE a=:name_a AND b=:name_b

Using "name_a" as the indexOrName will bind the provided value to name_a in the query. And the same goes for using "name_b" and the name_b binding respectively.

@see - ECSQL Parameters

Methods

Name Description
constructor(): QueryBinder    
bindBlob(indexOrName: string | number, val: Uint8Array): QueryBinder Bind blob value to ECSQL statement.  
bindBoolean(indexOrName: string | number, val: boolean): QueryBinder Bind boolean value to ECSQL statement.  
bindDouble(indexOrName: string | number, val: number): QueryBinder Bind double value to ECSQL statement.  
bindId(indexOrName: string | number, val: string): QueryBinder Bind  
bindIdSet(indexOrName: string | number, val: OrderedId64Iterable): QueryBinder Bind  
bindInt(indexOrName: string | number, val: number): QueryBinder Bind integer to ECSQL statement.  
bindLong(indexOrName: string | number, val: number): QueryBinder Bind long to ECSQL statement.  
bindNull(indexOrName: string | number): QueryBinder Bind null to ECSQL statement.  
bindPoint2d(indexOrName: string | number, val: Point2d): QueryBinder Bind  
bindPoint3d(indexOrName: string | number, val: Point3d): QueryBinder Bind  
bindString(indexOrName: string | number, val: string): QueryBinder Bind string to ECSQL statement.  
bindStruct(indexOrName: string | number, val: object): QueryBinder Bind struct to ECSQL statement.  
serialize(): object    
from(args: undefined | object | any[]): QueryBinder Static Allow bulk bind either parameters by index as value array or by parameter names as object.  

Defined in

Last Updated: 15 March, 2024