fetch-methods

0th

Percentile

Fetch records from a previously executed query

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

Keywords
methods, interface, database
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.

Aliases
  • fetch-methods
  • fetch,SQLiteResult,numeric-method
  • fetch,SQLiteResult-method
Examples
drv <- dbDriver("SQLite")
tfile <- tempfile()
con <- dbConnect(drv, dbname = tfile)
data(USJudgeRatings)
dbWriteTable(con, "jratings", USJudgeRatings)

res <- dbSendQuery(con, statement = paste(
                      "SELECT row_names, ORAL, DILG, FAMI",
                      "FROM jratings"))

# we now fetch the first 10 records from the resultSet into a data.frame
data1 <- fetch(res, n = 10)   
dim(data1)

dbHasCompleted(res)

# let's get all remaining records
data2 <- fetch(res, n = -1)

dbClearResult(res)
dbDisconnect(con)
Documentation reproduced from package RSQLite, version 0.6-7, License: LGPL (>= 2)

Community examples

Looks like there are no examples yet.