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. Use this method for true step-by-step row consumption without intermediate result or page caching. The prepared ECSQL statement may be reused from the statement cache between completed calls.

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: 03 August, 2026