Returns the statement that was passed to dbSendQuery()
or dbSendStatement()
.
Methods in other packages
This documentation page describes the generics. Refer to the documentation pages linked below for the documentation for the methods that are implemented in various backend packages.
DatabaseConnector::dbGetStatement("DatabaseConnectorDbiResult")
DatabaseConnector::dbGetStatement("DatabaseConnectorJdbcResult")
sparklyr::dbGetStatement("DBISparkResult")
Arguments
- res
An object inheriting from DBIResult.
- ...
Other arguments passed on to methods.
Value
dbGetStatement()
returns a string, the query used in
either dbSendQuery()
or
dbSendStatement()
.
Failure modes
Attempting to query the statement for a result set cleared with
dbClearResult()
gives an error.
See also
Other DBIResult generics:
DBIResult-class
,
dbBind()
,
dbClearResult()
,
dbColumnInfo()
,
dbFetch()
,
dbGetInfo()
,
dbGetRowCount()
,
dbGetRowsAffected()
,
dbHasCompleted()
,
dbIsReadOnly()
,
dbIsValid()
,
dbQuoteLiteral()
,
dbQuoteString()
Examples
con <- dbConnect(RSQLite::SQLite(), ":memory:")
dbWriteTable(con, "mtcars", mtcars)
rs <- dbSendQuery(con, "SELECT * FROM mtcars")
dbGetStatement(rs)
#> [1] "SELECT * FROM mtcars"
dbClearResult(rs)
dbDisconnect(con)