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-12-04'"
sql_escape_date(con, Sys.time())
#> [1] "'2024-12-04 14:29:19.325565'"
sql_escape_raw(con, charToRaw("hi"))
#> [1] "X'6869'"