ECSqlSyncReader Class @beta
Execute ECSQL statements synchronously and read the results one row at a time.
This is the synchronous counterpart of ECSqlReader from @itwin/core-common.
It uses ECSqlRowExecutor directly — each call to step fetches exactly one row
with no internal caching, paging, or offset tracking.
The query results are returned one row at a time. The format of the row is dictated by the
rowFormat specified in the options parameter of the constructed ECSqlSyncReader object.
Defaults to QueryRowFormat.UseECSqlPropertyIndexes when no rowFormat is defined.
There are three primary ways to interact with and read the results:
- Iterate using ECSqlSyncReader as a synchronous iterator.
- Step manually using ECSqlSyncReader.step.
- Capture all results at once using toArray.
@note When iterating over the results, the current row is a QueryRowProxy object. To get the row as a basic JavaScript object, call QueryRowProxy.toRow on it.
Extends
Implements
- IterableIterator<QueryRowProxy>
Methods
| Name | Description | |
|---|---|---|
| [iterator](): IterableIterator<QueryRowProxy, any, any> | Accessor for using ECSqlSyncReader as a synchronous iterator. | |
| getMetaData(): QueryPropertyMetaData[] | Get the metadata for each column in the query result. | |
| next(): IteratorResult<QueryRowProxy, any> | Calls step when called as an iterator. | |
| step(): boolean | Step to the next row of the query result. | |
| toArray(): any[] | Get all remaining rows from the query result. |
Properties
| Name | Type | Description | |
|---|---|---|---|
| query Readonly | string |
Defined in
Last Updated: 10 March, 2026