# Statement

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

Base class representing an SQL statement that can be executed.

#### Parameters

type

The specific StatementType, usually represented by the leading word in the command syntax.

targets

Tables on which to perform the SQL statement.

#### Inheritors

AbstractQuery
ExplainQuery
DeleteStatement
InsertSelectStatement
MergeStatement
ReturningStatement
UpdateBuilder

## Constructors

Statement
Link copied to clipboard
constructor(type: StatementType, targets: List<Table>)

## Properties

isAlwaysBatch
Link copied to clipboard
open val isAlwaysBatch: Boolean = false

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

targets
Link copied to clipboard
val targets: List<Table>
type
Link copied to clipboard
val type: StatementType

## Functions

arguments
Link copied to clipboard
abstract fun arguments(): Iterable<Iterable<Pair<IColumnType<*>, Any?>>>

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

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

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.

executeInternal
Link copied to clipboard
abstract fun PreparedStatementApi.executeInternal(transaction: Transaction): T?

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.

prepared
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.

prepareSQL
Link copied to clipboard
abstract fun prepareSQL(transaction: Transaction, prepared: Boolean = true): String

Returns the string representation of an SQL statement.