groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Wagenleitner <john.wagenleit...@gmail.com>
Subject Re: Groovy SQL: Stored Procedure Call Not Executing configureStatement Closure
Date Fri, 11 Mar 2016 03:02:08 GMT
Hi Guillermo,

Yes, I think it was a bug.  The call method taking a closure was not
passing the created statement off to the configureStatement closure.  This
should be fixed by https://github.com/apache/groovy/pull/263 and the fix
should be in 2.4.7.

John

On Thu, Mar 10, 2016 at 1:38 PM, Guillermo Roman <
guillermo.roman.dearagon@gmail.com> wrote:

> Hi,
>
> I came across this issue while running some test cases on Groovy 2.4.5.
>
> The following code works as expected. If the stored procedure call takes
> longer than 5 seconds an SQLException will be thrown indicating that the
> query timed out:
>
> sql.withStatement { stmt ->
>             stmt.queryTimeout = 5
>         }
>
> sql.call("{call Add_User($user.email, $user.password, ${Sql.BIGINT})}")
>
> However, if I pass a closure to the stored procedure call to retrieve the
> returned values the configureStatement never gets executed and therefore
> the query timeout value is ignored:
>
> sql.withStatement { stmt ->
>             stmt.queryTimeout = 5
>         }
>
> sql.call("{call Add_User($user.email, $user.password, ${Sql.BIGINT})}”) { ID
> ->
>     println “Auto generated User ID: $ID"
> }
>
> Is this is a bug in Groovy? or am I doing something wrong?
>
> Regards,
> Guillermo Roman
>

Mime
View raw message