Query | R Documentation |
Data types to represent SQL queries. It should not be necessary to use
SingleQuery and SingleQueryList interactively. Query
is the generic
user interface to generate SQL queries and is based on text parsing.
Query( .x, ..., .data = NULL, .envir = parent.frame(), checkSemicolon = TRUE, keepComments = FALSE )
.x |
(character | connection) A character or connection containing a query. |
... |
Parameters to be substituted in .x |
.data |
(list) |
.envir |
(environment) Should be left with the default. Sets the environment in which to evaluate code chunks in queries. |
checkSemicolon |
(logical) Should be left with the default. Set to false only in case you want to allow for semicolons within the query. |
keepComments |
(logical) In most cases it is safe(er) to remove comments
from a query. When you want to keep them set the argument to |
SingleQuery
inherits from character
and represents a single
query.
SingleQueryList
inherits from list
and represents a list of
single queries. It can be constructed with a list of character values.
query1 <- "SELECT {{ varName }} FROM {{ tableName }} WHERE primaryKey = {{ id }};" query2 <- "SHOW TABLES;" Query(query1, varName = "someVar", tableName = "someTable", .data = list(id = 1:2)) tmpFile <- tempfile() writeLines(c(query1, query2), tmpFile) Query(file(tmpFile))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.