nbenn commented on issue #1128:
URL: https://github.com/apache/arrow-adbc/issues/1128#issuecomment-1739526818
The example I had in mind was something like
```r
library(DBI)
con <- dbConnect(adbi::adbi("adbcsqlite"), uri = ":memory:")
res <- dbSendQuery(con, "SELECT * from swiss WHERE Agriculture < ?")
dbBind(res, 20)
dbFetch(res)
dbDisconnect(con)
```
If the user forgets to call `dbClearResult()`, the last call will error. In
RSQLite, in this case, a warning is issued:
> There are 1 result in use. The connection will be released when they are
closed
Personally I find even the added value of a warning in such a case
questionable. We can easily do all of this for the user instead of requiring
them to remember explicitly releasing all the involved objects (and in the
right order).
I was therefore wondering whether you'd want to add something to bind the
lifetime of the statement to that of the corresponding connection such that
when the connection is closed, we can also clean up the statement (if it has
not yet been released explicitly).
Having a counter keeping track of open statements would be great too, then I
could offer an option "auto-cleanup", disabled by default, in which case the
user is presented with the RSQLite behavior and if enabled, things just get
sorted out automatically.
All of this is very much on the more optional side of things though.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]