R: DBIConnection transaction methods are not supported for Pool...

DBI-connection-transaction {pool} | R Documentation

## DBIConnection transaction methods are not supported for Pool objects.

### Description

You cannot perform SQL transaction using a Pool object directly (because that would imply keeping a connection open and not knowing when to return it back to the pool).

### Usage

    ## S4 method for signature 'Pool'
    dbBegin(conn, ...)

    ## S4 method for signature 'Pool'
    dbCommit(conn, ...)

    ## S4 method for signature 'Pool'
    dbRollback(conn, ...)

    ## S4 method for signature 'Pool'
    dbWithTransaction(conn, code)

### Arguments

`conn, ..., code` | See `transactions`.

### Details

If you must use these methods, fetch an actual connection first with `conn <- poolCheckout(pool)` – then call the appropriate DBI method on `conn`. Since you're fetching a connection from the pool yourself, you must also remember to return it back to the pool when you're done: `poolReturn(conn)` (otherwise, you have a leaked connection).

For simple transactions, consider using `poolWithTransaction` instead, which is safer since it does not require you to fetch and release the connection yourself.

See `transactions` for the original documentation.

[Package pool version 0.1.4.1 Index]