dbGetQuery

0th

Percentile

Send query, retrieve results and then clear result set.

dbGetQuery comes with a default implementation that calls dbSendQuery, then if dbHasCompleted is TRUE, it uses fetch to return the results. on.exit is used to ensure the result set is always freed by dbClearResult. Subclasses should override this method only if they provide some sort of performance optimisation.

Usage
dbGetQuery(conn, statement, ...)
Arguments
conn
A DBIConnection object, as produced by dbConnect.
statement
a character vector of length 1 containing SQL.
...
Other parameters passed on to methods.
See Also

Other connection methods: dbDisconnect; dbExistsTable; dbGetException; dbListFields; dbListResults; dbListTables; dbReadTable, dbWriteTable; dbRemoveTable; dbSendQuery

Aliases
  • dbGetQuery
  • dbGetQuery,DBIConnection,character-method
Examples
if (require("RSQLite")) {
con <- dbConnect(RSQLite::SQLite(), ":memory:")

dbWriteTable(con, "mtcars", mtcars)
res <- dbSendQuery(con, "SELECT * FROM mtcars WHERE cyl = 4;")
dbFetch(res)
dbClearResult(res)

dbDisconnect(con)
}
Documentation reproduced from package DBI, version 0.3.0, License: LGPL (>= 2)

Community examples

Looks like there are no examples yet.