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:

const binder = new QueryBinder(); binder.bindString(1, "MyCode"); binder.bindInt(2, 42); const reader = iModel.createQueryReader("SELECT a, v FROM test.Foo WHERE a=? AND b=?", binder); for await (const row of reader) { // do something with the query result }

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

@example Parameter By Name:

const binder = new QueryBinder(); binder.bindString("name_a", "A"); binder.bindString("name_b", "B"); const reader = iModel.createQueryReader("SELECT a, v FROM test.Foo WHERE a=:name_a AND b=:name_b", binder); for await (const row of reader) { // do something with the query result }

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  
bindRange3d(indexOrName: string | number, val: Readonly<WritableLowAndHighXYZ>): QueryBinder Bind range3d value to ECSQL statement.  
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: object | any[]): QueryBinder Static Allow bulk bind either parameters by index as value array or by parameter names as object.  

Defined in

Last Updated: 04 April, 2026