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.
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 | ||
resetBindings(): void | Clear all bindings. | |
setParams(param: QueryBinder): void | ||
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 | |
---|---|---|---|
current Accessor ReadOnly | QueryRowProxy | Get the current row from the query result. | |
done Accessor ReadOnly | boolean | Returns if there are more rows available. | |
query Readonly | string | ||
stats Accessor ReadOnly | QueryStats | Get performance-related statistics for the current query. |
Defined in
- core/common/src/ECSqlReader.ts Line 162
Last Updated: 17 December, 2024
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.