ECSqlReader Class
Execute ECSQL statements and read the results.
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 ECSqlReader object. Defaults to
UseECSqlPropertyIndexes when no rowFormat is defined.
There are three primary ways to interact with and read the results:
- Stream them using ECSqlReader as an asynchronous iterator.
- Iterator over them manually using ECSqlReader.step.
- Capture all of the results at once in an array using toArray.
@see - ECSQL Overview
- ECSQL Row Formats for more details on how rows are formatted.
- ECSQL Code Examples for examples of each of the above ways of interacting with ECSqlReader.
@note When iterating over the results, the current row will be a QueryRowProxy object. To get the row as a basic JavaScript object, call QueryRowProxy.toRow on it.
Extends
Implements
- AsyncIterableIterator<QueryRowProxy>
Methods
| Name | Description | |
|---|---|---|
| [asyncIterator](): AsyncIterableIterator<QueryRowProxy, any, any> | Accessor for using ECSqlReader as an asynchronous iterator. | |
| getMetaData(): Promise<QueryPropertyMetaData[]> | Get the metadata for each column in the query result. | |
| next(): Promise<IteratorResult<QueryRowProxy, any>> | Calls step when called as an iterator. | |
| reset(options?: QueryOptions): void | Deprecated | |
| resetBindings(): void | Clear all bindings. | Deprecated |
| setParams(param: QueryBinder): void | Deprecated | |
| step(): Promise<boolean> | Step to the next row of the query result. | |
| toArray(): Promise<any[]> | Get all remaining rows from the query result. |
Properties
| Name | Type | Description | |
|---|---|---|---|
| query Readonly | string | ||
| stats Accessor ReadOnly | QueryStats | Get performance-related statistics for the current query. |
Inherited properties
| Name | Type | Inherited from | Description |
|---|---|---|---|
| current Accessor Inherited ReadOnly | QueryRowProxy | ECSqlReaderBase | Get the current row from the query result. The current row is the one most recently stepped-to (by step() or during iteration). Each value from the row can be accessed by index or by name. |
| done Accessor Inherited ReadOnly | boolean | ECSqlReaderBase | Returns if there are more rows available. |
Defined in
- core/common/src/ECSqlReader.ts Line 57
Last Updated: 21 March, 2026
Found something wrong, missing, or unclear on this page? Raise an issue in our repo.