| dbNextResult {RMySQL} | R Documentation |
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.
dbNextResult(con, ...) dbMoreResults(con, ...)
con |
a connection object (see dbConnect). |
... |
any additional arguments to be passed to the dispatched method |
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.
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.
Currently only the MySQL driver implements these methods.
See 'methods?dbNextMethod'.
MySQL
dbConnect
dbSendQuery
fetch
## 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)