Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
I want to add a "oneRow" method to the groovy.sql.Sql class.
So, instead of this :
answer = 0
sql.eachRow("select age from PERSON where firstName=James and lastName=Strachan") { row |
answer = row[0]
}
I could write something like :
result = sql.oneRow("select age from PERSON where firstName=James and lastName=Strachan").age
or like this :
result = sql.oneRow("select age from PERSON where firstName=James and lastName=Strachan")[0]