# NOT RUN {
# initialize a new database to a tempfile and copy some data.frame
# from the base package into it
con <- dbConnect(SQLite(), ":memory:")
data(USArrests)
dbWriteTable(con, "USArrests", USArrests)
# query
rs <- dbSendQuery(con, "select * from USArrests")
d1 <- fetch(rs, n = 10) # extract data in chunks of 10 rows
dbHasCompleted(rs)
d2 <- fetch(rs, n = -1) # extract all remaining data
dbHasCompleted(rs)
dbClearResult(rs)
dbListTables(con)
# clean up
dbDisconnect(con)
# }
Run the code above in your browser using DataLab