dbGetStatement: Get the statement associated with a result set

Description Usage Arguments Value See Also Examples

Description

Returns the statement that was passed to dbSendQuery() or dbSendStatement().

\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbGetStatement")}

Usage

1

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(). 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, dbQuoteIdentifier, dbQuoteLiteral, dbQuoteString, dbUnquoteIdentifier

Examples

1
2
3
4
5
6
7
8
con <- dbConnect(RSQLite::SQLite(), ":memory:")

dbWriteTable(con, "mtcars", mtcars)
rs <- dbSendQuery(con, "SELECT * FROM mtcars")
dbGetStatement(rs)

dbClearResult(rs)
dbDisconnect(con)

Example output

[1] "SELECT * FROM mtcars"

DBI documentation built on May 2, 2018, 5:04 p.m.