Skip to content

GROOVY-11936: Add Map-based named-parameter overloads for call/callWi…#2475

Merged
paulk-asert merged 1 commit into
apache:masterfrom
paulk-asert:groovy11936
Apr 21, 2026
Merged

GROOVY-11936: Add Map-based named-parameter overloads for call/callWi…#2475
paulk-asert merged 1 commit into
apache:masterfrom
paulk-asert:groovy11936

Conversation

@paulk-asert
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and callWithAllRows.
  • Ensure :name placeholders 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 original sql string even though named-parameter SQL may be rewritten by checkForNamedParams before execution. This can make troubleshooting harder because the logged SQL may not match what was actually prepared/executed. Consider logging updated.getSql() (and possibly updated.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-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.1568%. Comparing base (4a57272) to head (b0cd0e4).

Files with missing lines Patch % Lines
...jects/groovy-sql/src/main/java/groovy/sql/Sql.java 86.6667% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                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     
Files with missing lines Coverage Δ
...jects/groovy-sql/src/main/java/groovy/sql/Sql.java 65.8104% <86.6667%> (+0.2499%) ⬆️

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@paulk-asert paulk-asert merged commit c87bc4c into apache:master Apr 21, 2026
27 checks passed
@paulk-asert paulk-asert deleted the groovy11936 branch April 21, 2026 05:48
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

Successfully merging this pull request may close these issues.

3 participants