|
Groovy example source code file (SqlWithTypedResultsTest.groovy)
The Groovy SqlWithTypedResultsTest.groovy source code
package groovy.sql
/**
* @author Thomas Heller
* @version $Revision: 16054 $
*/
class SqlWithTypedResultsTest extends TestHelper {
void testSqlQuery() {
def sql = createEmptySql()
sql.execute("create table groovytest ( anint integer, astring varchar )");
def groovytest = sql.dataSet("groovytest")
groovytest.add(anint: 1, astring: "Groovy")
groovytest.add(anint: 2, astring: "rocks")
Integer id
sql.eachRow("SELECT * FROM groovytest ORDER BY anint") {
println "found ${it.astring} for id ${it.anint}"
id = it.anint
}
assert id == 2
sql.close()
}
}
Other Groovy examples (source code examples)Here is a short list of links related to this Groovy SqlWithTypedResultsTest.groovy source code file: |
Other websites by Alvin Alexander:
Life/living in Alaska (OneMansAlaska.com)
How I Sold My Business (HowISoldMyBusiness.com)
Copyright 1998-2011 Alvin Alexander, devdaily.com
All Rights Reserved.