Skip to content

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.

Usage

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] "'2023-09-27'"
sql_escape_date(con, Sys.time())
#> [1] "'2023-09-27 12:28:34.455147'"
sql_escape_raw(con, charToRaw("hi"))
#> [1] "X'6869'"