R/d_backup.R

Defines functions d_backup

Documented in d_backup

#' @title Backup a data base
#'
#' @author P. Chevallier - Jan 2019 / Nov 2020
#'
#' @description Back a htsr sqlite data base
#'
#' @param fsq Full name of the data base

#' @return
#' A saved data base with extension .bak
#'
#'
#'
# function backup
d_backup <- function(fsq) {
  nfe  <- tools::file_ext(fsq)
  nfse <- nfse <- tools::file_path_sans_ext(fsq)
  bk <- paste0(nfse,".",nfe,".bak")
  conn <- dbConnect(RSQLite::SQLite(), fsq)
  sqliteCopyDatabase(conn,to = bk)
  dbDisconnect(conn)
  message("\nData base backuped.")
}

Try the htsr package in your browser

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

htsr documentation built on Sept. 11, 2024, 9:16 p.m.