Learn R Programming

RMySQL (version 0.4-6)

commit: RDBMS Transaction Management

Description

Commit/rollback SQL transactions

Usage

commit(con, ...)

rollback(con, ...)

Arguments

con
a dbConnection object, as produced by the function dbConnect.
...
any database-specific arguments.

Value

  • NULL

Side Effects

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

Details

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

References

See The Omega Project for Statistical Computing (http://www.omegahat.org) for more details on the R/S database interface.

See Also

On database managers:

dbManager MySQL load unload

On connections, SQL statements and resultSets:

dbExecStatement dbExec fetch quickSQL

On transaction management:

commit rollback

On meta-data:

describe getVersion getDatabases getTables getFields getCurrentDatabase getTableIndices getException getStatement hasCompleted getRowCount getAffectedRows getNullOk getInfo

Examples

Run this code
ora <- Oracle()
con <- dbConnect(ora)
rs <- dbExecStatement(con, 
      "delete * from PURGE as p where p.wavelength<0.03")
if(rowsAffected(rs) > 250){
  warning("dubious deletion -- rolling back transaction")
  rollback(con)
}

Run the code above in your browser using DataLab