List of Key = Value Pairs to SQL Expressions
Arguments
- keyValues
list of
key = value
pairs- filter
logical. If
TRUE
the target is an SQL filter expression, otherwise an SQL SET expression.- like
passed to
keyValueToSql
Examples
keyValues <- list(name = "Peter", birth = as.POSIXct("1999-09-09"))
setCurrentSqlDialect("msaccess")
cat(keyValuesToSql(keyValues, filter = TRUE))
#> name LIKE 'Peter' AND birth LIKE #1999-09-09#
cat(keyValuesToSql(keyValues, filter = TRUE, like = FALSE))
#> name = 'Peter' AND birth = #1999-09-09#
cat(keyValuesToSql(keyValues, filter = FALSE))
#> name = 'Peter',birth = #1999-09-09#
setCurrentSqlDialect("mysql")
cat(keyValuesToSql(keyValues, filter = TRUE))
#> name LIKE "Peter" AND birth LIKE '1999-09-09'
cat(keyValuesToSql(keyValues, filter = TRUE, like = FALSE))
#> name = "Peter" AND birth = '1999-09-09'
cat(keyValuesToSql(keyValues, filter = FALSE))
#> name = "Peter",birth = '1999-09-09'