withReadOnlyConnection
internal inline fun <T> withReadOnlyConnection(dbConfig: DbConnectionConfig, dbType: DbType? = null, block: (Connection) -> T): T
Executes the given block with a managed JDBC connection created from DbConnectionConfig.
If DbConnectionConfig.readOnly is true (default), the connection will be:
explicitly marked as read-only
used with auto-commit disabled
rolled back after execution to prevent unintended modifications
This utility guarantees proper closing of the connection and safe rollback in read-only mode. It should be used when the user does not manually manage JDBC connections.
Return
The result of the block execution.
Parameters
dbConfig
The configuration used to create the connection.
dbType
Optional database type (not used here but can be passed through for logging or future extensions).
block
A lambda with receiver that runs with an open and managed java.sql.Connection.