GROOVY-11936: Add Map-based named-parameter overloads for call/callWi…#2475
Merged
Conversation
…thRows/callWithAllRows
Contributor
There was a problem hiding this comment.
Pull request overview
Adds GROOVY-11936 support in groovy-sql for calling stored procedures using Map-based named parameters (and Groovy named-argument syntax), aligning stored-proc APIs with existing named-parameter support elsewhere in Sql.
Changes:
- Add Map/named-arg overloads for
call,callWithRows, andcallWithAllRows. - Ensure
:nameplaceholders are resolved to positional bindings before callable execution and OUT-parameter scanning. - Add regression tests and userguide/spec examples documenting Map/named-arg stored procedure calls.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | Adds Map/named-arg overloads and applies named-parameter rewriting for stored-procedure calls. |
| subprojects/groovy-sql/src/test/groovy/groovy/sql/SqlCallTest.groovy | Adds tests for Map-based stored-proc calls, including key-order independence and IN-only cases. |
| subprojects/groovy-sql/src/spec/test/SqlTest.groovy | Adds spec test snippets for Map and named-arg stored-proc usage. |
| subprojects/groovy-sql/src/spec/doc/sql-userguide.adoc | Documents Map/named-arg stored-proc calling patterns and includes new spec snippets. |
Comments suppressed due to low confidence (1)
subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java:3236
- In
call(String, List), exceptions are logged using the originalsqlstring even though named-parameter SQL may be rewritten bycheckForNamedParamsbefore execution. This can make troubleshooting harder because the logged SQL may not match what was actually prepared/executed. Consider loggingupdated.getSql()(and possiblyupdated.getParams()) by capturing them in local variables before executing the statement.
SqlWithParams updated = checkForNamedParams(sql, params);
statement = getCallableStatement(connection, updated.getSql(), updated.getParams());
int i = statement.executeUpdate();
cleanup(statement);
return i;
} catch (SQLException e) {
LOG.warning("Failed to execute: " + sql + " because: " + e.getMessage());
throw e;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2475 +/- ##
==================================================
+ Coverage 67.1472% 67.1568% +0.0097%
- Complexity 30944 30951 +7
==================================================
Files 1438 1438
Lines 120148 120162 +14
Branches 21311 21311
==================================================
+ Hits 80676 80697 +21
+ Misses 32724 32721 -3
+ Partials 6748 6744 -4
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…thRows/callWithAllRows
https://issues.apache.org/jira/browse/GROOVY-11936