Description Usage Arguments Details Value Author(s) Examples
Start, commit or rollback transactions or savepoints
1 2 3 4 5 6 7 |
savepoint |
an object produced by |
These functions allow manipulation of database transaction states. If no
savepoint
object is supplied, then an attempt is made to commit or
rollback the current transaction.
The savepoint
function will initiate a transaction if one is not
currently active. In that case, no actual PostgreSQL savepoint will be used.
Rolling back the savepoint will rollback the initiated transaction. If a
tranaction is active, then a named savepoint will be generated. You can
rollback
to the database state when savepoint
was called or commit
all changes.
savepoint
: a savepoint object
Timothy H. Keitt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## Not run:
createdb("rpgtesting")
connect("rpgtesting")
begin()
sp1 = savepoint()
# nest savepoints
sp2 = savepoint()
data(mtcars)
write_table(mtcars, "testtab", overwrite = TRUE)
list_tables()
rollback(sp2)
list_tables()
# nest savepoints
sp3 = savepoint()
sp4 = savepoint()
write_table(mtcars, "testtab", overwrite = TRUE)
commit(sp4)
list_tables()
rollback(sp3)
list_tables()
rollback(sp1)
rollback()
disconnect()
dropdb("rpgtesting")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.