withQueryReader Method @beta
Executes a callback with a synchronous ECSQL reader on the owning database connection. The reader steps one row at a time without buffering result batches. Finish using it before the callback completes. Return materialized rows or computed values rather than the reader. For asynchronous execution, use createQueryReader. The prepared statement may be reused from the statement cache between completed calls.
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.
| Parameter | Type | Description |
|---|---|---|
| ecsql | string | The ECSQL query to execute. |
| callback | (reader: ECSqlSyncReader) => T | the callback to invoke on the prepared ECSqlSyncReader |
| 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
- backend/src/IModelDb.ts Line 1078
Last Updated: 02 October, 2026
Found something wrong, missing, or unclear on this page? Raise an issue in our repo.