transact_sql | R Documentation |
A transaction allows SQL operations to be batched, such that either all operations are applied or none are. In the jargon, the entire transaction is either committed or rolled back. This is useful to ensure database consistency, without the risk of partial changes caused by unexpected errors in the middle of an operation.
transact_sql(fun, ...)
break_sql()
fun |
A function which contains all desired SQL operations |
... |
Arguments passed to |
transact_sql()
calls fun()
within a transaction. There are three possible
outcomes:
if the function returns successfully, then the transaction is committed;
if an error is thrown, then the transaction is rolled back and the error is propagated so that it may be handled elsewhere;
if break_sql()
is called withn fun()
, then fun()
is interrupted and
the transaction is rolled back, but no error is thrown and the program may
proceed as normal.
If break_sql()
is called outside of a function passed to transact_sql()
,
it will throw an error.
Returns the value returned by fun()
, or NULL
if break_sql()
was called.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.