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 QueryOptions.rowFormat specified in the options parameter of the constructed ECSqlReader object. Defaults to QueryRowFormat.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 QueryRowProxy.toArray.

@see - ECSQL Overview

@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

Methods

Name Description
[asyncIterator](): AsyncIterableIterator<QueryRowProxy> Accessor for using ECSqlReader as an asynchronous iterator.  
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

Last Updated: 16 April, 2024