Transaction

Base class representing a unit block of work that is performed on a database.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
abstract val db: DatabaseApi

The database on which the transaction tasks are performed.

Link copied to clipboard

Whether tracked values like statementCount and duration should be stored in statementStats for debugging.

Link copied to clipboard

The current total amount of time, in milliseconds, spent executing statements in this transaction.

Link copied to clipboard
val id: String

The unique ID for this transaction.

Link copied to clipboard

The parent transaction of a nested transaction; otherwise, null if the transaction is a top-level instance.

Link copied to clipboard

The number of seconds the driver should wait for a statement to execute in a transaction before timing out. Note that not all drivers implement this limit. For more information, refer to the relevant driver documentation.

Link copied to clipboard
abstract val readOnly: Boolean

Whether the transaction is in read-only mode.

Link copied to clipboard

The current number of statements executed in this transaction.

Link copied to clipboard

A StringBuilder containing string representations of previously executed statements prefixed by their execution time in milliseconds.

Link copied to clipboard

A mapping of previously executed statements in this transaction, with a string representation of the prepared statement as the key and the statement count to execution time as the value.

Link copied to clipboard

The threshold in milliseconds for query execution to exceed before logging a warning.

Functions

Link copied to clipboard
open fun addLogger(vararg logger: SqlLogger): CompositeSqlLogger

Adds one or more SqlLoggers to this Transaction.

Link copied to clipboard
fun fullIdentity(column: Column<*>): String

Returns the complete string identifier of a column, based on its Table.tableName and Column.name.

Link copied to clipboard
fun <T : Any> getOrCreate(key: Key<T>, init: () -> T): T

Returns the value for the specified key. If the key is not found, the init function is called, then its result is mapped to the key and returned.

Link copied to clipboard
fun <T : Any> getUserData(key: Key<T>): T?

Returns the value to which the specified key is mapped, as a value of type T.

Link copied to clipboard
fun identity(column: Column<*>): String

Returns the string identifier of a column, based on its Column.name.

fun identity(table: Table): String

Returns the string identifier of a table, based on its Table.tableName and Table.alias, if applicable.

Link copied to clipboard
fun <T : Any> putUserData(key: Key<T>, value: T)

Maps the specified key to the specified value.

Link copied to clipboard
fun <T : Any> removeUserData(key: Key<T>): Any?

Removes the specified key and its corresponding value.