dbEscapeStrings | R Documentation |
Escape SQL-special characters in strings.
dbEscapeStrings(con, strings, ...)
## S4 method for signature 'MySQLConnection,character'
dbEscapeStrings(con, strings)
## S4 method for signature 'MySQLResult,character'
dbEscapeStrings(con, strings, ...)
con |
a connection object (see |
strings |
a character vector. |
... |
any additional arguments to be passed to the dispatched method. |
A character vector with SQL special characters properly escaped.
if (mysqlHasDefault()) {
con <- dbConnect(RMySQL::MySQL(), dbname = "test")
tmp <- sprintf("SELECT * FROM emp WHERE lname = %s", "O'Reilly")
dbEscapeStrings(con, tmp)
dbDisconnect(con)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.