Last chance! 50% off unlimited learning
Sale ends in
dbSendQuery
only submits and synchronously executes the
SQL query to the database engine. It does not extract any
records --- for that you need to use the function dbFetch
, and
then you must call dbClearResult
when you finish fetching the
records you need. For interactive use, you should almost always prefer
dbGetQuery
.
dbSendQuery(conn, statement, ...)
DBIConnection
object, as produced by
dbConnect
.DBIResult
.
The result set can be used with dbFetch
to extract records.
Once you have finished using a result, make sure to disconnect it
with dbClearResult
.
dbSendQuery
documentation for details.SELECT
queries only. Some backends may
support data manipulation queries through this function for compatibility
reasons. However, callers are strongly advised to use
dbSendStatement
for data manipulation statements.
dbSendStatement
and dbExecute
.Other DBIConnection generics: DBIConnection-class
,
dbDataType
, dbDisconnect
,
dbExecute
, dbExistsTable
,
dbGetException
, dbGetInfo
,
dbGetQuery
, dbIsValid
,
dbListFields
, dbListResults
,
dbListTables
, dbReadTable
,
dbRemoveTable
,
dbSendStatement
con <- dbConnect(RSQLite::SQLite(), ":memory:")
dbWriteTable(con, "mtcars", mtcars)
rs <- dbSendQuery(con, "SELECT * FROM mtcars WHERE cyl = 4;")
dbFetch(rs)
dbClearResult(rs)
dbDisconnect(con)
Run the code above in your browser using DataLab