dbEscapeStrings: Escape SQL-special characters in strings.

dbEscapeStringsR Documentation

Escape SQL-special characters in strings.

Description

Escape SQL-special characters in strings.

Usage

dbEscapeStrings(con, strings, ...)

## S4 method for signature 'MySQLConnection,character'
dbEscapeStrings(con, strings)

## S4 method for signature 'MySQLResult,character'
dbEscapeStrings(con, strings, ...)

Arguments

con

a connection object (see dbConnect).

strings

a character vector.

...

any additional arguments to be passed to the dispatched method.

Value

A character vector with SQL special characters properly escaped.

Examples

if (mysqlHasDefault()) {
con <- dbConnect(RMySQL::MySQL(), dbname = "test")

tmp <- sprintf("SELECT * FROM emp WHERE lname = %s", "O'Reilly")
dbEscapeStrings(con, tmp)

dbDisconnect(con)
}

RMySQL documentation built on Sept. 11, 2024, 6:11 p.m.