Package org.apache.groovy.sql.extensions
Class SqlExtensions
java.lang.Object
org.apache.groovy.sql.extensions.SqlExtensions
public class SqlExtensions
extends java.lang.Object
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.
- 
Constructor SummaryConstructors Constructor Description SqlExtensions()
- 
Method SummaryModifier and Type Method Description static booleanasBoolean(GroovyResultSet grs)Coerce a GroovyResultSet to a boolean value.static java.util.Iterator<ResultSetMetaDataWrapper>iterator(java.sql.ResultSetMetaData resultSetMetaData)Return an Iterator given a ResultSetMetaData.static GroovyRowResulttoRowResult(java.sql.ResultSet rs)Returns a GroovyRowResult given a ResultSet.static java.sql.TimestamptoTimestamp(java.util.Date d)Return a java.sql.Timestamp given a java.util.Date.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
- 
Constructor Details- 
SqlExtensionspublic SqlExtensions()
 
- 
- 
Method Details- 
toRowResultReturns a GroovyRowResult given a ResultSet.- Parameters:
- rs- a ResultSet
- Returns:
- the resulting GroovyRowResult
- Throws:
- java.sql.SQLException- if a database error occurs
- Since:
- 1.6.0
 
- 
toTimestamppublic 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
 
- 
asBooleanCoerce 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
 
- 
iteratorpublic static java.util.Iterator<ResultSetMetaDataWrapper> 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
 
 
-