fetch-methods {RMySQL} | R Documentation |
This method is a straight-forward implementation of the corresponding generic function.
The RMySQL
implementations retrieves only n
records,
and if n
is missing it only returns up to fetch.default.rec
as specified in the call to MySQL
(500 by default).
MySQLResult
object.
n = -1
to retrieve all pending records;
use a value of n = 0
for fetching the default number
of rows fetch.default.rec
defined in the
MySQL
initialization invocation.
See the Database Interface definition document
DBI.pdf
in the base directory of this package
or http://stat.bell-labs.com/RS-DBI.
MySQL
,
dbConnect
,
dbSendQuery
,
dbGetQuery
,
dbClearResult
,
dbCommit
,
dbGetInfo
,
dbReadTable
.
## Not run: drv <- dbDriver("MySQL") con <- dbConnect(drv, user = "opto", password="pure-light", host = "localhost", dbname="lasers") res <- dbSendQuery(con, statement = paste( "SELECT w.laser_id, w.wavelength, p.cut_off", "FROM WL w, PURGE P", "WHERE w.laser_id = p.laser_id", "ORDER BY w.laser_id")) # we now fetch the first 100 records from the resultSet into a data.frame data1 <- fetch(res, n = 100) dim(data1) dbHasCompleted(res) # let's get all remaining records data2 <- fetch(res, n = -1) ## End(Not run)