transact

fun <T> transact(transactionMode: SQLiteTransactionMode = SQLiteTransactionMode.EXCLUSIVE, block: SQLiteDatabase.() -> T): T

Execute a block inside either an exclusive or an immediate database transaction. These transaction modes are the same in WAL-journal mode; in other journal modes, exclusive transaction mode prevents other connections from reading the database while the transaction is underway.

Performing write operations within the block on this database on a thread other than the calling thread can result in deadlock.

Return

result of the transaction.

Parameters

transactionMode

of the transaction; the default is SQLiteTransactionMode.EXCLUSIVE.

block

to transact.

See also