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)
Run the code above in your browser using DataLab