connection_with_transaction: Execute code with transaction if not already in one

View source: R/transactions.R

connection_with_transactionR Documentation

Execute code with transaction if not already in one

Description

Similar to db_transaction(), but only starts a new transaction if not already in one. Useful for functions that can be called both standalone and within an existing transaction.

Usage

connection_with_transaction(conn, code)

Arguments

conn

Database connection

code

Expression or code block to execute

Value

The result of the code expression


framework documentation built on Feb. 18, 2026, 1:07 a.m.