AbstractQuery

Base class representing an SQL query that returns a ResultSet when executed.

Inheritors

Constructors

Link copied to clipboard
constructor(targets: List<Table>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The number of results that should be fetched when this query is executed.

Link copied to clipboard

Whether the SQL statement is meant to be performed as part of a batch execution.

Link copied to clipboard
var limit: Int?

The stored value for a LIMIT clause in this query.

Link copied to clipboard

The stored value for an OFFSET clause in this query.

Link copied to clipboard

The stored list of columns and their SortOrder for an ORDER BY clause in this query.

Link copied to clipboard
abstract val set: FieldSet

The set of columns on which a query should be executed, contained by a ColumnSet.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun <T> Iterable<T>.appendTo(builder: QueryBuilder, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", transform: QueryBuilder.(T) -> Unit): QueryBuilder

Appends all the elements separated using separator and using the given prefix and postfix if supplied.

Link copied to clipboard
open override fun arguments(): List<List<Pair<IColumnType<*>, Any?>>>

Returns all mappings of columns and expression types to their values needed to prepare an SQL statement.

Link copied to clipboard
abstract fun copy(): SizedIterable<ResultRow>

Returns a new SizedIterable that is a copy of the original.

Link copied to clipboard
open fun copyTo(other: T)

Copies all stored properties of this SELECT query into the properties of other.

Link copied to clipboard
abstract fun count(): Long

Returns the number of elements stored.

Link copied to clipboard
abstract fun empty(): Boolean

Whether there are no elements stored.

Link copied to clipboard

Returns only distinct results from this query that are NOT common to the results of other.

Link copied to clipboard
fun execute(transaction: Transaction): ResultSet?

Executes the SQL statement directly in the provided transaction and returns the generated result, or null if either no result was retrieved or if the transaction blocked statement execution.

Link copied to clipboard

Determines the exact way that an SQL statement is executed in a transaction and applies any necessary logic before returning the result generated by the executed statement.

Link copied to clipboard
fun fetchSize(n: Int): T

Modifies the number of results that should be fetched when this query is executed.

Link copied to clipboard
open fun forEach(p0: Consumer<in ResultRow>)
Link copied to clipboard
open fun forUpdate(option: ForUpdateOption = ForUpdateOption.ForUpdate): SizedIterable<ResultRow>

Returns a new SizedIterable with a locking read for the elements according to the rules specified by option.

Link copied to clipboard

Returns only results from this query that are common to the results of other, WITHOUT including any duplicates.

Link copied to clipboard
open operator override fun iterator(): Iterator<ResultRow>
Link copied to clipboard
open override fun limit(count: Int): T

Modifies this query to return only count results.

open override fun limit(n: Int, offset: Long): T
Link copied to clipboard
infix fun <T, R> SizedIterable<T>.mapLazy(f: (T) -> R): SizedIterable<R>

Returns a SizedIterable containing the lazily evaluated results of applying the function f to each original element.

Link copied to clipboard

Returns a new SizedIterable without any locking read for the elements.

Link copied to clipboard
open override fun offset(start: Long): T

Modifies this query to return only results starting after the specified start.

Link copied to clipboard
open override fun orderBy(vararg order: Pair<Expression<*>, SortOrder>): T

Modifies this query to sort results according to the provided order of expressions.

fun orderBy(column: Expression<*>, order: SortOrder = SortOrder.ASC): T

Modifies this query to sort results by the specified column, according to the provided order.

Link copied to clipboard
open fun prepared(transaction: Transaction, sql: String): PreparedStatementApi

Uses a transaction connection and an sql string representation to return a precompiled SQL statement, stored as an implementation of PreparedStatementApi.

Link copied to clipboard
abstract fun prepareSQL(builder: QueryBuilder): String

Returns the string representation of an SQL query, generated by appending SQL expressions to a QueryBuilder.

open override fun prepareSQL(transaction: Transaction, prepared: Boolean): String

Returns the string representation of an SQL statement.

Link copied to clipboard
Link copied to clipboard
fun AbstractQuery<*>.union(other: Query): Union

Combines all results from this query with the results of other, WITHOUT including duplicates.

Link copied to clipboard

Combines all results from this query with the results of other, WITH duplicates included.

Link copied to clipboard
abstract fun withDistinct(value: Boolean = true): T

Modifies this query to retrieve only distinct results if value is set to true.