spec_sql_quote_string | R Documentation |
spec_sql_quote_string
dbQuoteString()
returns an object that can be coerced to character,
of the same length as the input.
For an empty character vector this function returns a length-0 object.
When passing the returned object again to dbQuoteString()
as x
argument, it is returned unchanged.
Passing objects of class SQL should also return them unchanged.
(For backends it may be most convenient to return SQL objects
to achieve this behavior, but this is not required.)
The returned expression can be used in a SELECT ...
query,
and for any scalar character x
the value of
dbGetQuery(paste0("SELECT ", dbQuoteString(x)))[[1]]
must be identical to x
,
even if x
contains
spaces,
tabs,
quotes (single
or double),
backticks,
or newlines
(in any combination)
or is itself the result of a dbQuoteString()
call coerced back to
character (even repeatedly).
If x
is NA
, the result must merely satisfy is.na()
.
The strings "NA"
or "NULL"
are not treated specially.
NA
should be translated to an unquoted SQL NULL
,
so that the query SELECT * FROM (SELECT 1) a WHERE ... IS NULL
returns one row.
Passing a numeric,
integer,
logical,
or raw vector,
or a list
for the x
argument raises an error.
Other sql specifications:
spec_sql_append_table
,
spec_sql_create_table
,
spec_sql_exists_table
,
spec_sql_list_fields
,
spec_sql_list_objects
,
spec_sql_list_tables
,
spec_sql_quote_identifier
,
spec_sql_quote_literal
,
spec_sql_read_table
,
spec_sql_remove_table
,
spec_sql_unquote_identifier
,
spec_sql_write_table
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.