SQLiteTransaction

interface SQLiteTransaction<R> : ProxyExecutable, ProxyObject, Future<R>

SQLite Transaction

Describes a transaction which is bound to an SQLiteTransactor function, and which is under execution via the SQLite engine against an active database; the transaction may be invoked one or more times, and may be adjusted via the mode methods provided (deferred, immediate, and exclusive).

If no transaction mode is declared explicitly via the methods provided, the connection's default transaction mode is used.

 

Transaction Behavior

Transaction functions may be executed more than once in order to facilitate retry or rollback logic; the transaction function is expected to be idempotent.

The return value (type R) provided by the SQLiteTransactor, if any, is returned by this transaction object, via invoke.

 

Object Interop & Cancellation

Transactions are directly executable, either host-side (via invoke), or guest-side (via ProxyExecutable). Transactions can also be used as Future objects which yield their result when the transaction completes.

Cancelling a transaction will make a best-effort attempt to interrupt it (if allowed), by raising an exception within the thread executing the transaction.

Transaction cancellation then propagates to the caller instead of providing a value.

SQLite Transaction Docs

Parameters

R

Return value type.

See also

Database API

Statement API

Transactor Interface

Properties

Link copied to clipboard

Indicate the type of this transaction; see SQLiteTransactionType for options.

Functions

Link copied to clipboard
open override fun cancel(mayInterruptIfRunning: Boolean): Boolean
Link copied to clipboard
abstract fun deferred(): SQLiteTransaction<R>

Applies DEFERRED mode to this transaction; another transaction object is returned (a copy), applying this mode, but with the same properties otherwise.

Link copied to clipboard
Link copied to clipboard
abstract fun exclusive(): SQLiteTransaction<R>

Applies EXCLUSIVE mode to this transaction; another transaction object is returned (a copy), applying this mode, but with the same properties otherwise.

Link copied to clipboard
open override fun execute(vararg arguments: Value?): Any
Link copied to clipboard
abstract fun get(): R
abstract operator fun get(p0: Long, p1: TimeUnit): R
Link copied to clipboard
abstract fun getMember(key: String): Any
Link copied to clipboard
open override fun getMemberKeys(): Array<String>
Link copied to clipboard
open override fun hasMember(key: String?): Boolean
Link copied to clipboard
abstract fun immediate(): SQLiteTransaction<R>

Applies IMMEDIATE mode to this transaction; another transaction object is returned (a copy), applying this mode, but with the same properties otherwise.

Link copied to clipboard
abstract operator fun invoke(vararg args: Any?): R

Execute this transaction, invoking the associated SQLiteTransactor function.

Link copied to clipboard
abstract fun isCancelled(): Boolean
Link copied to clipboard
abstract fun isDone(): Boolean
Link copied to clipboard
open override fun putMember(key: String?, value: Value?)
Link copied to clipboard
open fun removeMember(key: String): Boolean
Link copied to clipboard
open fun resultNow(): R
Link copied to clipboard
open fun state(): Future.State