ResultQuery
The same query, with every terminal handing back a DataResult instead of throwing.
Reached by RunnableQuery.asResult and equivalent to wrapping the call in dbResult - the same boundary, the same classification, the same failures let through. What it changes is only the shape at the call site: a chain stays a chain rather than being indented inside a lambda, which is worth something once a builder has put four calls in front of the terminal.
val senators = db.rawQuery("SELECT id, cognomen FROM senate WHERE province_id = @p")
.asResult()
.fetchObjects<Senator>("p" to 7)dbResult { } is still what to reach for around anything wider than one query - a whole unit of work, a db.execute { } block, a RawQuery.execute(). Around a transaction reach for neither: use transactionResult, which rolls back on a failure rather than committing over one.
Functions
As RunnableQuery.fetchField - a non-nullable T over a missing row is still thrown.
As RunnableQuery.fetchObjectStrict - which means a missing row is still thrown, not returned.
As RunnableQuery.fetchRowStrict - which means a missing row is still thrown, not returned.
As RunnableQuery.toSql - the rendered SQL, for embedding in a larger statement or for a log line.