dbSendQuery-methods

0th

Percentile

Execute a SQL statement on a database connection

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

Keywords
methods, interface, database
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.

Aliases
  • dbSendQuery-methods
  • dbGetQuery-methods
  • dbSendPreparedQuery
  • dbGetPreparedQuery
  • dbSendPreparedQuery-methods
  • dbGetPreparedQuery-methods
  • dbGetException-methods
  • dbSendQuery,SQLiteConnection,character-method
  • dbGetQuery,SQLiteConnection,character-method
  • dbSendPreparedQuery,SQLiteConnection,character,data.frame-method
  • dbGetPreparedQuery,SQLiteConnection,character,data.frame-method
  • dbClearResult,SQLiteResult-method
  • dbGetException,SQLiteConnection-method
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)
Documentation reproduced from package RSQLite, version 0.6-7, License: LGPL (>= 2)

Community examples

Looks like there are no examples yet.