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
Get row count and generated keys from batch #2060
Comments
Hi @doppelrittberger, unfortunately I am not aware of a way to specifically do what you want. If you can figure out appropriate JDBC code to produce the results you like, we can try to figure out how to make it work through JDBI. But I have a suspicion that your request is probably too advanced for the relatively simple way JDBC handles generated key results. |
…d, added ResultIterable.lists() method, resolves jdbi#2060
Hi, |
Add `executePreparedBatch` to supersede `executeAndReturnGeneratedKeys`, which allows access to the modified row count after execution. Also add a convenience method to the iterable that allows splitting up the list of results into per-batch sets. Addresses the problems described in jdbi#2060 Based on a proposal by @doppelrittberger (Markus Ritter)
Hi @doppelrittberger. Thank you for the PR. I have iterated a bit on the code and I put up #2069. Please let me know it that solves your issues as well. |
Add `executePreparedBatch` to supersede `executeAndReturnGeneratedKeys`, which allows access to the modified row count after execution. Also add a convenience method to the iterable that allows splitting up the list of results into per-batch sets. Addresses the problems described in #2060 Based on a proposal by @doppelrittberger (Markus Ritter)
addressed by #2069 |
Hi,
I have the following use case:
I execute a lot of "UPDATE whatever SET (...) RETURNING id" using PreparedBatch. Unfortunately I need to access the rows by each batch statement individually (some UPDATE return no rows, some return multiple). What I need is a List<List>. When I do PreparedBatch.execute() I get the row counts per batch statement but cannot access the generated keys. Vice versa: if I use PreparedBatch.executeAndReturnGeneratedKeys() I cannot distinguish anymore which rows belong to which batch statement. If I would have access to both I could reconstruct the List<List>.
Is there a way to achieve this or is there another way using the ResultSet?
Thanks in advance 👍
The text was updated successfully, but these errors were encountered: