[
https://issues.apache.org/jira/browse/GROOVY-11936?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18075044#comment-18075044
]
ASF GitHub Bot commented on GROOVY-11936:
-----------------------------------------
paulk-asert merged PR #2475:
URL: https://github.com/apache/groovy/pull/2475
> Add Map-based named-parameter overloads for call/callWithRows/callWithAllRows
> -----------------------------------------------------------------------------
>
> Key: GROOVY-11936
> URL: https://issues.apache.org/jira/browse/GROOVY-11936
> Project: Groovy
> Issue Type: Improvement
> Components: SQL processing
> Reporter: Paul King
> Priority: Major
>
> This is to capture a hidden feature proposal from [~oniseijin] buried in
> comments in GROOVY-7768.
> Basically:
> {code:groovy}
> sql.callWithAllRows '{call sp_who(:id)}', [id: 'myid'], { /* no out params */
> }
> {code}
> Instead of:
> {code:groovy}
> sql.callWithAllRows '{call sp_who(?)}', ['myid'], { ... }
> {code}
> Or another contrived example:
> {code:groovy}
> def rows = sql.callWithRows '{call FindAllByFirstWithTotal(:first, :total)}',
> [first: 'J', total: Sql.VARCHAR], { total ->
> assert total == 'Found total 2'
> }
> assert rows.size() == 2
> {code}
> Or this:
> {code:groovy}
> def rowList = sql.callWithAllRows
> '{call FindAllByFirstAndFindAllByLastWithTotals(:first, :last, :firstOut,
> :lastOut)}',
> [first: 'J', last: 'V', firstOut: Sql.VARCHAR, lastOut: Sql.VARCHAR],
> { firstTotal, lastTotal ->
> assert firstTotal == 'Found total 2'
> assert lastTotal == 'Found total 1'
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)