execute

fun execute(params: Map<String, Any?>): DataResult<Int>

Executes a modifying query (without RETURNING) and returns the number of affected rows. Throws an exception if a RETURNING clause was used - in that case, use toList(), toSingle(), etc. methods instead.


protected fun <R> execute(sql: String, params: Map<String, Any?>, action: (positionalSql: String, positionalParams: List<Any?>) -> DataResult<R>): DataResult<R>

Generic function for executing queries, wrapping logic in error handling, type conversion, and logging.

Return

Operation result as DataResult.

Parameters

sql

SQL query to execute.

params

Parameter map.

action

Lambda that will be executed with the prepared query and parameters.