# Package-level declarations

## Types

BatchDataInconsistentException
Link copied to clipboard
class BatchDataInconsistentException(message: String) : Exception

An exception thrown when the provided data cannot be validated or processed to prepare a batch statement.

BatchInsertStatement
Link copied to clipboard
open class BatchInsertStatement(table: Table, ignore: Boolean = false, val shouldReturnGeneratedValues: Boolean = true) : InsertStatement<List<ResultRow>>

Represents the SQL statement that batch inserts new rows into a table.

BatchReplaceStatement
Link copied to clipboard
open class BatchReplaceStatement(table: Table, shouldReturnGeneratedValues: Boolean = true) : BatchInsertStatement

Represents the SQL statement that either batch inserts new rows into a table, or, if insertions violate unique constraints, first deletes the existing rows before inserting new rows.

BatchUpdateStatement
Link copied to clipboard
open class BatchUpdateStatement(val table: IdTable<*>) : UpdateStatement

Represents the SQL statement that batch updates rows of a table.

BatchUpsertStatement
Link copied to clipboard
open class BatchUpsertStatement(table: Table, val keys: Column<*>, val onUpdateExclude: List<Column<*>>?, val where: Op<Boolean>?, shouldReturnGeneratedValues: Boolean = true) : BatchInsertStatement, UpsertBuilder

Represents the SQL statement that either batch inserts new rows into a table, or updates the existing rows if insertions violate unique constraints.

DeleteStatement
Link copied to clipboard
open class DeleteStatement(val targetsSet: ColumnSet, val where: Op<Boolean>? = null, val isIgnore: Boolean = false, val limit: Int? = null, val targetTables: List<Table> = emptyList()) : Statement<Int>

Represents the SQL statement that deletes one or more rows of a table.

GlobalStatementInterceptor
Link copied to clipboard
interface GlobalStatementInterceptor : StatementInterceptor

Represents a StatementInterceptor that is loaded whenever a Transaction instance is initialized.

InsertSelectStatement
Link copied to clipboard
open class InsertSelectStatement(val columns: List<Column<*>>, val selectQuery: AbstractQuery<*>, val isIgnore: Boolean = false) : Statement<Int>

Represents the SQL statement that uses data retrieved from a selectQuery to insert new rows into a table.

InsertStatement
Link copied to clipboard
open class InsertStatement<Key : Any>(val table: Table, val isIgnore: Boolean = false) : UpdateBuilder<Int>

Represents the SQL statement that inserts a new row into a table.

MergeSelectStatement
Link copied to clipboard
open class MergeSelectStatement(dest: Table, selectQuery: QueryAlias, val on: Op<Boolean>) : MergeStatement

Represents an SQL MERGE statement. It encapsulates the logic to perform conditional updates, insertions, or deletions.

MergeStatement
Link copied to clipboard
abstract class MergeStatement(val table: Table) : Statement<Int>

The base implementation of SQL merge command that is used by statements like MergeSelectStatement, MergeTableStatement

MergeTableStatement
Link copied to clipboard
open class MergeTableStatement(dest: Table, source: Table, on: Op<Boolean>?) : MergeStatement

Represents an SQL MERGE statement. It encapsulates the logic to perform conditional updates, insertions, or deletions.

ReplaceSelectStatement
Link copied to clipboard
open class ReplaceSelectStatement(columns: List<Column<*>>, selectQuery: AbstractQuery<*>) : InsertSelectStatement

Represents the SQL statement that uses data retrieved from a selectQuery to either insert a new row into a table, or, if insertion would violate a unique constraint, first delete the existing row before inserting a new row.

ReplaceStatement
Link copied to clipboard
open class ReplaceStatement<Key : Any>(table: Table) : InsertStatement<Key>

Represents the SQL statement that either inserts a new row into a table, or, if insertion would violate a unique constraint, first deletes the existing row before inserting a new row.

ReturningStatement
Link copied to clipboard
open class ReturningStatement(val table: Table, val returningExpressions: List<Expression<*>>, val mainStatement: Statement<*>) : Statement<ResultApi>

Represents the underlying SQL mainStatement that returns a result with data from any modified rows.

SQLServerBatchInsertStatement
Link copied to clipboard
open class SQLServerBatchInsertStatement(table: Table, ignore: Boolean = false, shouldReturnGeneratedValues: Boolean = true) : BatchInsertStatement

Represents the SQL statement that batch inserts new rows into a table, specifically for the SQL Server database.

Statement
Link copied to clipboard
abstract class Statement<out T>(val type: StatementType, val targets: List<Table>)

Base class representing an SQL statement that can be executed.

StatementBuilder
Link copied to clipboard
interface StatementBuilder

Represents all the DSL methods available when building SQL statements.

StatementContext
Link copied to clipboard
class StatementContext(val statement: Statement<*>, val args: Iterable<Pair<IColumnType<*>, Any?>>)

Holds information related to a particular statement and the args needed to prepare it for execution.

StatementGroup
Link copied to clipboard
enum StatementGroup : Enum<StatementGroup>

Represents the groups that are used to classify the purpose of an SQL statement.

StatementInterceptor
Link copied to clipboard
interface StatementInterceptor

Represents the processes that should be performed during a statement's lifecycle events in a transaction.

StatementResult
Link copied to clipboard
sealed class StatementResult

Stores the result generated by a database after statement execution and indicates the form of the result.

StatementType
Link copied to clipboard
enum StatementType : Enum<StatementType>

Possible SQL statement types, most often represented by the leading word in the command syntax.

UpdateBuilder
Link copied to clipboard
abstract class UpdateBuilder<out T>(type: StatementType, targets: List<Table>) : Statement<T>

Represents the underlying mapping of columns scheduled for change along with their new values.

UpdateStatement
Link copied to clipboard
open class UpdateStatement(val targetsSet: ColumnSet, val limit: Int?, val where: Op<Boolean>? = null) : UpdateBuilder<Int>

Represents the SQL statement that updates rows of a table.

UpsertBuilder
Link copied to clipboard
sealed interface UpsertBuilder

Common interface for building SQL statements that either insert a new row into a table, or update the existing row if insertion would violate a unique constraint.

UpsertStatement
Link copied to clipboard
open class UpsertStatement<Key : Any>(table: Table, val keys: Column<*>, val onUpdateExclude: List<Column<*>>?, val where: Op<Boolean>?) : InsertStatement<Key> , UpsertBuilder

Represents the SQL statement that either inserts a new row into a table, or updates the existing row if insertion would violate a unique constraint.

## Functions

buildStatement
Link copied to clipboard
fun <S> buildStatement(body: StatementBuilder.() -> S): S

Builder block for generating instances representing SQl statements, without the statement being sent to the database for execution.

expandArgs
Link copied to clipboard
fun StatementContext.expandArgs(transaction: Transaction): String

Returns the string representation of this context's Statement with its argument values included directly instead of parameter placeholders.

insertValue
Link copied to clipboard
fun <T> insertValue(column: Column<T>): ExpressionWithColumnType<T>