Skip to content

Commit

Permalink
Fix bug in get_clean_sql additional settings that didn't include the …
Browse files Browse the repository at this point in the history
…SQL query
  • Loading branch information
cjrace committed Jul 23, 2024
1 parent f6ccfaf commit 0967be6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion R/get_clean_sql.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ get_clean_sql <- function(filepath, additional_settings = FALSE) {
# Prefix with settings that sometimes help
sql_string <- paste(
"SET ANSI_PADDING OFF",
"SET NOCOUNT ON;"
"SET NOCOUNT ON;",
sql_string
)
}

Expand Down
1 change: 0 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ format_ay(202425)
format_fy(202425)
format_ay_reverse("2024/25")
format_fy_reverse("2024-25")
```

For more details on all the functions available in this package, and examples of how to use them, please see our [dfeR package reference documentation](https://dfe-analytical-services.github.io/dfeR/reference/index.html).
4 changes: 3 additions & 1 deletion inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ ORCID
POSIXct
SSMS
Sys
alt
ay
center
dbplyr
dfeshiny
fy
lauraselby
num
odbc
pkgdown
renv
sep
sql
10 changes: 10 additions & 0 deletions tests/testthat/test-get_clean_sql.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ test_that("Adds additional settings", {
)
})

test_that("Keeps the query when adding additional settings", {
# Check that the output ends with the desired lines
expect_true(
grepl(
"\\[my_database_table\\]$",
get_clean_sql("../sql_scripts/simple.sql", additional_settings = TRUE)
)
)
})

test_that("Doesn't add additional settings", {
# Check that the output doesn't start with the additional lines
expect_false(
Expand Down

0 comments on commit 0967be6

Please sign in to comment.