RSQLite (version 0.7-0)

dbSendQuery-methods: Execute a SQL statement on a database connection

Description

These are the primary methods for interacting with a database via SQL queries.

Arguments

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, dbDriver, dbConnect, fetch, dbCommit, dbGetInfo, dbReadTable.

Examples

Run this code
con <- dbConnect(SQLite(), ":memory:")
data(USArrests)
dbWriteTable(con, "arrests", USArrests)

res <- dbSendQuery(con, "SELECT * from arrests")
data <- fetch(res, n = 2)
data
dbClearResult(res)

dbGetQuery(con, "SELECT * from arrests limit 3")

tryCatch(dbGetQuery(con, "SELECT * FROM tableDoesNotExist"),
         error=function(e) { print("caught") })
dbGetException(con)

Run the code above in your browser using DataCamp Workspace