Skip to content

These generics translate individual values into SQL. The core generics are DBI::dbQuoteIdentifier() and DBI::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] "'2024-04-08'"
sql_escape_date(con, Sys.time())
#> [1] "'2024-04-08 14:19:23.946009'"
sql_escape_raw(con, charToRaw("hi"))
#> [1] "X'6869'"