if (FALSE) {
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, user = "ruser",password = "123456",dbname = "status")
res <- dbSendQuery(con, statement = paste(
"SELECT w.category, w.cost, p.type",
"FROM items w, sales P",
"WHERE w.category = p.type",
"ORDER BY w.cost"))
# 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