| dbGet | R Documentation |
Get rows from a table
dbGet(
db,
table = NULL,
params = NULL,
sql = NULL,
fields = NULL,
joinby = NULL,
jointype = c("inner", "left", "right")[1],
run = TRUE,
schema = if (length(table) == 1) schemas[[table]] else NULL,
schemas = get.db.schemas(db),
rclass = schema$rclass,
convert = !is.null(rclass),
convert.param = FALSE,
orderby = NULL,
null.as.na = TRUE,
origin = "1970-01-01",
where.in = FALSE,
where.sql = NULL,
empty.as.null = FALSE,
n = -1
)
db |
dbi database connection |
table |
name of the table. If you specify more than one table the later tables will be joined. You then should specify the |
params |
named list of values for key fields. If you don't use a custom SQL statement the list will be used to construct a WHERE clause. E.g. |
sql |
optional a parameterized custom sql string
Can contain parameters passed with the select * from mytable where name = :myname To avoid SQL injection you should provide all values that can be provided by a user as such parameters or make sure that you escape them. |
fields |
If not NULL can be used to specify fields that shall be selected as character. For joined tables, you must enter fields in the format "tablename.field". E.g. |
joinby |
If you specify more than one table the later tables shall be joined by the variables specified in |
jointype |
The type of the join if you specify a |
run |
if FALSE only return parametrized SQL string |
schema |
a table schema that can be used to convert values |
rclass |
the r class of the table columns, is extracted from schema |
convert |
if rclass is given shall results automatically be converted to these classes? |
orderby |
names of columns the results shall be ordered by as character vector. Add "DESC" or "ASC" after column name to sort descending or ascending. Example: |
null.as.na |
shall NULL values be converted to NA values? |
origin |
the origin date for DATE and DATETIME conversion |
where.in |
Set TRUE if your params contain sets and therefore a WHERE IN clause shall be generated. |
where.sql |
An optional SQL code just for the WHERE clause. Can be used if some parameters will be checked with inequality. |
empty.as.null |
if TRUE return just NULL if the query returns zero rows. |
n |
The maximum number of rows that shall be fetched. If |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.