Skip to content

Commit

Permalink
change output of rls_perform to a tibble upon success; remains error …
Browse files Browse the repository at this point in the history
…upon error
  • Loading branch information
sckott committed Dec 11, 2024
1 parent 2076fa0 commit 66698eb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
8 changes: 5 additions & 3 deletions R/perform.R
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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)
}
4 changes: 2 additions & 2 deletions man/rls_perform.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 66698eb

Please sign in to comment.