# NOT RUN {
library(DBI)
db <- RSQLite::datasetsDb()
rs <- dbSendQuery(db, "SELECT * FROM USArrests WHERE UrbanPop >= 80")
dbGetStatement(rs)
dbColumnInfo(rs)
dbHasCompleted(rs)
dbGetRowCount(rs)
dbFetch(rs, n = 2)
dbHasCompleted(rs)
dbGetRowCount(rs)
invisible(dbFetch(rs))
dbHasCompleted(rs)
dbGetRowCount(rs)
dbClearResult(rs)
dbDisconnect(db)
con <- dbConnect(RSQLite::SQLite(), ":memory:")
dbExecute(con, "CREATE TABLE test (a INTEGER)")
rs <- dbSendStatement(con, "INSERT INTO test VALUES (:a)", list(a = 1:3))
dbGetRowsAffected(rs)
dbClearResult(rs)
dbDisconnect(con)
# }
Run the code above in your browser using DataLab