Groovy Documentation

org.codehaus.groovy.runtime
[Java] Class SqlGroovyMethods

java.lang.Object
  org.codehaus.groovy.runtime.SqlGroovyMethods

public class SqlGroovyMethods

This class defines all the new SQL-related groovy methods which enhance the normal JDK SQL classes when inside the Groovy environment. Static methods are used with the first parameter the destination class.

Authors:
Paul King
John Hurst


Method Summary
static boolean asBoolean(GroovyResultSet grs)

Coerce a GroovyResultSet to a boolean value.

static java.util.Iterator iterator(java.sql.ResultSetMetaData resultSetMetaData)

Return an Iterator given a ResultSetMetaData.

static GroovyRowResult toRowResult(java.sql.ResultSet rs)

Returns a GroovyRowResult given a ResultSet.

static java.sql.Timestamp toTimestamp(java.util.Date d)

Return a java.sql.Timestamp given a java.util.Date.

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Method Detail

asBoolean

public static boolean asBoolean(GroovyResultSet grs)
Coerce a GroovyResultSet to a boolean value. A GroovyResultSet is coerced to false if there are no more rows to iterate over, and to true otherwise.
Parameters:
grs - the GroovyResultSet
Returns:
the boolean value
Since:
1.7.0


iterator

public static java.util.Iterator iterator(java.sql.ResultSetMetaData resultSetMetaData)
Return an Iterator given a ResultSetMetaData. Enables Groovy collection method syntactic sugar on ResultSetMetaData.
Parameters:
resultSetMetaData - the ResultSetMetaData to iterate over
Returns:
an iterator for the ResultSetMetaData
Since:
1.7


toRowResult

public static GroovyRowResult toRowResult(java.sql.ResultSet rs)
Returns a GroovyRowResult given a ResultSet.
throws:
java.sql.SQLException if a database error occurs
Parameters:
rs - a ResultSet
Returns:
the resulting GroovyRowResult
Since:
1.6.0


toTimestamp

public static java.sql.Timestamp toTimestamp(java.util.Date d)
Return a java.sql.Timestamp given a java.util.Date.
Parameters:
d - a date
Returns:
the date wrapped as a Timestamp
Since:
1.6.6


 

Groovy Documentation