Skip to content

Commit

Permalink
fix: add conflicted to deps and fix cli_alert function
Browse files Browse the repository at this point in the history
  • Loading branch information
dnldelarosa committed Oct 21, 2024
1 parent 525ed41 commit c4e5beb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ Language: en-US
RdMacros: lifecycle
VignetteBuilder: knitr
Imports:
conflicted,
dplyr,
glue,
lifecycle,
magrittr,
odbc,
rlang,
stringr,
tidyr,
tidyr
Suggests:
cli,
DBI,
Expand Down
20 changes: 13 additions & 7 deletions R/db_connect.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ db_connect <- function(
db_port = 5432,
k_service_id = "postgre",
...,
trusted_connection = 'Yes'
) {
trusted_connection = "Yes") {
.args <- list(...)

if (db_name %in% c("enft1", "enft2")) {
Expand All @@ -49,7 +48,7 @@ db_connect <- function(
}

rlang::check_installed("DBI")
rlang::check_installed('odbc')
rlang::check_installed("odbc")

if (!is.null(k_service_id)) {
rlang::check_installed("keyring")
Expand All @@ -60,7 +59,7 @@ db_connect <- function(
pass <- db_pass
}

if (db_sys == 'SQL Server') {
if (db_sys == "SQL Server") {
rlang::check_installed("odbc")
conn <- DBI::dbConnect(odbc::odbc(),
Driver = "ODBC Driver 17 for SQL Server",
Expand All @@ -86,9 +85,16 @@ db_connect <- function(
return(conn)
}

stop(cli::cli_alert_error(
paste0("El sistema de base de datos '", db_sys, "' no está soportado.")
), call. = FALSE)
stop(
cli::cli_alert_danger(
paste0(
"El sistema de base de datos '",
db_sys,
"' no está soportado."
)
),
call. = FALSE
)
}


Expand Down

0 comments on commit c4e5beb

Please sign in to comment.