When an error/exception occurs within the eachRow closure, I have found
that the script will hang with no error output. Putting a simple syntax
error inside the closure will reproduce the behaviour.
Am I doing something wrong, or is this a bug?
Thanks,
Dan
--
Dan Fraser
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
Do you have an example that replicates this problem?
Tim
dfraser$ groovy -cp ../lib/mysql-connector-java-5.1.18-bin.jar
Poptool.groovy
fizz
in loop
[hang]
It doesn't actually exit or print anything else.
Do you see a problem?
If I remove the throw, it gets to about 11500 rows and then hangs, probably
due to an exception, and I'm not sure why because there is no error message!
--snip--
package com.company.poptool
import groovy.sql.Sql
def sql = Sql.newInstance("jdbc:mysql://localhost:3306/pop", "user",
"pass", "com.mysql.jdbc.Driver")
sql.withStatement{ stmt -> stmt.fetchSize = Integer.MIN_VALUE }
def archiveTable = 'arch_2012-01-16'
def count = 0;
println("fizz")
sql.eachRow("select * from `${Sql.expand archiveTable}`") { row ->
count ++
println("in loop")
if (count % 100 == 0) {
println count
}
throw new IllegalArgumentException("boo!")
}
println("buzz")
--
View this message in context: http://groovy.329449.n5.nabble.com/No-errors-exceptions-when-using-Sql-eachRow-in-Groovy-1-8-5-tp5451985p5453942.html
Sent from the groovy - user mailing list archive at Nabble.com.
I tried your example with both Informix and PostgreSQL but was unable
to reproduce the problem. The things I had to change to be able to run
the example are:
* set the fetchSize to a positive number
* removed the "`" from the query
I don't think the culprit is groovy.sql.Sql as I don't see anything in
the source that would cause the hang, could it be MySQL's driver? Have
you tried another DBMS?
Cheers,
Dinko
Hi Dan,
I tried your example with both Informix and PostgreSQL but was unable
to reproduce the problem. The things I had to change to be able to run
the example are:
* set the fetchSize to a positive number
* removed the "`" from the query
I don't think the culprit is groovy.sql.Sql as I don't see anything in
the source that would cause the hang, could it be MySQL's driver? Have
you tried another DBMS?
Cheers,
Dinko
If you reply to this email, your message will be added to the discussion below:http://groovy.329449.n5.nabble.com/No-errors-exceptions-when-using-Sql-eachRow-in-Groovy-1-8-5-tp5451985p5456593.html