English | 简体中文

api-docs / org.ktorm.dsl / QueryRowSet

QueryRowSet

class QueryRowSet : CachedRowSet (source code)

Special implementation of ResultSet, used to hold the Query results for Ktorm.

Different from normal result sets, this class provides additional features:

  • Available offline: It’s connection independent, it remains available after the connection closed, and it’s
    not necessary to be closed after being used. Ktorm creates QueryRowSet objects with all data being retrieved from
    the result set into memory, so we just need to wait for GC to collect them after they are not useful.
  • Indexed access operator: It overloads the indexed access operator, so we can use square brackets [] to obtain the value by giving a specific Column instance. It’s less error-prone by the benefit of the compiler’s static checking. Also, we can still use getXxx functions in the ResultSet to obtain our results by labels or column indices.
val query = database.from(Employees).select()
for (row in query.rowSet) {
    println(row[Employees.name])
}

Properties

NameSummary

query

val query: Query

Functions

NameSummary

get

operator fun <C : Any> get(column: Column<C>): C?

Obtain the value of the specific Column instance.

operator fun <C : Any> get(
    column: ColumnDeclaringExpression<C>
): C?

Obtain the value of the specific ColumnDeclaringExpression instance.

hasColumn

fun hasColumn(column: Column<*>): Boolean

fun hasColumn(column: ColumnDeclaringExpression<*>): Boolean

Check if the specific Column exists in this result set.

Inherited Functions

NameSummary

absolute

open fun absolute(row: Int): Boolean

afterLast

open fun afterLast(): Unit

beforeFirst

open fun beforeFirst(): Unit

cancelRowUpdates

open fun cancelRowUpdates(): Nothing

clearWarnings

open fun clearWarnings(): Unit

close

open fun close(): Unit

deleteRow

open fun deleteRow(): Nothing

findColumn

open fun findColumn(columnLabel: String): Int

first

open fun first(): Boolean

getArray

open fun getArray(columnIndex: Int): Array?

open fun getArray(columnLabel: String): Array?

getAsciiStream

open fun getAsciiStream(columnIndex: Int): InputStream?

open fun getAsciiStream(columnLabel: String): InputStream?

getBigDecimal

open fun getBigDecimal(
    columnIndex: Int,
    scale: Int
): BigDecimal?

open fun getBigDecimal(
    columnLabel: String,
    scale: Int
): BigDecimal?

open fun getBigDecimal(columnIndex: Int): BigDecimal?

open fun getBigDecimal(columnLabel: String): BigDecimal?

getBinaryStream

open fun getBinaryStream(columnIndex: Int): InputStream?

open fun getBinaryStream(columnLabel: String): InputStream?

getBlob

open fun getBlob(columnIndex: Int): Blob?

open fun getBlob(columnLabel: String): Blob?

getBoolean

open fun getBoolean(columnIndex: Int): Boolean

open fun getBoolean(columnLabel: String): Boolean

getByte

open fun getByte(columnIndex: Int): Byte

open fun getByte(columnLabel: String): Byte

getBytes

open fun getBytes(columnIndex: Int): ByteArray?

open fun getBytes(columnLabel: String): ByteArray?

getCharacterStream

open fun getCharacterStream(columnIndex: Int): Reader?

open fun getCharacterStream(columnLabel: String): Reader?

getClob

open fun getClob(columnIndex: Int): Clob?

open fun getClob(columnLabel: String): Clob?

getConcurrency

open fun getConcurrency(): Int

getCursorName

open fun getCursorName(): Nothing

getDate

open fun getDate(columnIndex: Int): Date?

open fun getDate(columnLabel: String): Date?

open fun getDate(columnIndex: Int, cal: Calendar): Date?

open fun getDate(columnLabel: String, cal: Calendar): Date?

getDouble

open fun getDouble(columnIndex: Int): Double

open fun getDouble(columnLabel: String): Double

getFetchDirection

open fun getFetchDirection(): Int

getFetchSize

open fun getFetchSize(): Int

getFloat

open fun getFloat(columnIndex: Int): Float

open fun getFloat(columnLabel: String): Float

getHoldability

open fun getHoldability(): Int

getInstant

fun getInstant(columnIndex: Int): Instant?

fun getInstant(columnLabel: String): Instant?

Retrieve the value of the designated column in the current row of this row set object as a java.time.Instant object in the Java programming language.

getInt

open fun getInt(columnIndex: Int): Int

open fun getInt(columnLabel: String): Int

getLocalDate

fun getLocalDate(columnIndex: Int): LocalDate?

fun getLocalDate(columnLabel: String): LocalDate?

Retrieve the value of the designated column in the current row of this row set object as a java.time.LocalDate object in the Java programming language.

getLocalDateTime

fun getLocalDateTime(columnIndex: Int): LocalDateTime?

fun getLocalDateTime(columnLabel: String): LocalDateTime?

Retrieve the value of the designated column in the current row of this row set object as a java.time.LocalDateTime object in the Java programming language.

getLocalTime

fun getLocalTime(columnIndex: Int): LocalTime?

fun getLocalTime(columnLabel: String): LocalTime?

Retrieve the value of the designated column in the current row of this row set object as a java.time.LocalTime object in the Java programming language.

getLong

open fun getLong(columnIndex: Int): Long

open fun getLong(columnLabel: String): Long

getMetaData

open fun getMetaData(): ResultSetMetaData

getNCharacterStream

open fun getNCharacterStream(columnIndex: Int): Reader?

open fun getNCharacterStream(columnLabel: String): Reader?

getNClob

open fun getNClob(columnIndex: Int): Nothing

open fun getNClob(columnLabel: String?): Nothing

getNString

open fun getNString(columnIndex: Int): String?

open fun getNString(columnLabel: String): String?

getObject

open fun getObject(columnIndex: Int): Any?

open fun getObject(columnLabel: String): Any?

open fun getObject(
    columnIndex: Int,
    map: Map<String, Class<*>>
): Any?

open fun getObject(
    columnLabel: String,
    map: Map<String, Class<*>>
): Any?

open fun <T : Any> getObject(
    columnIndex: Int,
    type: Class<T>
): T?

open fun <T : Any> getObject(
    columnLabel: String,
    type: Class<T>
): T?

getRef

open fun getRef(columnIndex: Int): Ref?

open fun getRef(columnLabel: String): Ref?

getRow

open fun getRow(): Int

getRowId

open fun getRowId(columnIndex: Int): Nothing

open fun getRowId(columnLabel: String?): Nothing

getShort

open fun getShort(columnIndex: Int): Short

open fun getShort(columnLabel: String): Short

getSQLXML

open fun getSQLXML(columnIndex: Int): Nothing

open fun getSQLXML(columnLabel: String?): Nothing

getStatement

open fun getStatement(): Statement?

getString

open fun getString(columnIndex: Int): String?

open fun getString(columnLabel: String): String?

getTime

open fun getTime(columnIndex: Int): Time?

open fun getTime(columnLabel: String): Time?

open fun getTime(columnIndex: Int, cal: Calendar): Time?

open fun getTime(columnLabel: String, cal: Calendar): Time?

getTimestamp

open fun getTimestamp(columnIndex: Int): Timestamp?

open fun getTimestamp(columnLabel: String): Timestamp?

open fun getTimestamp(
    columnIndex: Int,
    cal: Calendar
): Timestamp?

open fun getTimestamp(
    columnLabel: String,
    cal: Calendar
): Timestamp?

getType

open fun getType(): Int

getUnicodeStream

open fun getUnicodeStream(columnIndex: Int): InputStream?

open fun getUnicodeStream(columnLabel: String): InputStream?

getURL

open fun getURL(columnIndex: Int): URL?

open fun getURL(columnLabel: String): URL?

getWarnings

open fun getWarnings(): SQLWarning?

insertRow

open fun insertRow(): Nothing

isAfterLast

open fun isAfterLast(): Boolean

isBeforeFirst

open fun isBeforeFirst(): Boolean

isClosed

open fun isClosed(): Boolean

isFirst

open fun isFirst(): Boolean

isLast

open fun isLast(): Boolean

isWrapperFor

open fun isWrapperFor(iface: Class<*>): Boolean

last

open fun last(): Boolean

moveToCurrentRow

open fun moveToCurrentRow(): Nothing

moveToInsertRow

open fun moveToInsertRow(): Nothing

next

open fun next(): Boolean

previous

open fun previous(): Boolean

refreshRow

open fun refreshRow(): Nothing

relative

open fun relative(rows: Int): Boolean

rowDeleted

open fun rowDeleted(): Nothing

rowInserted

open fun rowInserted(): Nothing

rowUpdated

open fun rowUpdated(): Nothing

setFetchDirection

open fun setFetchDirection(direction: Int): Unit

setFetchSize

open fun setFetchSize(rows: Int): Unit

size

fun size(): Int

Return the number of rows in this row set.

unwrap

open fun <T : Any> unwrap(iface: Class<T>): T

updateArray

open fun updateArray(columnIndex: Int, x: Array?): Nothing

open fun updateArray(
    columnLabel: String?,
    x: Array?
): Nothing

updateAsciiStream

open fun updateAsciiStream(
    columnIndex: Int,
    x: InputStream?,
    length: Int
): Nothing

open fun updateAsciiStream(
    columnLabel: String?,
    x: InputStream?,
    length: Int
): Nothing

open fun updateAsciiStream(
    columnIndex: Int,
    x: InputStream?,
    length: Long
): Nothing

open fun updateAsciiStream(
    columnLabel: String?,
    x: InputStream?,
    length: Long
): Nothing

open fun updateAsciiStream(
    columnIndex: Int,
    x: InputStream?
): Nothing

open fun updateAsciiStream(
    columnLabel: String?,
    x: InputStream?
): Nothing

updateBigDecimal

open fun updateBigDecimal(
    columnIndex: Int,
    x: BigDecimal?
): Nothing

open fun updateBigDecimal(
    columnLabel: String?,
    x: BigDecimal?
): Nothing

updateBinaryStream

open fun updateBinaryStream(
    columnIndex: Int,
    x: InputStream?,
    length: Int
): Nothing

open fun updateBinaryStream(
    columnLabel: String?,
    x: InputStream?,
    length: Int
): Nothing

open fun updateBinaryStream(
    columnIndex: Int,
    x: InputStream?,
    length: Long
): Nothing

open fun updateBinaryStream(
    columnLabel: String?,
    x: InputStream?,
    length: Long
): Nothing

open fun updateBinaryStream(
    columnIndex: Int,
    x: InputStream?
): Nothing

open fun updateBinaryStream(
    columnLabel: String?,
    x: InputStream?
): Nothing

updateBlob

open fun updateBlob(columnIndex: Int, x: Blob?): Nothing

open fun updateBlob(columnLabel: String?, x: Blob?): Nothing

open fun updateBlob(
    columnIndex: Int,
    inputStream: InputStream?,
    length: Long
): Nothing

open fun updateBlob(
    columnLabel: String?,
    inputStream: InputStream?,
    length: Long
): Nothing

open fun updateBlob(
    columnIndex: Int,
    inputStream: InputStream?
): Nothing

open fun updateBlob(
    columnLabel: String?,
    inputStream: InputStream?
): Nothing

updateBoolean

open fun updateBoolean(columnIndex: Int, x: Boolean): Nothing

open fun updateBoolean(
    columnLabel: String?,
    x: Boolean
): Nothing

updateByte

open fun updateByte(columnIndex: Int, x: Byte): Nothing

open fun updateByte(columnLabel: String?, x: Byte): Nothing

updateBytes

open fun updateBytes(
    columnIndex: Int,
    x: ByteArray?
): Nothing

open fun updateBytes(
    columnLabel: String?,
    x: ByteArray?
): Nothing

updateCharacterStream

open fun updateCharacterStream(
    columnIndex: Int,
    x: Reader?,
    length: Int
): Nothing

open fun updateCharacterStream(
    columnLabel: String?,
    reader: Reader?,
    length: Int
): Nothing

open fun updateCharacterStream(
    columnIndex: Int,
    x: Reader?,
    length: Long
): Nothing

open fun updateCharacterStream(
    columnLabel: String?,
    reader: Reader?,
    length: Long
): Nothing

open fun updateCharacterStream(
    columnIndex: Int,
    x: Reader?
): Nothing

open fun updateCharacterStream(
    columnLabel: String?,
    reader: Reader?
): Nothing

updateClob

open fun updateClob(columnIndex: Int, x: Clob?): Nothing

open fun updateClob(columnLabel: String?, x: Clob?): Nothing

open fun updateClob(
    columnIndex: Int,
    reader: Reader?,
    length: Long
): Nothing

open fun updateClob(
    columnLabel: String?,
    reader: Reader?,
    length: Long
): Nothing

open fun updateClob(
    columnIndex: Int,
    reader: Reader?
): Nothing

open fun updateClob(
    columnLabel: String?,
    reader: Reader?
): Nothing

updateDate

open fun updateDate(columnIndex: Int, x: Date?): Nothing

open fun updateDate(columnLabel: String?, x: Date?): Nothing

updateDouble

open fun updateDouble(columnIndex: Int, x: Double): Nothing

open fun updateDouble(
    columnLabel: String?,
    x: Double
): Nothing

updateFloat

open fun updateFloat(columnIndex: Int, x: Float): Nothing

open fun updateFloat(columnLabel: String?, x: Float): Nothing

updateInt

open fun updateInt(columnIndex: Int, x: Int): Nothing

open fun updateInt(columnLabel: String?, x: Int): Nothing

updateLong

open fun updateLong(columnIndex: Int, x: Long): Nothing

open fun updateLong(columnLabel: String?, x: Long): Nothing

updateNCharacterStream

open fun updateNCharacterStream(
    columnIndex: Int,
    x: Reader?,
    length: Long
): Nothing

open fun updateNCharacterStream(
    columnLabel: String?,
    reader: Reader?,
    length: Long
): Nothing

open fun updateNCharacterStream(
    columnIndex: Int,
    x: Reader?
): Nothing

open fun updateNCharacterStream(
    columnLabel: String?,
    reader: Reader?
): Nothing

updateNClob

open fun updateNClob(
    columnIndex: Int,
    nClob: NClob?
): Nothing

open fun updateNClob(
    columnLabel: String?,
    nClob: NClob?
): Nothing

open fun updateNClob(
    columnIndex: Int,
    reader: Reader?,
    length: Long
): Nothing

open fun updateNClob(
    columnLabel: String?,
    reader: Reader?,
    length: Long
): Nothing

open fun updateNClob(
    columnIndex: Int,
    reader: Reader?
): Nothing

open fun updateNClob(
    columnLabel: String?,
    reader: Reader?
): Nothing

updateNString

open fun updateNString(
    columnIndex: Int,
    nString: String?
): Nothing

open fun updateNString(
    columnLabel: String?,
    nString: String?
): Nothing

updateNull

open fun updateNull(columnIndex: Int): Nothing

open fun updateNull(columnLabel: String?): Nothing

updateObject

open fun updateObject(
    columnIndex: Int,
    x: Any?,
    scaleOrLength: Int
): Nothing

open fun updateObject(columnIndex: Int, x: Any?): Nothing

open fun updateObject(
    columnLabel: String?,
    x: Any?,
    scaleOrLength: Int
): Nothing

open fun updateObject(columnLabel: String?, x: Any?): Nothing

open fun updateObject(
    columnIndex: Int,
    x: Any?,
    targetSqlType: SQLType?,
    scaleOrLength: Int
): Nothing

open fun updateObject(
    columnLabel: String?,
    x: Any?,
    targetSqlType: SQLType?,
    scaleOrLength: Int
): Nothing

open fun updateObject(
    columnIndex: Int,
    x: Any?,
    targetSqlType: SQLType?
): Nothing

open fun updateObject(
    columnLabel: String?,
    x: Any?,
    targetSqlType: SQLType?
): Nothing

updateRef

open fun updateRef(columnIndex: Int, x: Ref?): Nothing

open fun updateRef(columnLabel: String?, x: Ref?): Nothing

updateRow

open fun updateRow(): Nothing

updateRowId

open fun updateRowId(columnIndex: Int, x: RowId?): Nothing

open fun updateRowId(
    columnLabel: String?,
    x: RowId?
): Nothing

updateShort

open fun updateShort(columnIndex: Int, x: Short): Nothing

open fun updateShort(columnLabel: String?, x: Short): Nothing

updateSQLXML

open fun updateSQLXML(
    columnIndex: Int,
    xmlObject: SQLXML?
): Nothing

open fun updateSQLXML(
    columnLabel: String?,
    xmlObject: SQLXML?
): Nothing

updateString

open fun updateString(columnIndex: Int, x: String?): Nothing

open fun updateString(
    columnLabel: String?,
    x: String?
): Nothing

updateTime

open fun updateTime(columnIndex: Int, x: Time?): Nothing

open fun updateTime(columnLabel: String?, x: Time?): Nothing

updateTimestamp

open fun updateTimestamp(
    columnIndex: Int,
    x: Timestamp?
): Nothing

open fun updateTimestamp(
    columnLabel: String?,
    x: Timestamp?
): Nothing

wasNull

open fun wasNull(): Boolean

Extension Functions

NameSummary

asIterable

fun <T : ResultSet> T.asIterable(): Iterable<T>

Wrap this ResultSet as Iterable.

eq

infix fun <T : Any> T.eq(
    expr: ColumnDeclaring<T>
): BinaryExpression<Boolean>

Equal operator, translated to = in SQL.

iterator

operator fun <T : ResultSet> T.iterator(): Iterator<T>

Return an iterator over the rows of this ResultSet.

neq

infix fun <T : Any> T.neq(
    expr: ColumnDeclaring<T>
): BinaryExpression<Boolean>

Not-equal operator, translated to <> in SQL.

notEq

infix fun <T : Any> T.notEq(
    expr: ColumnDeclaring<T>
): BinaryExpression<Boolean>

Not-equal operator, translated to <> in SQL.

use

fun <T : AutoCloseable?, R> T.use(block: (T) -> R): R

Execute the given block function on this resource and then close it down correctly whether an exception is thrown or not.