dbNextResult {RMySQL} | R Documentation

## Fetch next result set from an SQL script or stored procedure (experimental)

### Description

Fetches the next result set from the output of a multi-statement SQL script or stored procedure; checkes whether there are additonal result sets to process.

### Usage

    dbNextResult(con, ...)
    dbMoreResults(con, ...)

### Arguments

`con` | a connection object (see `dbConnect`).
`...` | any additional arguments to be passed to the dispatched method

### Details

SQL scripts (i.e., multiple SQL statements separated by ';') and stored procedures oftentimes generate multiple result sets. These DBI generic functions provide a means to process them sequentially.

`dbNextResult` fetches the next result from the sequence of pending results sets; `dbMoreResults` returns a logical to indicate whether there are additional results to process.

### Value

`dbNextResult` returns a result set or `NULL`.
`dbMoreResults` returns a logical specifying whether or not there are additional result sets to process in the connection.

### Note

Currently only the `MySQL` driver implements these methods. See 'methods?dbNextMethod'.

### See Also

`MySQL` `dbConnect` `dbSendQuery` `fetch`

### Examples

    ## Not run:
    rs1 <- dbSendQuery(con,
             paste(
                 "select Agent, ip\_addr, DATA from pseudo\_data order by Agent",
                 "select * from Agent\_name",
                  sep = ";")
             )
    x1 <- fetch(rs1, n = -1)
    if(dbMoreResults(con)){
       rs2 <- dbNextResult(con)
       x2 <- fetch(rs2, n = -1)
    }
    ## End(Not run)

[Package RMySQL version 0.6-0 Index]