Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

quote

Quote postgres strings, identifiers, and literals


Description

If an object of class Id is used for dbQuoteIdentifier(), it needs at most one table component and at most one schema component.

Usage

## S4 method for signature 'PqConnection,character'
dbQuoteString(conn, x, ...)

## S4 method for signature 'PqConnection,SQL'
dbQuoteString(conn, x, ...)

## S4 method for signature 'PqConnection,character'
dbQuoteIdentifier(conn, x, ...)

## S4 method for signature 'PqConnection,SQL'
dbQuoteIdentifier(conn, x, ...)

## S4 method for signature 'PqConnection,Id'
dbQuoteIdentifier(conn, x, ...)

## S4 method for signature 'PqConnection,SQL'
dbUnquoteIdentifier(conn, x, ...)

## S4 method for signature 'PqConnection,logical'
dbQuoteLiteral(conn, x, ...)

## S4 method for signature 'PqConnection,integer'
dbQuoteLiteral(conn, x, ...)

## S4 method for signature 'PqConnection,numeric'
dbQuoteLiteral(conn, x, ...)

## S4 method for signature 'PqConnection,factor'
dbQuoteLiteral(conn, x, ...)

## S4 method for signature 'PqConnection,Date'
dbQuoteLiteral(conn, x, ...)

## S4 method for signature 'PqConnection,POSIXt'
dbQuoteLiteral(conn, x, ...)

## S4 method for signature 'PqConnection,difftime'
dbQuoteLiteral(conn, x, ...)

## S4 method for signature 'PqConnection,list'
dbQuoteLiteral(conn, x, ...)

## S4 method for signature 'PqConnection,blob'
dbQuoteLiteral(conn, x, ...)

## S4 method for signature 'PqConnection,character'
dbQuoteLiteral(conn, x, ...)

Arguments

conn

A PqConnection created by dbConnect()

x

A character vector to be quoted.

...

Other arguments needed for compatibility with generic (currently ignored).

Examples

# For running the examples on systems without PostgreSQL connection:
run <- postgresHasDefault()

library(DBI)
if (run) con <- dbConnect(RPostgres::Postgres())

x <- c("a", "b c", "d'e", "\\f")
if (run) dbQuoteString(con, x)
if (run) dbQuoteIdentifier(con, x)
if (run) dbDisconnect(con)

RPostgres

'Rcpp' Interface to 'PostgreSQL'

v1.3.2
GPL-3
Authors
Hadley Wickham [aut], Jeroen Ooms [aut], Kirill Müller [aut, cre] (<https://orcid.org/0000-0002-1416-3412>), RStudio [cph], R Consortium [fnd], Tomoaki Nishiyama [ctb] (Code for encoding vectors into strings derived from RPostgreSQL)
Initial release
2021-04-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.