Executing ECSQL with the iModel.js Backend

ECSQL by itself is described in detail here: ECSQL

Executing an ECSQL statement typically consists of these steps:

  1. Prepare the ECSQL
  2. Bind values to the ECSQL parameters (if parameters are used)
  3. Execute the ECSQL and iterate the query results (for ECSQL SELECT statements).
  4. Reset the statement and clear its parameter bindings, if the statement should be executed again.

For iModels only ECSQL SELECT statements can be executed. Data modification must be done through the API. For ECDb ECSQL INSERT, UPDATE and DELETE statements can be executed as well.

There are two ways to execute an ECSQL statement:

See Code Examples for examples of how the API is used.

See frequently used ECSQL queries for the specific ECSQL queries that app backends and services often run.

Last Updated: 20 September, 2019