groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillermo Roman <guillermo.roman.deara...@gmail.com>
Subject Groovy SQL: Stored Procedure Call Not Executing configureStatement Closure
Date Thu, 10 Mar 2016 21:38:26 GMT
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