R/dbCanConnect_DBIDriver.R

Defines functions dbCanConnect_DBIDriver

Documented in dbCanConnect_DBIDriver

#' @rdname hidden_aliases
#' @usage NULL
dbCanConnect_DBIDriver <- function(drv, ...) {
  tryCatch(
    {
      con <- dbConnect(drv, ...)
      dbDisconnect(con)
      TRUE
    },
    error = function(e) {
      structure(
        FALSE,
        reason = conditionMessage(e)
      )
    }
  )
}
#' @rdname hidden_aliases
#' @export
setMethod("dbCanConnect", signature("DBIDriver"), dbCanConnect_DBIDriver)

Try the DBI package in your browser

Any scripts or data that you put into this service are public.

DBI documentation built on June 22, 2024, 9:41 a.m.