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.

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
Link copied to clipboard
internal val sql: String
Link copied to clipboard
internal val typeManager: TypeManager

The session's type manager, resolving OIDs and publishing the catalog an execution pins.

Functions

Link copied to clipboard
internal fun beginExecution(): Execution

Pins the catalog this execution will read, and builds the mappers over it.

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