R/maintainer.R

Defines functions ts_get_maintainer ts_set_maintainer

Documented in ts_get_maintainer ts_set_maintainer

#' Set Maintainer
#'
#' Sets maintainer.
#' @param maintainer A string of the maintainer.
#' @inheritParams ts_disconnect_db
#' @return A string of the old maintainer.
#' @export
ts_set_maintainer <- function(maintainer = ts_sys_user(),
                              conn = getOption("tsdbr.conn", NULL)) {
  chk_string(maintainer)
  old <- ts_get_maintainer(conn = conn)

  DBI::dbExecute(
    conn,
    paste0("UPDATE Database SET Maintainer = '", maintainer, "'")
  )
  invisible(old)
}

#' Get Maintainer
#'
#' Gets maintainer as a string.
#' @inheritParams ts_disconnect_db
#' @return A string of the maintainer.
#' @export
ts_get_maintainer <- function(conn = getOption("tsdbr.conn", NULL)) {
  ts_get_table("Database", conn = conn)$Maintainer
}
poissonconsulting/tsdbr documentation built on June 30, 2023, 3:02 a.m.