gmSQLValues {gmDatabase} | R Documentation |
Format vector in parenthesis and SQL quote it
Description
Formats values for use in SQL statements
Usage
gmSQLValues(v,quote=TRUE,db=getOption("gmDB"))
Arguments
v |
The values to be converted, could be dataframe, numeric vector or something convertable to a character vector. |
quote |
Logocical value defining if the given values shall be quoted. |
db |
The database connection for which the transformation shall be done. Currently only mysql is supported. |
Details
The functions currently use dbEscapeStrings
and are
therefor only reliable with RMySQL-Connections.
Value
gmSQLValues
A single string containing an SQL representation of the vector for use
with the IN
operator.
Author(s)
K. Gerald van den Boogaart
See Also
Examples
## Not run:
.gmDB <- dbConnect(...)
complexString <- "He said: \"I\'m going to the circus\"\n"
cat(complexString)
gmEscapeStrings(complexString)
cat(gmEscapeStrings(complexString),"\n")
cat(gmSQLValues(complexString),"\n")
myfactor <- factor(c("a","a","b"))
cat(gmSQLValues(myfactor),"\n")
num <- 1:3
cat(gmSQLValues(num),"\n")
X <- data.frame(string=rep(complexString,3),fac=myfactor,x=num)
cat(gmSQLValues(X),"\n")
## End(Not run)
[Package gmDatabase version 0.5.0 Index]