diff --git a/R/get_clean_sql.R b/R/get_clean_sql.R index 4512258..6ea4027 100644 --- a/R/get_clean_sql.R +++ b/R/get_clean_sql.R @@ -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 ) } diff --git a/README.Rmd b/README.Rmd index e68b6ab..bf598b6 100644 --- a/README.Rmd +++ b/README.Rmd @@ -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). diff --git a/inst/WORDLIST b/inst/WORDLIST index 6598236..497acf7 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -6,13 +6,15 @@ ORCID POSIXct SSMS Sys -alt ay +center dbplyr dfeshiny fy lauraselby +num odbc pkgdown renv +sep sql diff --git a/tests/testthat/test-get_clean_sql.R b/tests/testthat/test-get_clean_sql.R index 7aa4ea2..9a83c05 100644 --- a/tests/testthat/test-get_clean_sql.R +++ b/tests/testthat/test-get_clean_sql.R @@ -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(