transactions: DBMS Transaction Management

Description Usage Arguments Examples

Description

Commits or roll backs the current transaction in an MariaDB connection. Note that in MariaDB DDL statements (e.g. CREATE TABLE) cannot be rolled back.

Usage

1
2
3
4
5
6
7
8
## S4 method for signature 'MariaDBConnection'
dbBegin(conn, ...)

## S4 method for signature 'MariaDBConnection'
dbCommit(conn, ...)

## S4 method for signature 'MariaDBConnection'
dbRollback(conn, ...)

Arguments

conn

a MariaDBConnection object, as produced by DBI::dbConnect().

...

Unused.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
if (mariadbHasDefault()) {
con <- dbConnect(RMariaDB::MariaDB(), dbname = "test")
df <- data.frame(id = 1:5)

dbWriteTable(con, "df", df, temporary = TRUE)
dbBegin(con)
dbExecute(con, "UPDATE df SET id = id * 10")
dbGetQuery(con, "SELECT id FROM df")
dbRollback(con)

dbGetQuery(con, "SELECT id FROM df")

dbDisconnect(con)
}

RMariaDB documentation built on May 7, 2018, 1:03 a.m.