diff --git a/NAMESPACE b/NAMESPACE index b39800c..d7d3bd3 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -76,5 +76,6 @@ importFrom(rlang,is_empty) importFrom(rlang,is_scalar_character) importFrom(rlang,quo_is_null) importFrom(tibble,as_tibble) +importFrom(tibble,tibble) importFrom(tibble,tribble) importFrom(withr,defer) diff --git a/R/perform.R b/R/perform.R index 4d023fa..8ad3bd7 100644 --- a/R/perform.R +++ b/R/perform.R @@ -1,12 +1,13 @@ #' Perform a query #' #' @export +#' @importFrom tibble tibble #' @param query an s3 object of class `privilege` or `row_policy, required. #' if `con` is not supplied, we attempt to get the connection #' from `query`; if it is not found we try to use a value passed to `con`. #' @param con DBI connection object, optional, see `query` -#' @return error from PostgreSQL or Redshift upon error, or an integer -#' value +#' @return error from PostgreSQL or Redshift upon error; upon success a single +#' row tibble with column "rows_affected" (integer) rls_perform <- function(query, con = NULL) { assert_is(query, c("privilege", "row_policy")) con <- as_con(query %||% con) @@ -15,5 +16,6 @@ rls_perform <- function(query, con = NULL) { privilege = translate_privilege(query, con), row_policy = translate_row_policy(query, con) ) - dbExecute(con, sql) + res <- dbExecute(con, sql) + tibble(rows_affected = res) } diff --git a/man/rls_perform.Rd b/man/rls_perform.Rd index 48bf3b7..d02227d 100644 --- a/man/rls_perform.Rd +++ b/man/rls_perform.Rd @@ -12,8 +12,8 @@ rls_perform(query, con = NULL) \item{con}{DBI connection object, optional, see \code{query}} } \value{ -error from PostgreSQL or Redshift upon error, or an integer -value +error from PostgreSQL or Redshift upon error; upon success a single +row tibble with column "rows_affected" (integer) } \description{ Perform a query