R/dbQuoteLiteral_MySQLConnection.R

Defines functions dbQuoteLiteral_MySQLConnection

Documented in dbQuoteLiteral_MySQLConnection

#' @name mysql-quoting
#' @usage NULL
dbQuoteLiteral_MySQLConnection <- function(conn, x, ...) {
  # Switchpatching to avoid ambiguous S4 dispatch, so that our method
  # is used only if no alternatives are available.

  if (inherits(x, "POSIXt")) {
    return(dbQuoteString(
      conn,
      strftime(as.POSIXct(x), "%Y%m%d%H%M%S", tz = "UTC")
    ))
  }
  callNextMethod()
}

#' @rdname mysql-quoting
#' @export
setMethod("dbQuoteLiteral", signature("MySQLConnection"), dbQuoteLiteral_MySQLConnection)

Try the RMariaDB package in your browser

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

RMariaDB documentation built on April 12, 2025, 2:11 a.m.