transactions

0th

Percentile

Begin/commit/rollback SQL transactions

Not all database engines implement transaction management, in which case these methods should not be implemented for the specific DBIConnection subclass.

Usage
dbBegin(conn, ...)

dbCommit(conn, ...)

dbRollback(conn, ...)

Arguments
conn
A DBIConnection object, as produced by dbConnect.
...
Other parameters passed on to methods.
Value

  • a logical indicating whether the operation succeeded or not.

Side Effects

The current transaction on the connections con is committed or rolled back.

Aliases
  • dbBegin
  • dbCommit
  • dbRollback
  • transactions
Examples
ora <- dbDriver("Oracle")
con <- dbConnect(ora)
rs <- dbSendQuery(con,
      "delete * from PURGE as p where p.wavelength<0.03")
if(dbGetInfo(rs, what = "rowsAffected") > 250){
  warning("dubious deletion -- rolling back transaction")
  dbRollback(con)
}
Documentation reproduced from package DBI, version 0.3.0, License: LGPL (>= 2)

Community examples

Looks like there are no examples yet.