JdbcTransaction

Class representing a unit block of work that is performed on a database using a JDBC driver.

Constructors

Link copied to clipboard
constructor(transactionImpl: JdbcTransactionInterface)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val connection: ExposedConnection<*>

The database connection used by the transaction.

Link copied to clipboard

The currently executing statement.

Link copied to clipboard
override val db: Database
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val id: String
Link copied to clipboard

The maximum amount of attempts that will be made to perform this transaction block.

Link copied to clipboard

The maximum number of milliseconds to wait before retrying this transaction if an SQLException happens.

Link copied to clipboard

The minimum number of milliseconds to wait before retrying this transaction if an SQLException happens.

Link copied to clipboard
open override val outerTransaction: JdbcTransaction?
Link copied to clipboard
Link copied to clipboard
open override val readOnly: Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val transactionIsolation: Int

The transaction isolation level of the transaction, which may differ from the set database level.

Link copied to clipboard

Functions

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

Closes the transaction and releases any savepoints.

Link copied to clipboard

Closes all previously executed statements and resets or releases any used database and/or driver resources.

Link copied to clipboard
open override fun commit()

Saves all changes since the last commit or rollback operation.

Link copied to clipboard
fun <T> exec(stmt: BlockingExecutable<T, *>): T?

Executes the provided Statement object and returns the generated value.

fun <T, R> exec(stmt: BlockingExecutable<T, *>, body: Statement<T>.(T) -> R): R?

Executes the provided Statement object, retrieves the generated value, then calls the specified function body with this generated value as its argument and returns its result.

fun exec(stmt: String, args: Iterable<Pair<IColumnType<*>, Any?>> = emptyList(), explicitStatementType: StatementType? = null): Unit?
fun <T : Any> exec(stmt: String, args: Iterable<Pair<IColumnType<*>, Any?>> = emptyList(), explicitStatementType: StatementType? = null, transform: (ResultSet) -> T?): T?

Executes the provided statement exactly, using the supplied args to set values to question mark placeholders (if applicable).

Link copied to clipboard
fun execInBatch(stmts: List<String>)

Provided statements will be executed in a batch. Select statements are not supported as it's impossible to return multiple results.

Link copied to clipboard
fun JdbcTransaction.explain(analyze: Boolean = false, options: String? = null, body: StatementBuilder.() -> Statement<*>): ExplainBlockingExecutable

Creates an ExplainQuery using the EXPLAIN keyword, which obtains information about a statement execution plan.

Link copied to clipboard
fun fullIdentity(column: Column<*>): String
Link copied to clipboard
fun <T : Any> getOrCreate(key: Key<T>, init: () -> T): T
Link copied to clipboard
fun <T : Any> getUserData(key: Key<T>): T?
Link copied to clipboard
fun identity(column: Column<*>): String
fun identity(table: Table): String
Link copied to clipboard
fun <T : Any> putUserData(key: Key<T>, value: T)
Link copied to clipboard

Adds the specified StatementInterceptor to act on this transaction.

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

Reverts all changes since the last commit or rollback operation, or to the last set savepoint, if applicable.

Link copied to clipboard

Removes the specified StatementInterceptor from acting on this transaction.

Link copied to clipboard
fun <T> JdbcTransaction.withDataBaseLock(body: () -> T)

Creates table with name "busy" (if not present) and single column to be used as "synchronization" point. Table wont be dropped after execution.

Link copied to clipboard
suspend fun <T> JdbcTransaction.withSuspendTransaction(context: CoroutineContext? = null, statement: suspend JdbcTransaction.() -> T): T