#' @title
#' Execute an expression in the database
#'
#' @param object (obj) to act upon and execute
#' @param statement (str) command to execute
#' @param ... (arg) extra arguments
#'
#' @family Database Operations
#' @export
execute <- function(object, statement, ...) {
UseMethod("execute")
}
#' @rdname execute
#' @param .envir (env) bases of the interpolation (calling environment)
#' @export
execute.tbl_db <- function(object, statement, ..., .envir = parent.frame()) {
assert_tbl_db(object)
dbExecute(
get_tbl_db_conn(object),
glue_data_sql(
list(.table = get_tbl_db_from(object)),
statement,
.con = get_tbl_db_conn(object),
.envir = .envir
),
...
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.