API Reference > imodeljs-backend > iModels > IModelDb > withStatement withStatement Method Prepared and execute a callback on an ECSQL statement. After the callback completes the statement is disposed. Use this method for ECSQL statements are either not expected to be reused, or are not expensive to prepare. For statements that will be reused often, instead use IModelDb.withPreparedStatement. withStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T): T see IModelDb.withPreparedStatement Parameter Type Description ecsql string callback (stmt: ECSqlStatement) => T the callback to invoke on the prepared statement Returns - T the value returned by callback. Defined in core/backend/src/IModelDb.ts Line 278 Last Updated: 12 June, 2024