QueryExecutor

Represents an interface for executing SQL statements and managing their results.

This interface provides methods for executing SQL queries, fetching results, and handling transactions. It abstracts the underlying database operations and offers a coroutine-based API for asynchronous execution.

Inheritors

Types

Link copied to clipboard
object Companion
Link copied to clipboard
interface Migrate

Interface representing a migration mechanism.

Link copied to clipboard
interface Transactional

Represents a transactional interface providing methods for handling transactions.

Properties

Link copied to clipboard

The ValueEncoderRegistry instance used for encoding values supplied to SQL statements in the PostgreSQL class. This registry maps data types to their corresponding encoders, which convert values into a format suitable for inclusion in SQL queries.

Functions

Link copied to clipboard
abstract suspend fun execute(statement: Statement): Result<Long>
abstract suspend fun execute(@Language(value = "SQL") sql: String): Result<Long>

Executes the given SQL statement asynchronously.

Link copied to clipboard
open suspend fun executeWithResult(statement: Statement): Result<ExecuteResult>
open suspend fun executeWithResult(@Language(value = "SQL") sql: String): Result<ExecuteResult>

Executes the given SQL statement asynchronously, like execute, and also reports the id the database generated for an inserted row (see ExecuteResult.lastInsertId).

Link copied to clipboard
abstract fun fetch(statement: Statement, fetchSize: Int = DEFAULT_FETCH_SIZE): Flow<ResultSet.Row>

Streams the rows of the given SQL statement as a cold Flow. See fetch.

abstract fun fetch(@Language(value = "SQL") sql: String, fetchSize: Int = DEFAULT_FETCH_SIZE): Flow<ResultSet.Row>

Streams the rows of the given SQL query as a cold Flow.

open fun <T> fetch(statement: Statement, rowMapper: RowMapper<T>, fetchSize: Int = DEFAULT_FETCH_SIZE): Flow<T>

Streams the rows of the given SQL statement, mapping each row with the provided RowMapper. See fetch.

open fun <T> fetch(@Language(value = "SQL") sql: String, rowMapper: RowMapper<T>, fetchSize: Int = DEFAULT_FETCH_SIZE): Flow<T>

Streams the rows of the given SQL query, mapping each row with the provided RowMapper. See fetch.

Link copied to clipboard
abstract suspend fun fetchAll(statement: Statement): Result<ResultSet>

Fetches all results of the given SQL statement asynchronously.

abstract suspend fun fetchAll(@Language(value = "SQL") sql: String): Result<ResultSet>

Fetches all results of the given SQL query asynchronously.

open suspend fun <T> fetchAll(statement: Statement, rowMapper: RowMapper<T>): Result<List<T>>

Fetches all results of the given SQL statement and maps each row using the provided RowMapper.

open suspend fun <T> fetchAll(@Language(value = "SQL") sql: String, rowMapper: RowMapper<T>): Result<List<T>>

Fetches all results of the given SQL query and maps each row using the provided RowMapper.