QueryRowSet
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])
}
Functions
Get generated key from the row set.
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.
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.
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.
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.