spec_transaction_with_transaction
Source:R/spec-transaction-with-transaction.R
spec_transaction_with_transaction.Rd
spec_transaction_with_transaction
Failure modes
Failure to initiate the transaction
(e.g., if the connection is closed
or invalid
of if DBI::dbBegin()
has been called already)
gives an error.
Specification
dbWithTransaction()
initiates a transaction with dbBegin()
, executes
the code given in the code
argument, and commits the transaction with
DBI::dbCommit()
.
If the code raises an error, the transaction is instead aborted with
DBI::dbRollback()
, and the error is propagated.
If the code calls dbBreak()
, execution of the code stops and the
transaction is silently aborted.
All side effects caused by the code
(such as the creation of new variables)
propagate to the calling environment.
See also
Other transaction specifications:
spec_transaction_begin_commit_rollback