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, logErrors: boolean = true): T

@returns the value returned by callback.

@see IModelDb.withPreparedStatement

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

Last Updated: 16 April, 2024