0
votes

I have a statement:

sqlInstance.execute(executeString){
                    dummy, realList->
                    debug("Real LIst: "+realList)

                    }

which fails with 'Invalid column type'

But:

def bool = sqlInstance.execute(executeString)

works. If I print bool, it prints as 'true'.

For reference:

executeString = "select distinct channel_id from guide_sched"

For some reason, the closure isn't working for the execute method in groovy's Sql, although I've checked the documentation and it's supposed to.

1
Can you also mention what is sqlInstance and how is it instantiated? - dmahapatro
Also include your error message. And what are the types of dummy and realList? The docs say that the closure takes "two parameters: either true plus a list of GroovyRowResult values derived from statement.getResultSet() or false plus the update count from statement.getUpdateCount()". Your closure params don't sound like they match that. - Keegan

1 Answers

0
votes

It looks like the first environment I was testing on ran Groovy 2.4 and the second runs Groovy 2.1. The execute statement I was using didn't exist until after 2.1

Instead, I used the .rows() function to return a GroovyRowResult which I parsed for the information I needed, instead of accessing it directly in the .execute() closure.