getOptional
abstract suspend fun <RowType : Any> getOptional(sql: String, parameters: List<Any?>? = listOf(), mapper: (SqlCursor) -> RowType): RowType?
Executes a read-only (SELECT) query and returns a single optional result.
Return
The single result of the query, or null if no result is found.
Parameters
sql
The SQL query to execute.
parameters
The parameters for the query, or an empty list if none.
mapper
A function to map the result set to the desired type.
Throws
If a database error occurs.
If the operation is cancelled.