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

REF CURSOR Support #94

Merged
merged 9 commits into from
Oct 17, 2022
Merged

REF CURSOR Support #94

merged 9 commits into from
Oct 17, 2022

Conversation

Michael-A-McMahon
Copy link
Member

@Michael-A-McMahon Michael-A-McMahon commented Sep 20, 2022

This branch adds support for REF CURSOR results from PL/SQL. A new REF_CURSOR constant in OracleR2dbcTypes allows out parameters to be registered for this type. Readable.get(...) methods allow REF CURSOR values to be mapped to Result objects. The rows of a REF CURSOR may then be consumed by calling Result.map(*) methods or Result.flatMap(...).

Oracle R2DBC uses Oracle JDBC statements to execute PL/SQL. When Oracle R2DBC returns a Result that is backed by a JDBC ResultSet, the JDBC statement must be held open until that ResultSet is consumed (b/c closing a JDBC statement closes the ResultSet). A solution for this was present in the current code base, but the design was broken by REF CURSORS. The design assumed that, before any Result was emitted to user code, all ResultSets would could be accounted. With REF CURSORS, new ResultSets can be created after Results are emitted.

The new constraint is that Oracle R2DBC doesn't know how many ResultSets will exist until user code executes a row mapping function. To handle this case, a new DependentCounter object is added. This object allows the number of ResultSets that depend on the JDBC statement to increase after Results are emitted to user code.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Oct 7, 2022
@jeandelavarene jeandelavarene merged commit 6b59e57 into main Oct 17, 2022
@jeandelavarene jeandelavarene deleted the ref-cursor branch October 17, 2022 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants