query_sql | R Documentation |
Run parametric SQL statements and queries
query_sql(.sql, ..., .envir = parent.frame(), .verbose = FALSE)
execute_sql(.sql, ..., .envir = parent.frame(), .verbose = FALSE)
.sql |
string containing the parametric SQL expression. |
... |
Arguments passed on to |
.envir |
environment in which to lookup parametric values not found in
|
.verbose |
Whether to display the resulting SQL call, useful during development. |
See write_sql()
to see how ...
parameters must be defined.
These functions are basically simple wrappers around DBI::dbExecute()
and
DBI::dbGetQuery()
and as such serve equivalent purposes:
execute_sql()
is meant for statements which modify the database
(UPDATE
, DELETE
, DROP TABLE
, etc)
query_sql()
is meant for SELECT
queries.
For query_sql
, the output of the SQL query as a data.frame
.
For execute_sql
, the number of rows modified by the statement.
## Not run:
bar <- 1
get_query("
SELECT *
From Foo
WHERE a = {bar}")
# output of "SELECT * From Foo WHERE a = 1"
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.