Learn R Programming

RPostgreSQL (version 0.3-3)

dbSendQuery-methods: Execute a statement on a given database connection

Description

These methods are straight-forward implementations of the corresponding generic functions. However, for complex data like array are just transferred as a string instead of the corresponding vector in R. This behavior will change in future releases, and the author is advised not to rely on it.

Arguments

References

See the Database Interface definition document DBI.pdf in the base directory of this package or http://stat.bell-labs.com/RS-DBI.

See Also

PostgreSQL, dbDriver, dbConnect, fetch, dbCommit, dbGetInfo, dbReadTable.

Examples

Run this code
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, "usr", "password", "dbname")
res <- dbSendQuery(con, "SELECT * from sales")
data <- fetch(res, n = -1)
# alternatively, use dbGetQuery
data <- dbGetQuery(con, "SELECT * from sales")

Run the code above in your browser using DataLab