Query

abstract class Query<T : Query<T>>(val sql: String, val queryExecutor: QueryExecutor, val typeManager: TypeManager)

Base class for executing queries with parameters.

This class provides the foundational state and utilities needed for managing type conversion registries and mappings localized to a single query instance.

Each query gets converter registries of its own, chained to the session's. A converter registered here is consulted before the session's and is discarded with the query, which is what makes a one-off mapping possible without disturbing anything else on the connection.

Type Parameters

T

The concrete type of the query (used for fluent API return types).

Inheritors

Constructors

Link copied to clipboard
internal constructor(sql: String, queryExecutor: QueryExecutor, typeManager: TypeManager)

Properties

Link copied to clipboard

Parameter converters local to this query, chained to the session's. Converters here are tried first.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Result converters local to this query, chained to the session's. Converters here are tried first.

Link copied to clipboard
Link copied to clipboard
internal val sql: String
Link copied to clipboard
internal val typeManager: TypeManager

The session's type manager, resolving OIDs and holding the parent registries.

Functions

Link copied to clipboard
fun execute(ignoreRows: Boolean = false)

Executes a statement with no result and no row count — DDL, SET, administrative commands.

Link copied to clipboard

Registers a ParameterConverter for this query only, ahead of any the session already holds.

Link copied to clipboard

Registers a ResultConverter for this query only, ahead of any the session already holds.

Link copied to clipboard
internal inline fun <R> withQueryContext(sql: String, crossinline paramsProvider: () -> Map<String, Any?>, crossinline dbSqlProvider: () -> String? = { null }, crossinline dbParamsProvider: () -> List<Any?>? = { null }, block: () -> R): R