#' @title Check Connection Type
#' @description This function checks the type of the provided connection and
#' returns the appropriate command function.
#' @param cxn The connection object to check.
#' @return The command function corresponding to the connection type.
#' @author Mike McMahon, \email{Mike.McMahon@@dfo-mpo.gc.ca}l
#' @export
connectionCheck <- function(cxn) {
if (inherits(cxn, "RODBC")) {
thecmd = RODBC::sqlQuery
} else if (inherits(cxn, "OraConnection")) {
thecmd = ROracle::dbGetQuery
} else if (inherits(cxn, "DBIConnection")) {
thecmd = DBI::dbGetQuery
} else if (inherits(cxn, "JDBCConnection")) {
thecmd = RJDBC::dbGetQuery
} else {
stop("Invalid connection object provided.")
}
return(thecmd)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.