dbWithTransaction_or_Savepoint: Self-contained SQL commands within new transactions or...

Description Usage Arguments Value

View source: R/db_write.R

Description

The function dbWithTransaction_or_Savepoint() starts a new transaction or issues a savepoint via dbBegin_or_Savepoint(). If the execution of the code argument fails, the state will be committed or the savepoint removed via dbCommit_or_Savepoint(). Otherwise, the transaction is rollbacked completely or up until the savepoint via dbRollback_or_Savepoint(). The functions work similiarly to dbWithTransaction(), dbBegin(), dbCommit() or dbRollback(), respectively, but allow to be nested by using savepoints if necessary.

Usage

1
2
3
4
5
6
7
dbBegin_or_Savepoint(conn, spname)

dbCommit_or_Savepoint(conn, transaction, spname)

dbRollback_or_Savepoint(conn, transaction, spname)

dbWithTransaction_or_Savepoint(conn, code, spname)

Arguments

conn

Database connection.

spname

String of the possibly required savpoint.

transaction

Use standard transactions or use Savepoints?

code

An arbitrary block of R code.

Value

dbWithTransaction_or_Savepoint() returns the value of the executed code.


sebschub/klimageodb documentation built on Sept. 25, 2021, 4:16 p.m.