queryForScalar

fun <T : Any> queryForScalar(connection: Connection, sql: String, parametersDto: Any?): T?

Get value of the first column of the first row of ResultSet. The statement is closed after this method returns.

Return

the value or null of ResultSet doesn't have any rows

Parameters

connection

a Jdbc Connection

sql

a sql string with named parameters

parametersDto

a data object to set the parameters, or null if the statement doesn't have any parameters