Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared sql connection functionality #8

Merged
merged 4 commits into from
Feb 3, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions R/sql.reader.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ sql.reader <- function(data.file, filename, variable.name)
{
database.info <- ProjectTemplate:::translate.dcf(filename)

if (! is.null(database.info[['connection']]))
{
connection_filename <- paste("data/", database.info[['connection']],".sql-connection", sep="")
connection.info <- ProjectTemplate:::translate.dcf(connection_filename)

# Allow .sql to override options defined in .connection
database.info <- modifyList(connection.info, database.info)
}

if (! (database.info[['type']] %in% c('mysql', 'sqlite', 'odbc', 'postgres', 'oracle')))
{
warning('Only databases reachable through RMySQL, RSQLite, RODBC ROracle or RPostgreSQL are currently supported.')
Expand Down
6 changes: 6 additions & 0 deletions man/sql.reader.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
accessed. All tables from the database, one specific
tables or one specific query against any set of tables
may be executed to generate a data set.

It is also possible to place shared connection settings
in a separate file using the option "connection". The
shared connection configuration is placed in files
named *.sql-connection in the data/ directory.

}
\details{
Examples of the DCF format and settings used in a .sql
Expand Down