Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.5.6
-
Fix Version/s: 1.5.7, 1.6-beta-2
-
Component/s: SQL processing
-
Labels:None
-
Environment:Windows XP SP2, Groovy 1.5.6, Java JDK 1.6.0
-
Number of attachments :
Description
Groovy allows this:
sql.rows(someQuery).each
{ Map row -> def item = new ItemThatTakesAMap(row) }But not this:
sql.eachRow(someQuery) { Map row -> def item = newItemThatTakesAMap(row) }
Shoudn't sql.eachRow also implement the Map interface?
Best regards.
The methods are different and have different features. It would be difficult to make them identical without giving up some of the benefits of one over the other. Instead I have added a DGM method to convert from ResultSet to GroovyRowResult, i.e. you can have this:
sql.eachRow(someQuery) { ResultSet rs -> def item = new ItemThatTakesAMap(rs.toRowResult()) }