# Run an SQL statement by creating first a resultSet object
> m <- MySQL()
> con <- dbConnect(m)
> rs <- dbExecStatement(con,
statement = "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")
> rs
MySQLResultSet id = (12629,1,3)
# we now fetch the first 100 records from the restulSet into a data.frame
> data1 <- fetch(rs, n = 100)
> dim(data)
[1] 10 18
> hasCompleted(rs)
[1] 0
# let's get all remaining records
> data2 <- fetch(rs, n = -1)
Run the code above in your browser using DataLab