db9010 / com.jovial.db9010 / SelectQuery

SelectQuery

class SelectQuery : ResultsHolder, ParameterSetter

An SQL select query. See Database.select.

Types

Builder

A builder for a SelectQuery. See Database.select.

class Builder : TextStatementBuilder<Key>

Key

Key used for caching select queries by Database.

data class Key

Functions

delete

Delete the currently selected row. The query must have been marked as FOR UPDATE with Builder.forUpdate

fun delete(): Unit

insert

Insert a new row with the values set in body, using the TableColumn setters of this query. The query must have been marked as FOR UPDATE with Builder.forUpdate

fun insert(body: () -> Unit): Unit

insertFromJson

Insert a new row with the values set by jsonValue, using setFromJson. The query must have been marked as FOR UPDATE with Builder.forUpdate See also Types.sqlObject.

fun insertFromJson(jsonValue: Map<String, Any?>): Unit

next

Move the select cursor to the next row in the query. Gives true if there is a next row, false otherwise. See ResultSet.next.

fun next(): Boolean

nextOrFail

Move the select cursor to the next row, or fail with an IllegalStateException if there is not a next row. See next.

fun nextOrFail(): Unit

set

Update the column c with a new value. The update is written to the database with update. The query must have been marked as FOR UPDATE with Builder.forUpdate

operator fun <T> set(c: TableColumn<in T>, value: T): Unit

setFromJson

Update the columns named in the JSON-friendly jsonValue's keys to their corresponding values. See also Types.sqlObject. The query must have been marked as FOR UPDATE with Builder.forUpdate

fun setFromJson(jsonValue: Map<String, Any?>): Unit

setFromLambda

Set the given parameter p, using a code block that operates on a JDBC PreparedStatement using the provided value index.

fun <T> setFromLambda(p: Parameter<in T>, setter: (Int, PreparedStatement) -> Unit): Unit

Update the column c with a new value, using a code body that takes a ResultSet and a column index. The update is written to the database with update. The query must have been marked as FOR UPDATE with Builder.forUpdate

fun <T> setFromLambda(c: TableColumn<in T>, body: (ResultSet, Int) -> Unit): Unit

update

Update the currently selected row. with values set by this query's TableColumn setters. The query must have been marked as FOR UPDATE with Builder.forUpdate

fun update(): Unit