These generics translate individual values into SQL. The core generics are DBI::dbQuoteIdentifier() andDBI::dbQuoteString for quoting identifiers and strings, but dbplyr needs additional tools for inserting logical, date, date-time, and raw values into queries.

sql_escape_logical(con, x)

sql_escape_date(con, x)

sql_escape_datetime(con, x)

sql_escape_raw(con, x)

See also

Examples

con <- simulate_dbi() sql_escape_logical(con, c(TRUE, FALSE, NA))
#> [1] "TRUE" "FALSE" "NULL"
sql_escape_date(con, Sys.Date())
#> [1] "'2020-11-03'"
sql_escape_date(con, Sys.time())
#> [1] "'2020-11-03 18:13:21'"
sql_escape_raw(con, charToRaw("hi"))
#> [1] "X'6869'"