API Reference > imodeljs-backend > iModels > IModelDb > withPreparedStatement withPreparedStatement Method Use a prepared ECSQL statement. This function takes care of preparing the statement and then releasing it. As preparing statements can be costly, they get cached. When calling this method again with the same ECSQL, the already prepared statement from the cache will be reused. See also: ECSQL Overview Code Examples withPreparedStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T): T Parameter Type Description ecsql string The ECSQL statement to execute callback (stmt: ECSqlStatement) => T the callback to invoke on the prepared statement Returns - T the value returned by cb Defined in core/backend/src/IModelDb.ts Line 604 Last Updated: 13 June, 2024