with Transaction
Acquires a database connection, runs the function, commits the changes and closes the connection.
If all connections are used, this function blocks until a connection is available.
If getDumpLongTransactions is enabled, a coroutine dump (if available) and a thread dump will be done if the transaction is longer than the threshold.
Supports nesting, but it is not recommended doing so, avoid nesting by returning the data as soon as possible.
Parameters
The function to run with the connection
See also
Acquires a database connection, runs the function, commits the changes and closes the connection.
If all connections are used, this function blocks until a connection is available.
If getDumpLongTransactions is enabled, a coroutine dump (if available) and a thread dump will be done if the transaction is longer than the threshold.
Supports nesting, but it is not recommended doing so, avoid nesting by returning the data as soon as possible.
Parameters
true
if the database only is read from, can allow some optimizations but does not prevent writing
The function to run with the connection