R/dbQuoteIdentifier_SQLiteConnection_character.R

Defines functions dbQuoteIdentifier_SQLiteConnection_character

Documented in dbQuoteIdentifier_SQLiteConnection_character

# dbDisconnect()
# dbSendQuery()
# dbSendStatement()
# dbDataType()
# dbQuoteString()
# dbQuoteIdentifier()
#' @rdname SQLiteConnection-class
#' @usage NULL
dbQuoteIdentifier_SQLiteConnection_character <- function(conn, x, ...) {
  if (any(is.na(x))) {
    stop("Cannot pass NA to dbQuoteIdentifier()", call. = FALSE)
  }
  # Avoid fixed = TRUE due to https://github.com/r-dbi/DBItest/issues/156
  x <- gsub("`", "``", enc2utf8(x))
  if (length(x) == 0L) {
    SQL(character(), names = names(x))
  } else {
    # Not calling encodeString() here to keep things simple
    SQL(paste("`", x, "`", sep = ""), names = names(x))
  }
}
#' @rdname SQLiteConnection-class
#' @export
setMethod("dbQuoteIdentifier", c("SQLiteConnection", "character"), dbQuoteIdentifier_SQLiteConnection_character)

Try the RSQLite package in your browser

Any scripts or data that you put into this service are public.

RSQLite documentation built on May 29, 2024, 3:30 a.m.