OctaviusSession

Represents an active database session extending standard operations with full lifecycle control and transaction management.

Inheritors

Properties

Link copied to clipboard
abstract var autoCommit: Boolean

Specifies whether the session operates in auto-commit mode. If true, each individual statement is treated as a separate transaction.

Link copied to clipboard
abstract val copy: CopyManager

Provides an API for performing PostgreSQL COPY operations.

Link copied to clipboard

Provides an API for managing PostgreSQL Large Objects.

Link copied to clipboard
abstract var networkTimeout: Int

The network timeout (in milliseconds) for operations executed on this session.

Link copied to clipboard

Handles asynchronous PostgreSQL notifications (LISTEN / NOTIFY mechanism).

Link copied to clipboard
abstract var readOnly: Boolean

Indicates whether this session is currently in read-only mode.

Link copied to clipboard

Provides a high-level API for executing operations within transaction scopes (e.g., required, nested). Automatically manages commits and rollbacks based on block execution outcomes.

Link copied to clipboard

The transaction isolation level for this session.

Link copied to clipboard

The current transaction state of this session (Idle, In Transaction, or Failed).

Link copied to clipboard
abstract val typeManager: TypeManager

Manages PostgreSQL types and their OIDs, providing functionality for registration and resolution.

Functions

Link copied to clipboard
abstract fun abort()

Manually aborts the connection, forcing the underlying connection pool (like HikariCP) to evict it instead of returning it to the pool.

Link copied to clipboard
abstract fun cancelQuery()

Attempts to cancel the currently executing query on this session.

Link copied to clipboard
abstract override fun close()

Ends the session, undoing the per-session state it left on its connection and giving that connection up - back to the pool it was borrowed from, or closed outright.

Link copied to clipboard
abstract fun commit()

Commits the current transaction, persisting all changes made within it.

Link copied to clipboard

Creates a query with named parameters (e.g., @name, @id) which will be translated into positional parameters under the hood.

Link copied to clipboard

Creates a native query from the provided SQL string using standard PostgreSQL positional parameters (e.g. $1, $2).

Link copied to clipboard
abstract fun getSearchPath(): List<String>

Retrieves the current search_path configured for this session.

Link copied to clipboard
abstract fun isValid(timeout: Int): Boolean

Checks if this session is still valid and the underlying connection is alive.

Link copied to clipboard
abstract fun releaseSavepoint(savepoint: OctaviusSavepoint)

Releases the specified savepoint from the current transaction.

Link copied to clipboard
abstract fun reloadTypes()

Reloads the database types and updates internal OID mappings.

Link copied to clipboard
abstract fun rollback()

Rolls back the current transaction, discarding all changes made within it.

abstract fun rollback(savepoint: OctaviusSavepoint)

Rolls back the transaction to the state at the time the given savepoint was created.

Link copied to clipboard

Creates an unnamed savepoint within the current transaction and returns it.

Creates a named savepoint within the current transaction and returns it.