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

Merge changes from upstream #1

Open
wants to merge 141 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
a69658d
fix of LOG10 for Redshift
Jul 18, 2016
60f05db
Merge pull request #33 from alondhe/master
schuemie Jul 19, 2016
0f52ad6
Hack for fixing problem when Oracle schema name (aka as 'user') conta…
schuemie Jul 20, 2016
6e8f59f
rebuild broadsea-methodslibrary
msuchard Jul 25, 2016
33ffcde
Merge branch 'master' of github.com:OHDSI/SqlRender
msuchard Jul 25, 2016
f72cbee
cran-like check on travis
msuchard Aug 2, 2016
c1e619e
add latex to travis
msuchard Aug 2, 2016
111e3fa
R package to ignore java source
msuchard Aug 2, 2016
486a7c5
clean R CMD check on Mac
msuchard Aug 2, 2016
d8d4011
Fixed problem with render parameters containing backslashes.
schuemie Aug 7, 2016
f1a58f7
Preparing for CRAN submission
schuemie Aug 7, 2016
f659e38
Preparing for CRAN submission
schuemie Aug 8, 2016
0e672fd
Further preparations for CRAN
schuemie Aug 15, 2016
c1caf82
More preparations for CRAN
schuemie Aug 15, 2016
9dbfde0
More preparation for CRAN
schuemie Aug 16, 2016
a148713
Added CRAN badge to README
schuemie Aug 17, 2016
80c4acf
Fixed translation for DATEFROMPARTS for RedShift.
schuemie Aug 31, 2016
b81e742
Add Impala SQL dialect. Fixes #39.
tomwhite Oct 26, 2016
8bbd629
Merge pull request #43 from tomwhite/impala
schuemie Jan 10, 2017
62ec360
Updated documentation. Rebuilt JAR file so it contains the latest tra…
schuemie Jan 10, 2017
3e3905d
Preparing for new CRAN submission
schuemie Jan 12, 2017
7555566
Fixed URL for CRAN submission
schuemie Jan 16, 2017
b5372e1
Update replacementPatterns.csv
gowthamrao Jan 19, 2017
83e8386
Merge pull request #50 from gowthamrao/patch-1
schuemie Jan 23, 2017
0dee889
Netezza test
gowthamrao Jan 27, 2017
643c568
Merge pull request #54 from gowthamrao/master
schuemie Jan 30, 2017
3379ebe
Escape 'location' table name in Impala since it's a reserved word.
tomwhite Feb 17, 2017
0a5c812
Merge pull request #56 from tomwhite/impala-location-reserved-word
schuemie Feb 17, 2017
42d2fa0
Added support for regular expressions in replacement patterns. Demons…
schuemie Mar 16, 2017
df76640
Should now also play nice with datetime / timestamp
schuemie Mar 16, 2017
2d402fa
Added translation for date to varchar conversion. Fixes #57
schuemie Mar 16, 2017
ae2b4fb
Deprecated sourceDialect argument in both Java and R functions
schuemie Mar 17, 2017
d6f8319
Updated copyright information
schuemie Mar 17, 2017
7971541
Throw error if cannot parse boolean logic, instead of just returning …
schuemie Mar 17, 2017
ec8a534
Added command line interface for jar
schuemie Mar 19, 2017
92267fc
Supporting regex variables at start of search pattern (just because w…
schuemie Mar 19, 2017
1d418da
Add hints for MPP optimization. Fixes #44
schuemie Mar 19, 2017
36ece23
Throwing warning when parameter name not found in SQL for renderSql, …
schuemie Mar 19, 2017
d28cd60
Now also length of non-temp-table names (but only in CREATE/DROP/TRUN…
schuemie Mar 19, 2017
e0a0247
CONCAT with more than two parameters now works on Oracle
schuemie Mar 19, 2017
dd9053d
Updating version number in pom
schuemie Mar 23, 2017
3679859
Updated readme to mention command-line interface
schuemie Mar 24, 2017
004a3af
Preparing for CRAN submission
schuemie Mar 24, 2017
3c13076
Using latest version of R to build.
schuemie Mar 24, 2017
616fe52
Forgot to remove comment from cran commments
schuemie Mar 24, 2017
ab69961
Using ADD_MONTHS in RedShift. Fixes #62
schuemie Mar 29, 2017
f8a3861
In Impala, CAST DATE directly to TIMESTAMP type rather than parsing t…
Apr 2, 2017
7fd0342
Merge pull request #63 from korneliusracz/impala
schuemie Apr 3, 2017
2e670fb
Removing sourceDialect argument from unit tests
schuemie Apr 3, 2017
e8e9361
Fixing tests broken in https://github.com/OHDSI/SqlRender/commit/7fd0…
schuemie Apr 3, 2017
806e210
Regenerated JAR to incorporate changes in translation rules when usin…
schuemie Apr 3, 2017
0aabdf1
Correct handling of LOG function (with various bases). Should now wor…
schuemie Apr 5, 2017
b26b3e1
For LOG function in PostgresSQl and RedShift: casting arguments to su…
schuemie Apr 7, 2017
029d260
Workaround for Oracle bug: even though "date + interval '99' day" wor…
schuemie Apr 11, 2017
77ea784
Fixed translation issues for Oracle involving 'FROM DUAL' quirk. Adde…
schuemie Apr 12, 2017
7a041e1
Update README.md
schuemie Apr 13, 2017
2f5d779
Revert "In Impala, CAST DATE directly to TIMESTAMP type rather than p…
tomwhite Apr 18, 2017
7ef5c87
Revert "Fixing tests broken in https://github.com/OHDSI/SqlRender/com…
tomwhite Apr 18, 2017
f5e8b6f
Merge branch 'tomwhite-impala-timestamp'
schuemie Apr 18, 2017
31a0ca4
Added recommendation on string comparisons to vignette.
schuemie Apr 21, 2017
588118a
Added translation rules for ISNUMERIC function
schuemie Apr 25, 2017
d30feab
Fixed bug when trying to split SQL where reserved word 'end' is used …
schuemie May 3, 2017
446f84a
Preparing for CRAN submission
schuemie May 3, 2017
4103ce8
Preparing for CRAN submission
schuemie May 3, 2017
415f056
Merge branch 'master' of https://github.com/OHDSI/SqlRender
schuemie May 3, 2017
fbf1f0f
Fixed bug when trying to split SQL where last line has comment but no…
schuemie May 3, 2017
5620e78
Preparing for CRAN submission
schuemie May 3, 2017
ea27fee
Merge branch 'master' of https://github.com/OHDSI/SqlRender
myounglai May 9, 2017
b6ce297
Change "googlebigquery" identifier to "bigquery".
myounglai May 9, 2017
2417d32
Remove replacement patterns that lead to infinite loop. These aren't…
myounglai May 9, 2017
aff5379
Fix relative path for test.
myounglai May 9, 2017
d50db54
Changes corresponding to new DDL statement support in starschema.
myounglai May 12, 2017
25df91c
Remove type translation that is done in the driver.
myounglai May 13, 2017
f208592
Lowercase all statements.
myounglai May 13, 2017
bb2f3b2
Move lowercasing of statements until after the rest of translation.
myounglai May 13, 2017
d5d302c
Combine lines.
myounglai May 13, 2017
2e13099
Add output for debugging.
myounglai May 13, 2017
44ef5af
Fix typo
myounglai May 13, 2017
28e15a2
Move lowercasing earlier.
myounglai May 13, 2017
eaab0f9
Try another fix.
myounglai May 13, 2017
2da97a7
Try explicit locale.
myounglai May 13, 2017
7db387f
Try tolower in R code.
myounglai May 13, 2017
fd90333
Playing around with Shiny app. Shiny is not very good at file and cli…
schuemie May 16, 2017
1827930
Merge branch 'master' into develop
schuemie May 16, 2017
3b8f9b4
Fixed build
schuemie May 18, 2017
b10f3ad
Decompose subtraction and extract operators in group by.
myounglai May 19, 2017
8176787
move gh token
msuchard May 19, 2017
779f842
Some more work on the Shiny app
schuemie May 23, 2017
f0237cd
Tidied up function that launches the Shiny app. Dependencies are in s…
schuemie May 23, 2017
2230a14
Common table expressions and group by rewrites.
myounglai May 24, 2017
04938f9
Change to using GROUP BY matching against the select list rather than…
myounglai May 24, 2017
c5f474b
Revert extraneous diffs in preparation for creating pull request.
myounglai May 25, 2017
c2c76f5
Revert more diffs.
myounglai May 25, 2017
174a38d
More reverts.
myounglai May 25, 2017
8368715
Start adding unit tests for bigquery.
myounglai May 25, 2017
8234c0a
Remove concat rewrite rules that are no longer needed.
myounglai May 25, 2017
58f880d
Add lowercasing for bigquery.
myounglai May 26, 2017
ed52893
More unit tests.
myounglai May 26, 2017
28304aa
Add some comments.
myounglai May 26, 2017
aa14f87
Fix bug in parse_date rewrite introduced by cleanup.
myounglai May 27, 2017
bd27562
Changes for BigQuery support (#70)
myounglai May 29, 2017
292aa8a
Added BigQuery to the documentation. Increased version to 1.4.0
schuemie May 29, 2017
a3348da
Experimenting with pkgdown.
schuemie May 29, 2017
5a45f00
Referencing pkgdown sites
schuemie May 29, 2017
dffa378
Merge branch 'master' of https://github.com/OHDSI/SqlRender
myounglai May 30, 2017
941eb1a
Rewrite string concatenations to use CONCAT.
myounglai May 30, 2017
9acb8ad
More tests and skip group by replacement for simple expressions.
myounglai May 30, 2017
9810982
Simplify GROUP BY rewrites.
myounglai May 31, 2017
78231ff
More changes needed to run heel script.
myounglai May 31, 2017
a1dba71
Revert test change.
myounglai May 31, 2017
a66bc46
Update jar.
myounglai May 31, 2017
d10bea1
Add lowercasing of everything but string literals.
myounglai May 31, 2017
7b60659
Exclude row_number from group by translation.
myounglai May 31, 2017
94e978b
Support for ifnull. More patterns for recognizing string concats.
myounglai May 31, 2017
81fcc10
Fix unit test.
myounglai May 31, 2017
25b1224
Add pattern for CONCAT recognition.
myounglai May 31, 2017
d387236
Fix direction of isnull/ifnull translation.
myounglai May 31, 2017
f9ca39f
Handle aliases without AS at the end of CONCAT expressions.
myounglai May 31, 2017
713c5c1
Add concat rule for CASE expression.
myounglai May 31, 2017
96d2fb5
Detect string in second position for CONCAT.
myounglai Jun 1, 2017
98e6ca0
Changes to bigquery support to get achilles heel script working (#71)
myounglai Jun 1, 2017
9c9cf7d
Merge branch 'master' of https://github.com/OHDSI/SqlRender
myounglai Jun 1, 2017
8da77a0
Factor out a class for iterating comma separated expression lists.
myounglai Jun 1, 2017
8a1688c
Change GROUP BY matching back to searching for the expression in the …
myounglai Jun 1, 2017
83f6ba4
More refactoring to prepare to use the same GROUP BY rewriting code o…
myounglai Jun 1, 2017
8e3a43f
Rewrite complex expression to select list indexes in ORDER BY.
myounglai Jun 2, 2017
6d789ea
Handle case where final semi-colon is missing.
myounglai Jun 2, 2017
57eb015
Changes to bigquery support to handle achilles export queries (#72)
myounglai Jun 7, 2017
f2d5086
Moved BigQuery code to separate class for improved code readability. …
schuemie Jun 7, 2017
068ce24
Adding formatR to suggests lists because it is needed by knitr (when …
schuemie Jun 7, 2017
e9faa75
Switching to R Travis image
schuemie Jun 7, 2017
752f138
Fixing issue when splitting SQL containing hints.
schuemie Jun 8, 2017
d8b303e
Redshift support (#74)
ganisimov Jun 9, 2017
012b425
Increased version number
schuemie Jun 9, 2017
7955141
Updated vignette to mention new optimization hint, and reflect fact t…
schuemie Jun 9, 2017
ff4d7e5
Merge branch 'master' into develop
schuemie Jun 9, 2017
055094e
Mentioning Shiny app in vignette.
schuemie Jun 9, 2017
b721ea7
Remove 'Prevent Divide by zero error' translation rule (issue #75).
Jun 13, 2017
85207c9
Remove '--no-multiarch'.
Jun 13, 2017
3e5fab4
Merge pull request #76 from ganisimov/rs
schuemie Jun 13, 2017
3a4f841
Merge branch 'master' of https://github.com/OHDSI/SqlRender
myounglai Jun 14, 2017
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
13 changes: 12 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
extras
license_header_stub.txt
pom.xml
^.*\.Rproj$
^\.Rproj\.user$
.travis.yml
.classpath
.project
build
^cran-comments.md$
build.xml
deploy.sh
extras/
pom.xml
bin/
.idea/
SqlRender.iml
license_header_stub.txt
target/
docs
2 changes: 1 addition & 1 deletion .classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="java-src"/>
<classpathentry kind="src" path="java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk6"/>
<classpathentry kind="output" path="bin"/>
</classpath>
71 changes: 12 additions & 59 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,24 @@
# .travis.yml using container-based infrastructure
# from: https://github.com/jtilly/R-travis-container-example/blob/master/.travis.yml

language: c

# use containers
language: R
cache: packages
sudo: false

# install R: use r-packages-precise (https://cran.r-project.org/bin/linux/ubuntu/precise/)
# as source which is white listed (https://github.com/travis-ci/apt-source-whitelist/)
addons:
apt:
sources:
- r-packages-precise
packages:
- r-base-dev
- r-recommended
- pandoc
- default-jdk
- default-jre

# cache local R libraries directory:
cache:
directories:
- ~/Rlib

# install the package and dependencies:
install:
- mkdir -p ~/Rlib
- echo 'R_LIBS=~/Rlib' > .Renviron
- echo 'options(repos = "http://cran.rstudio.com")' > .Rprofile
- mkdir -p ~/.R
- Rscript -e 'if(!"devtools" %in% rownames(installed.packages())) { install.packages("devtools", dependencies = TRUE) }'
- Rscript -e 'if (!require("covr")) devtools::install_github("jimhester/covr")'
- Rscript -e 'if (!require("drat")) install.packages("drat")'
- Rscript -e 'if(!"rJava" %in% rownames(installed.packages())) { install.packages("rJava", dependencies = TRUE) }'
- Rscript -e 'if(!"testthat" %in% rownames(installed.packages())) { install.packages("testthat", dependencies = TRUE) }'
- Rscript -e 'if(!"knitr" %in% rownames(installed.packages())) { install.packages("knitr", dependencies = TRUE) }'
- Rscript -e 'if(!"rmarkdown" %in% rownames(installed.packages())) { install.packages("rmarkdown", dependencies = TRUE) }'
- Rscript -e 'update.packages(ask = FALSE, instlib = "~/Rlib")'
- Rscript -e 'devtools::install_deps(pkg = ".", dependencies = TRUE)'

before_script:
- export PKG_NAME=$(Rscript -e 'cat(paste0(devtools::as.package(".")$package))')
- export PKG_TARBALL=$(Rscript -e 'pkg <- devtools::as.package("."); cat(paste0(pkg$package,"_",pkg$version,".tar.gz"))')
r_packages:
- covr
- drat

# Build and check package
script:
- R CMD build . --no-build-vignettes --no-manual
- PKG_FILE_NAME=$(ls -1t *.tar.gz | head -n 1)
- PKG_NAME=$(ls -1t *.tar.gz | head -n 1 | sed 's/_.*gz//')
- _R_CHECK_CRAN_INCOMING_=FALSE R CMD check "${PKG_FILE_NAME}" --no-build-vignettes --no-manual
- cat ${PKG_NAME}.Rcheck/00install.out # Print out install / compile log
before_install:
- Rscript -e 'update.packages(ask = FALSE)'
- export LD_LIBRARY_PATH=$JAVA_HOME:$LD_LIBRARY_PATH

notifications:
recipients:
- [email protected]
- [email protected]
- [email protected]
- [email protected]
email:
on_success: change
on_failure: change

after_success:
- Rscript -e 'library(covr);codecov()'
# Rebuild docker container
- curl --data "build=true" -X POST https://registry.hub.docker.com/u/ohdsi/development/trigger/e51f720d-c4e7-45df-b042-5d8a362bd7e0/
- Rscript -e 'covr::codecov()'
- curl --data "build=true" -X POST https://registry.hub.docker.com/u/ohdsi/broadsea-methodslibrary/trigger/f0b51cec-4027-4781-9383-4b38b42dd4f5/
- test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_BRANCH == "master" && bash deploy.sh

env:
global:
secure: eUCnclALTsNc8+oOVS8qeSkD8CcYwAPfq759YG/WYXHpTgWDtjCAeHBARWmELHxkGDromzT+lNL3gnbs0WfqD+Nm0prAO7tjPIVKRe4h8zDHwLgZyPQSv17YwwNQZknEPWDrP18BpGqrKCDl8qYsL80+6QVqBs1FczZI7taSfB0=
25 changes: 17 additions & 8 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
Package: SqlRender
Type: Package
Title: Rendering Parameterized SQL and Translation to Dialects
Version: 1.1.4
Date: 2016-05-30
Author: Martijn J. Schuemie and Marc A. Suchard
Version: 1.4.3
Date: 2017-06-09
Authors@R: c(
person("Martijn", "Schuemie", , "[email protected]", role = c("aut", "cre")),
person("Marc", "Suchard", role = c("aut"))
)
Maintainer: Martijn Schuemie <[email protected]>
Description: This is an R package for rendering parameterized SQL, and
translating it to different SQL dialects.
License: Apache License
Description: A rendering tool for parameterized SQL that also translates into
different SQL dialects. These dialects include Sql Server, Oracle,
PostgreSql, Amazon RedShift, Impala, IBM Netezza, Google BigQuery, and Microsoft PDW.
License: Apache License 2.0
VignetteBuilder: knitr
URL: https://github.com/OHDSI/SqlRender
BugReports: https://github.com/OHDSI/SqlRender/issues
Imports:
rJava
Suggests:
testthat,
knitr,
rmarkdown
rmarkdown,
shiny,
shinydashboard,
formatR
LazyData: false
RoxygenNote: 5.0.1
RoxygenNote: 6.0.1
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

export(camelCaseToSnakeCase)
export(createRWrapperForSql)
export(launchSqlRenderDeveloper)
export(loadRenderTranslateSql)
export(readSql)
export(renderSql)
Expand All @@ -12,3 +13,5 @@ export(translateSql)
export(translateSqlFile)
export(writeSql)
import(rJava)
importFrom(utils,install.packages)
importFrom(utils,menu)
52 changes: 52 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
SqlRender v1.3.7 (Release date: 2017-05-03)
===========================================

Changes:

1. Added translation rules for ISNUMERIC and LOG(@expression, @base)


Bugfixes:

1. Fixed bug when trying to split SQL where reserved word 'end' is used as a field name.
2. Fixes for Impala translations.
3. Fixed translation issues for Oracle involving 'FROM DUAL'.
4. Added workaround for Oracle bug for intervals greater than 99 days.
5. Fixed bug when trying to split SQL where last line has comment but no EOL.


SqlRender v1.3.0 (Release date: 2017-03-24)
===========================================

Changes:

1. Added ability to use regular expression in translation patterns. This allowed SELECT TOP n to be translated.
2. Deprecated sourceDialect argument.
3. Added translation for CONCAT function with >2 arguments to Oracle (which only allows 2 arguments)
4. Added hints for translation optimation to massive parallel platforms like RedShift
5. Throw warnings when translateSql is called with variable names that are not in the SQL
6. Throw warnings when table names are too long for Oracle


Bugfixes:

1. Fixed translation for date functions so they will now work properly with datetime fields as well.
2. Now throwing error when boolean logic cannot be parsed (instead of assuming result is TRUE)


SqlRender v1.2.0 (Release date: 2017-01-12)
===========================================

Changes:

1. Added support for Impala

Bugfixes:

1. Fixed translation for DATEFROMPARTS for RedShift


SqlRender v1.1.7 (Release date: 2016-08-15)
===========================================

Changes: initial submission to CRAN
57 changes: 30 additions & 27 deletions R/HelperFunctions.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# @file HelperFunctions.R
#
# Copyright 2016 Observational Health Data Sciences and Informatics
# Copyright 2017 Observational Health Data Sciences and Informatics
#
# This file is part of SqlRender
#
Expand Down Expand Up @@ -109,7 +109,7 @@ renderSqlFile <- function(sourceFile, targetFile, ...) {
#'
#' @param sourceFile The source SQL file
#' @param targetFile The target SQL file
#' @param sourceDialect The source dialect. Currently, only 'sql server' for Microsoft SQL Server
#' @param sourceDialect Deprecated: The source dialect. Currently, only 'sql server' for Microsoft SQL Server
#' is supported
#' @param targetDialect The target dialect. Currently 'oracle', 'postgresql', and 'redshift' are
#' supported
Expand All @@ -124,11 +124,14 @@ renderSqlFile <- function(sourceFile, targetFile, ...) {
#' @export
translateSqlFile <- function(sourceFile,
targetFile,
sourceDialect = "sql server",
targetDialect = "oracle",
sourceDialect,
targetDialect,
oracleTempSchema = NULL) {
if (!missing(sourceDialect))
warning("sourceDialect argument is deprecated in the translateSqlFile function in SqlRender. Please update your code")

sql <- readSql(sourceFile)
sql <- translateSql(sql, sourceDialect, targetDialect, oracleTempSchema = oracleTempSchema)$sql
sql <- translateSql(sql = sql, targetDialect = targetDialect, oracleTempSchema = oracleTempSchema)$sql
writeSql(sql, targetFile)
}

Expand Down Expand Up @@ -179,12 +182,12 @@ loadRenderTranslateSql <- function(sqlFilename,
package = packageName)
}
parameterizedSql <- readChar(pathToSql, file.info(pathToSql)$size)

renderedSql <- renderSql(parameterizedSql[1], ...)$sql

if (mustTranslate)
renderedSql <- translateSql(renderedSql, "sql server", dbms, oracleTempSchema)$sql

renderedSql <- translateSql(sql = renderedSql, targetDialect = dbms, oracleTempSchema = oracleTempSchema)$sql
renderedSql
}

Expand Down Expand Up @@ -212,7 +215,7 @@ snakeCaseToCamelCase <- function(string) {
for (number in 0:9) {
string <- gsub(paste("_", number, sep = ""), number, string)
}

string
}

Expand Down Expand Up @@ -273,7 +276,7 @@ createRWrapperForSql <- function(sqlFilename,
rFilename <- paste(substr(sqlFilename, 1, periodIndex), "R", sep = "")
}
}

pathToSql <- system.file(paste("sql/", "sql_server", sep = ""),
sqlFilename,
package = packageName)
Expand All @@ -287,7 +290,7 @@ createRWrapperForSql <- function(sqlFilename,
} else {
stop("Could not find SQL file")
}

hasTempTables <- any(gregexpr("\\#", parameterizedSql)[[1]] != -1)
hits <- gregexpr("\\{DEFAULT @[^}]*\\}", parameterizedSql)
hits <- cbind(hits[[1]], attr(hits[[1]], "match.length"))
Expand Down Expand Up @@ -315,10 +318,10 @@ createRWrapperForSql <- function(sqlFilename,
if (any(definitions[, 1] == databaseParameter))
databaseParameters <- rbind(databaseParameters,
definitions[definitions$sqlParameter == databaseParameter,
])
])
}
functionDefinitions <- definitions[!(definitions$sqlParameter %in% databaseParameters$sqlParameter), ]

lines <- c()
if (createRoxygenTemplate) {
lines <- c(lines, "#' Todo: add title")
Expand Down Expand Up @@ -347,12 +350,12 @@ createRWrapperForSql <- function(sqlFilename,
for (i in 1:nrow(functionDefinitions)) {
if (i == nrow(functionDefinitions))
end <- ") {" else end <- ","
lines <- c(lines, paste(" ",
functionDefinitions$rParameter[i],
" = ",
functionDefinitions$value[i],
end,
sep = ""))
lines <- c(lines, paste(" ",
functionDefinitions$rParameter[i],
" = ",
functionDefinitions$value[i],
end,
sep = ""))
}
for (databaseParameter in databaseParameters$rParameter) {
lines <- c(lines, paste(" ",
Expand All @@ -364,20 +367,20 @@ createRWrapperForSql <- function(sqlFilename,
}
lines <- c(lines,
paste(" renderedSql <- SqlRender::loadRenderTranslateSql(\"", sqlFilename, "\",",
sep = ""))
sep = ""))
lines <- c(lines, paste(" packageName = \"", packageName, "\",", sep = ""))
lines <- c(lines, " dbms = connectionDetails$dbms,")
if (hasTempTables)
lines <- c(lines, " oracleTempSchema = oracleTempSchema,")
for (i in 1:nrow(definitions)) {
if (i == nrow(definitions))
end <- ")" else end <- ","
lines <- c(lines, paste(" ",
definitions$sqlParameter[i],
" = ",
definitions$rParameter[i],
end,
sep = ""))
lines <- c(lines, paste(" ",
definitions$sqlParameter[i],
" = ",
definitions$rParameter[i],
end,
sep = ""))
}
lines <- c(lines, " conn <- DatabaseConnector::connect(connectionDetails)")
lines <- c(lines, "")
Expand Down
Loading