| dbTransaction {MonetDB.R} | R Documentation |
Create, commit or abort a database transaction.
Description
dbTransaction is used to switch the data from the normal auto-commiting mode into transactional mode. Here, changes to the database will not be permanent until dbCommit is called. If the changes are not to be kept around, you can use dbRollback to undo all the changes since dbTransaction was called.
Usage
dbTransaction(conn, ...)
Arguments
conn |
A MonetDB.R database connection. Created using |
... |
Future use. |
Value
Returns TRUE if the transaction command was successful.
Examples
## Not run:
conn <- dbConnect(MonetDB.R(), "monetdb://localhost/acs")
dbSendUpdate(conn, "CREATE TABLE foo(a INT,b VARCHAR(100))")
dbTransaction(conn)
dbSendUpdate(conn, "INSERT INTO foo VALUES(?,?)", 42, "bar")
dbCommit(conn)
dbTransaction(conn)
dbSendUpdate(conn, "INSERT INTO foo VALUES(?,?)", 43, "bar")
dbRollback(conn)
# only 42 will be in table foo
## End(Not run)
[Package MonetDB.R version 2.0.0 Index]