R/db-set_conn_id.R

Defines functions dbSetConnId.SQLiteConnection dbSetConnId.PqConnection dbSetConnId

Documented in dbSetConnId

#' @title Set the connection ID so that it can be identified
#'
#' @description This is primarily so that connections can be identified
#' on the database end for testing and debugging purposes.
#'
#' @param conn (DBIConnection) object
#' @param name (str) name of the object
#'
#' @family Extra DBI Methods
#' @export
dbSetConnId <- function(conn, name) {

  UseMethod("dbSetConnId")

}

#' @export
dbSetConnId.PqConnection <- function(conn, name) {

  dbExecute(conn, glue_sql("set application_name to {name}", .con = conn))
  invisible(NULL)

}

#' @export
dbSetConnId.SQLiteConnection <- function(conn, name) {

  invisible(NULL)

}
tjpalanca/dbtools documentation built on Oct. 7, 2021, 6:43 a.m.