You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "paulk-asert (via GitHub)" <gi...@apache.org> on 2026/09/02 22:00:18 UTC

[PR] GROOVY-12342: report, and document, values composed into batch SQL as… [groovy]

paulk-asert opened a new pull request, #2866:
URL: https://github.com/apache/groovy/pull/2866

   … text
   
   Inside withBatch { ... } the wrapper's only SQL-accepting method takes a String, so a GString handed to it is coerced and its values become part of the statement. Every query method on Sql binds the same idiom, and the class documentation said so without qualification, so the one surface where it does not hold read exactly like the ones where it does.
   
   It is documented rather than rejected. A JDBC Statement batch may hold different statements, which is why it takes text and has nothing to bind against, and there is no parameterized equivalent to send callers to: batching heterogeneous statements, generated DDL, and identifiers that cannot be bound are all legitimate here. The module's own SqlBatchTest uses this idiom. Rejecting would remove a capability with no replacement, which is the same test applied to the quoted-expression case that is rejected precisely because removing the quotes costs nothing.
   
   So: an addBatch(GString) overload that renders and adds the command as before, and logs once per batch when a value was composed in that was not marked with Sql.expand. That mirrors asSql, which warns whenever it inlines rather than binds; the difference is that inlining is the only option here, so there is no strict mode to fall back from. Deliberate interpolation marked with Sql.expand passes quietly and now substitutes the expanded value, which plain GString rendering did not do.
   
   The documentation is the substance of the fix: the class-level guidance now carries the exception, both withBatch forms that hand out this wrapper say the commands are text, and addBatch says it on the method itself.
   
   P1 gains the rule that settles the finding's disposition: an API qualifies when it has a GString form that binds, so this surface is outside P1 rather than violating it, and the obligation is to say so and report the coercion.


-- 
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: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-12342: report, and document, values composed into batch SQL as… [groovy]

Posted by "paulk-asert (via GitHub)" <gi...@apache.org>.
paulk-asert merged PR #2866:
URL: https://github.com/apache/groovy/pull/2866


-- 
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: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-12342: report, and document, values composed into batch SQL as… [groovy]

Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #2866:
URL: https://github.com/apache/groovy/pull/2866#issuecomment-5517630848

   ## ✅ All tests passed ✅
   
   🏷️ Commit: b4ecf7717c6cd0e4ed4089d347c93c6118d8a475
   ▶️ Tests:  115607 executed
   ⚪️ Checks: 31/31 completed
   
   ---
   _Learn more about TestLens at [testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
   


-- 
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: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GROOVY-12342: report, and document, values composed into batch SQL as… [groovy]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #2866:
URL: https://github.com/apache/groovy/pull/2866#issuecomment-5517358177

   ## [Codecov](https://app.codecov.io/gh/apache/groovy/pull/2866?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `96.29630%` with `1 line` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 70.8197%. Comparing base ([`dd1fa5a`](https://app.codecov.io/gh/apache/groovy/commit/dd1fa5a88f79f71071e3b5342f8dbb4fec3f73d8?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`b4ecf77`](https://app.codecov.io/gh/apache/groovy/commit/b4ecf7717c6cd0e4ed4089d347c93c6118d8a475?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 5 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/groovy/pull/2866?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...main/java/groovy/sql/BatchingStatementWrapper.java](https://app.codecov.io/gh/apache/groovy/pull/2866?src=pr&el=tree&filepath=subprojects%2Fgroovy-sql%2Fsrc%2Fmain%2Fjava%2Fgroovy%2Fsql%2FBatchingStatementWrapper.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LXNxbC9zcmMvbWFpbi9qYXZhL2dyb292eS9zcWwvQmF0Y2hpbmdTdGF0ZW1lbnRXcmFwcGVyLmphdmE=) | 96.2963% | [0 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/groovy/pull/2866?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree graph](https://app.codecov.io/gh/apache/groovy/pull/2866/graphs/tree.svg?width=650&height=150&src=pr&token=1r45138NfQ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/groovy/pull/2866?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #2866        +/-   ##
   ==================================================
   - Coverage     70.8227%   70.8197%   -0.0031%     
   - Complexity      37011      37017         +6     
   ==================================================
     Files            1576       1576                
     Lines          134831     134858        +27     
     Branches        24970      24978         +8     
   ==================================================
   + Hits            95491      95506        +15     
   - Misses          30735      30744         +9     
   - Partials         8605       8608         +3     
   ```
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/groovy/pull/2866?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [...jects/groovy-sql/src/main/java/groovy/sql/Sql.java](https://app.codecov.io/gh/apache/groovy/pull/2866?src=pr&el=tree&filepath=subprojects%2Fgroovy-sql%2Fsrc%2Fmain%2Fjava%2Fgroovy%2Fsql%2FSql.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LXNxbC9zcmMvbWFpbi9qYXZhL2dyb292eS9zcWwvU3FsLmphdmE=) | `67.1818% <ø> (+0.0909%)` | :arrow_up: |
   | [...main/java/groovy/sql/BatchingStatementWrapper.java](https://app.codecov.io/gh/apache/groovy/pull/2866?src=pr&el=tree&filepath=subprojects%2Fgroovy-sql%2Fsrc%2Fmain%2Fjava%2Fgroovy%2Fsql%2FBatchingStatementWrapper.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LXNxbC9zcmMvbWFpbi9qYXZhL2dyb292eS9zcWwvQmF0Y2hpbmdTdGF0ZW1lbnRXcmFwcGVyLmphdmE=) | `85.5263% <96.2963%> (+5.9345%)` | :arrow_up: |
   
   ... and [9 files with indirect coverage changes](https://app.codecov.io/gh/apache/groovy/pull/2866/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: notifications-unsubscribe@groovy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org