# exec

suspend fun exec(stmt: String, args: Iterable<Pair<IColumnType<*>, Any?>> = emptyList(), explicitStatementType: StatementType? = null)

Executes the provided statement exactly, using the supplied args to set values to question mark placeholders (if applicable).

The explicitStatementType can be manually set to avoid iterating over StatementType values for the best match.

suspend fun <T : Any> exec(stmt: String, args: Iterable<Pair<IColumnType<*>, Any?>> = emptyList(), explicitStatementType: StatementType? = null, transform: (Row) -> T?): Flow<T?>?

Executes the provided statement exactly, using the supplied args to set values to question mark placeholders (if applicable).

The explicitStatementType can be manually set to avoid iterating over StatementType values for the best match.

#### Return

The result of transform on the Row generated by the statement execution, or `null` if no Row was returned by the database.

suspend fun <T> exec(stmt: SuspendExecutable<T, *>): T?

Executes the provided Statement object and returns the generated value.

This function also updates its calling R2dbcTransaction instance's statement count and overall duration, as well as whether the execution time for stmt exceeds the threshold set by `R2dbcDatabaseConfig.warnLongQueriesDuration`. If debug is set to `true`, these tracked values are stored for each call in statementStats.

suspend fun <T, R> exec(stmt: SuspendExecutable<T, *>, body: suspend Statement<T>.(T) -> R): R?

Executes the provided Statement object, retrieves the generated value, then calls the specified function body with this generated value as its argument and returns its result.

This function also updates its calling R2dbcTransaction instance's statement count and overall duration, as well as whether the execution time for stmt exceeds the threshold set by R2dbcDatabaseConfig.warnLongQueriesDuration. If debug is set to `true`, these tracked values are stored for each call in statementStats.