dbCommit-methods

0th

Percentile

DBMS Transaction Management

Commit/rollback SQL transactions

Keywords
methods, interface, database
Usage
dbCommit(conn, ...)
  dbRollback(conn, ...)
Arguments
conn
a DBIConnection object, as produced by the function dbConnect.
...
any database-specific arguments.
Details

Not all database engines implement transaction management, older versions of MySQL, for instance.

Value

  • a logical indicating whether the operation succeeded or not.

Side Effects

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

References

See the Database Interface definition document DBI.pdf in the base directory of this package or http://developer.r-project.org/db.

See Also

dbConnect dbSendQuery dbGetQuery fetch dbCommit dbGetInfo dbReadTable

Aliases
  • dbCommit
  • dbRollback
  • dbCommit-methods
  • dbRollback-methods
  • dbCommit,DBIConnection-method
  • dbRollback,DBIConnection-method
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.1-10, License: GPL (version 2 or later)

Community examples

Looks like there are no examples yet.