DBMS Transaction Management

Share:

Description

Commits or roll backs the current transaction in an Oracle connection

Usage

1
2
3
4
## S4 method for signature 'OraConnection'
dbCommit(conn, ...)
## S4 method for signature 'OraConnection'
dbRollback(conn, ...)

Arguments

conn

a OraConnection object, as produced by the function dbConnect

...

currently unused.

Details

dbCommit

implementation saves all changes done on that connection. Changes can not be undone once saved permanently.

dbRollback

implementation undo all chnages done after last savepoint.

Side Effects

dbCommit

saves changes permanently.

dbRollback

undo all changes done after last save point.

References

For the Oracle Database documentaion see http://www.oracle.com/technetwork/indexes/documentation/index.html.

See Also

Oracle, dbConnect, dbSendQuery, dbGetQuery, fetch, dbCommit, dbGetInfo, dbReadTable.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
  ## Not run: 
    drv <- dbDriver("Oracle")
    con <- dbConnect(drv, "scott", "tiger")
    dbReadTable(con, "EMP")
    rs <- dbSendQuery(con, "delete from emp where deptno = 10")
    dbReadTable(con, "EMP")
    if(dbGetInfo(rs, what = "rowsAffected") > 1)
    {
      warning("dubious deletion -- rolling back transaction")
      dbRollback(con)
    }
    dbReadTable(con, "EMP")
  
## End(Not run)