Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example for dbFetch() on a dbSendStatement() result? #409

Open
MichaelChirico opened this issue Mar 19, 2025 · 0 comments
Open

Example for dbFetch() on a dbSendStatement() result? #409

MichaelChirico opened this issue Mar 19, 2025 · 0 comments

Comments

@MichaelChirico
Copy link
Contributor

fetch_no_return_value = function(con, table_name) {
#'
#' Calling `dbFetch()` on a result set from a data manipulation query
#' created by [dbSendStatement()] can
#' be fetched and return an empty data frame, with a warning.
query <- paste0("CREATE TABLE ", table_name, " (a integer)")
res <- local_result(dbSendStatement(con, query))
expect_warning(rows <- check_df(dbFetch(res)))
expect_identical(rows, data.frame())
},

I'm not sure I understand this, and the example is using dbSendStatement() in a way that differs slightly from the documentation I see (which covers INSERT/UPDATE/DELETE but not CREATE statements).

Do you have an example of a backend that implements this as intended? It's also a bit hard to search for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant