Package groovy.sql
Class GroovyResultSetExtension
java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.sql.GroovyResultSetExtension
- All Implemented Interfaces:
- GroovyObject
GroovyResultSetExtension implements additional logic for ResultSet. Due to
 the version incompatibility between java6 and java5 those methods were moved
 here from the original GroovyResultSet class. The methods in this class are
 used by the proxy GroovyResultSetProxy, which will try to invoke methods
 on this class before invoking it on ResultSet.
 
This class is not intended to be used directly. Should be used through GroovyResultSetProxy only!
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionCreates a GroovyResultSet implementation.
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdds a new row to the result setvoidCall the closure once for each row in the result set.getAt(int index) Supports integer based subscript operators for accessing at numbered columns starting at zero.getProperty(String columnName) Gets the value of the designated column in the current row of as anObject.protected ResultSetGets the current result set.invokeMethod(String name, Object args) Invokes the given method.booleannext()Moves the cursor down one row from its current position.protected intnormalizeIndex(int index) Takes a zero based index and convert it into an SQL based 1 based index.booleanprevious()Moves the cursor to the previous row in thisgetResultSet()object.voidSupports integer based subscript operators for updating the values of numbered columns starting at zero.voidsetProperty(String columnName, Object newValue) Updates the designated column with anObjectvalue.toString()Methods inherited from class groovy.lang.GroovyObjectSupportgetMetaClass, setMetaClass
- 
Constructor Details- 
GroovyResultSetExtensionCreates a GroovyResultSet implementation.- Parameters:
- set- the result set
 
 
- 
- 
Method Details- 
getResultSetGets the current result set.- Returns:
- the result set
- Throws:
- SQLException- if the result set can not be returned
 
- 
toString
- 
invokeMethodDescription copied from interface:GroovyObjectInvokes the given method.- Parameters:
- name- the name of the method to call
- args- the arguments to use for the method call
- Returns:
- the result of invoking the method
 
- 
getPropertyGets the value of the designated column in the current row of as anObject.- Parameters:
- columnName- the SQL name of the column
- Returns:
- the returned column value
- Throws:
- MissingPropertyException- if an SQLException happens while getting the object
- See Also:
 
- 
setPropertyUpdates the designated column with anObjectvalue.- Parameters:
- columnName- the SQL name of the column
- newValue- the updated value
- Throws:
- MissingPropertyException- if an SQLException happens while setting the new value
- See Also:
 
- 
getAtSupports integer based subscript operators for accessing at numbered columns starting at zero. Negative indices are supported, they will count from the last column backwards.- Parameters:
- index- is the number of the column to look at starting at 1
- Returns:
- the returned column value
- Throws:
- SQLException- if something goes wrong
- See Also:
 
- 
putAtSupports integer based subscript operators for updating the values of numbered columns starting at zero. Negative indices are supported, they will count from the last column backwards.- Parameters:
- index- is the number of the column to look at starting at 1
- newValue- the updated value
- Throws:
- SQLException- if something goes wrong
- See Also:
 
- 
addAdds a new row to the result set- Parameters:
- values- a map containing the mappings for column names and values
- Throws:
- SQLException- if something goes wrong
- See Also:
 
- 
normalizeIndexTakes a zero based index and convert it into an SQL based 1 based index. A negative index will count backwards from the last column.- Parameters:
- index- the raw requested index (may be negative)
- Returns:
- a JDBC index
- Throws:
- SQLException- if some exception occurs finding out the column count
 
- 
eachRowCall the closure once for each row in the result set.- Parameters:
- closure- the closure to perform on each row
- Throws:
- SQLException- if something goes wrong
 
- 
nextMoves the cursor down one row from its current position. AgetResultSet()cursor is initially positioned before the first row; the first call to the methodnextmakes the first row the current row; the second call makes the second row the current row, and so on.If an input stream is open for the current row, a call to the method nextwill implicitly close it. AgetResultSet()object's warning chain is cleared when a new row is read.- Returns:
- trueif the new current row is valid;- falseif there are no more rows
- Throws:
- SQLException- if a database access error occurs
 
- 
previousMoves the cursor to the previous row in thisgetResultSet()object.- Returns:
- trueif the cursor is on a valid row;- falseif it is off the result set
- Throws:
- SQLException- if a database access error occurs or the result set type is- TYPE_FORWARD_ONLY
- Since:
- 1.2
 
 
-