withQueryReader Method @beta

Allow to execute query and read results along with meta data. The result are stepped one by one.

See also:

withQueryReader<T>(ecsql: string, callback: (reader: ECSqlSyncReader) => T, params?: QueryBinder, config?: SynchronousQueryOptions): T

@returns the value returned by callback.

@throws IModelError if db is not open. Should be used when we want true step by step behaviour from the reader without any intermediate caching involved.

Parameter Type Description
ecsql string The ECSQL query to execute.
callback (reader: ECSqlSyncReader) => T the callback to invoke on the prepared ECSqlReader
params QueryBinder The values to bind to the parameters (if the ECSQL has any).
config SynchronousQueryOptions Allow to specify certain flags which control how query is executed.

Returns - T

the value returned by callback.

Defined in

Last Updated: 10 March, 2026