R/detatch_database.R

Defines functions detach_database

Documented in detach_database

#' Detach a database namespace and close the connection
#'
#'
#' @param dbname Character. Name of the namespace created by [attach_database].
#' @param quiet Logical. Message if detach successful.
#'
#' @return TRUE invisibly if detach was successful.
#'
#' @export
detach_database <- function(dbname, quiet = FALSE) {
  res <- detach(dbname, character.only = TRUE)
  if (is.environment(res)) {
    message(dbname, " detatched")
    return(invisible(TRUE))
  }
  FALSE
}
mdlincoln/dbns documentation built on May 20, 2019, 9:15 p.m.