withStatement Method
Deprecated in 4.11. Use IModelDb.createQueryReader or ECDb.createQueryReader to query.
IModelDb.createQueryReader is an asynchronous API. If you encounter a use case that cannot be converted to async, please report an issue at https://github.com/iTwin/itwinjs-core/issues. Mean while use IModelDb.withPreparedStatement for synchronous API calls where conversion to async is not possible.
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 withPreparedStatement.
withStatement<T>(ecsql: string, callback: (stmt: ECSqlStatement) => T, logErrors: booleantrue): T
@returns the value returned by callback
.
Parameter | Type | Description |
---|---|---|
ecsql | string | |
callback | (stmt: ECSqlStatement) => T | the callback to invoke on the prepared statement |
logErrors | boolean | Determines if error will be logged if statement fail to prepare |
Returns - T
the value returned by callback
.
Defined in
- core/backend/src/IModelDb.ts Line 456
Last Updated: 29 April, 2025