dbSendQuery-methods {RSQLite}R Documentation

Execute a SQL statement on a database connection

Description

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

Methods

conn
a SQLiteConnection object.
statement
a character vector of length one specifying the SQL statement that should be executed. Only a single SQL statment should be provided.
res
a SQLiteResult object.
...
additional parameters.

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

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)


[Package RSQLite version 0.6-9 Index]