AbstractQuery

abstract class AbstractQuery<T : AbstractQuery<T>>(targets: List<Table>) : Statement<ResultApi>

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

Constructors

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

Types

Link copied to clipboard

Represents the position at which an SQL comment will be added in a SELECT query.

Properties

Link copied to clipboard

The stored comments and their CommentPositions in this SELECT query.

Link copied to clipboard

Whether only distinct results should be retrieved by this SELECT query.

Link copied to clipboard

List of columns on which the query should be distinct.

Link copied to clipboard

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

Link copied to clipboard

The stored list of columns for a GROUP BY clause in this SELECT query.

Link copied to clipboard

The stored condition for a HAVING clause in this SELECT query.

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
Link copied to clipboard

The stored condition for a WHERE clause in this SELECT query.

Functions

Link copied to clipboard
fun adjustComments(position: AbstractQuery.CommentPosition, content: String? = null): T

Changes the content of the comments field at the specified position in this query.

Link copied to clipboard
fun adjustHaving(body: Op<Boolean>?.() -> Op<Boolean>): T

Changes the having field of this query.

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
fun comment(content: String, position: AbstractQuery.CommentPosition = CommentPosition.FRONT): T

Appends an SQL comment, with content wrapped by /* */, at the specified CommentPosition in this SELECT query.

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
fun fetchSize(n: Int): T

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

Link copied to clipboard
fun groupBy(vararg columns: Expression<*>): T

Appends a GROUP BY clause with the specified columns to this SELECT query.

Link copied to clipboard

Whether this SELECT query already has a stored value option for performing locking reads.

Link copied to clipboard

Appends a HAVING clause with the specified op condition to this SELECT query.

Link copied to clipboard

Whether this SELECT query will perform a locking read.

Link copied to clipboard
open 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
open fun withDistinct(value: Boolean = true): T

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

Link copied to clipboard
fun withDistinctOn(vararg columns: Column<*>): T

Specifies that the SELECT query should retrieve distinct results based on the given list of columns.