#' @include PqConnection.R
NULL
#' Quote postgres strings, identifiers, and literals
#'
#' If an object of class [Id] is used for `dbQuoteIdentifier()`, it needs
#' at most one `table` component and at most one `schema` component.
#'
#' @param conn A [PqConnection-class] created by `dbConnect()`
#' @param x A character vector to be quoted.
#' @param ... Other arguments needed for compatibility with generic (currently
#' ignored).
#' @examplesIf postgresHasDefault()
#' library(DBI)
#' con <- dbConnect(RPostgres::Postgres())
#'
#' x <- c("a", "b c", "d'e", "\\f")
#' dbQuoteString(con, x)
#' dbQuoteIdentifier(con, x)
#' dbDisconnect(con)
#' @name quote
NULL
as_table <- function(catalog, schema, table) {
args <- c(catalog = catalog, schema = schema, table = table)
# Also omits NA args
args <- args[!is.na(args) & args != ""]
do.call(Id, as.list(args))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.