RSQLite (version 0.4-13)

fetch-methods: Fetch records from a previously executed query

Description

This method is a straight-forward implementation of the corresponding generic function.

Arguments

Details

The RSQLite implementations retrieves all records into a buffer internally managed by the RSQLite driver (thus this memory in not managed by R but its part of the R process), and fetch simple returns records from this internal buffer.

References

See the Database Interface definition document DBI.pdf in the base directory of this package or http://stat.bell-labs.com/RS-DBI.

See Also

SQLite, dbConnect, dbSendQuery, dbGetQuery, dbClearResult, dbCommit, dbGetInfo, dbReadTable.

Examples

Run this code
drv <- dbDriver("SQLite")
con <- dbConnect(drv, dbname = "sqlite.db")
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 DataCamp Workspace