withSqliteStatement Method

Prepared and execute a callback on a SQL statement. After the callback completes the statement is disposed. Use this method for SQL statements are either not expected to be reused, or are not expensive to prepare. For statements that will be reused often, instead use IModelDb.withPreparedSqliteStatement.

withSqliteStatement<T>(sql: string, callback: (stmt: SqliteStatement) => T, logErrors: boolean = true): T

@returns the value returned by callback.

Parameter Type Description
sql string The SQLite SQL statement to execute
callback (stmt: SqliteStatement) => T the callback to invoke on the prepared statement
logErrors boolean Determine if errors are logged or not

Returns - T

the value returned by callback.

Defined in

Last Updated: 16 April, 2024