← Back to Stormify Documentation

Connection

A connection to a specific database, used to execute statements and manage transactions.

Inheritors

Properties

Link copied to clipboard

Metadata about the database product name, version, and capabilities.

Functions

Link copied to clipboard

Acquires a prepared statement for sql, reusing one from the connection's internal cache if available. The returned statement reports close() as a "release" — the underlying handle is reset and returned to the cache for the next call. Callers must use the standard .use { } pattern; the connection itself owns the real lifetime and physically closes all cached statements on Connection.close.

Link copied to clipboard
open fun cancel()

Best-effort asynchronous cancellation of any statement currently executing on this connection. Designed to be called from a thread OTHER than the one blocked inside a kdbc call — that is the point: higher-level code (e.g. a Kotlin coroutine cancellation handler) can interrupt a running query without waiting for it.

Link copied to clipboard

Driver-specific recovery after cancel has interrupted a blocking call. Invoked by the coroutine cancellation path on the thread that owned the blocking call, once that call has returned with an error.

Link copied to clipboard
abstract fun commit()

Commits the current transaction.

Link copied to clipboard

Reports the connection's current auto-commit state. Default true matches the JDBC convention so callers don't need to special-case unknown drivers; native implementations override with the real value tracked by their kdbc_conn struct.

Link copied to clipboard
abstract fun initStatement(sql: String, returnGeneratedKeys: Boolean, columnNames: Array<String>?): Statement

Creates a prepared statement for the given SQL. Set returnGeneratedKeys to retrieve auto-generated keys after execution.

Link copied to clipboard

Creates a callable statement for invoking stored procedures.

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

Releases a savepoint, freeing database resources.

Link copied to clipboard
abstract fun rollback(savepoint: Savepoint? = null)

Rolls back the current transaction, optionally to a specific savepoint.

Link copied to clipboard
abstract fun setAutoCommit(autoCommit: Boolean)

Enables or disables auto-commit mode. When disabled, changes must be explicitly committed.

Link copied to clipboard
abstract fun setSavepoint(name: String): Savepoint

Creates a named savepoint within the current transaction.