timedReadOnlyTx

fun <T> timedReadOnlyTx(db: Database? = null, transactionIsolation: Int? = db?.transactionManager?.defaultIsolationLevel, statement: JdbcTransaction.() -> T): TimedValue<T>

Executes a read-only database transaction and measures its execution time.

Called inside another transaction, this does not start a new one: with Exposed's default useNestedTransactions = false the block joins the outer transaction, and with nesting on it inherits the outer transaction's read-only flag and isolation level. Either way, transactionIsolation and read-only mode (where applicable) are not applied, and only an outermost call commits.

Return

a TimedValue containing the result and the elapsed duration

Parameters

db

the Database to use, or null for the default database

transactionIsolation

the JDBC transaction isolation level

statement

the transaction body to execute

Type Parameters

T

the return type of the transaction