|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovy.lang.GroovyObjectSupport
groovy.sql.GroovyResultSetExtension
public class GroovyResultSetExtension
GroovyResultSetExtension implements additional logic for ResultSet. Due to the version incompatibility between java6 and java5 this methods are 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 invokeing it on ResultSet.
This class is not intended to be used directly. Should be used through GroovyResultSetProxy only!
GroovyResultSet
,
GroovyResultSetProxy
Constructor Summary | |
---|---|
GroovyResultSetExtension(ResultSet set)
Creats a GroovyResultSet implementation- |
Method Summary | |
---|---|
void |
add(Map values)
Adds a new row to the result set |
void |
eachRow(Closure closure)
Call the closure once for each row in the result set. |
Object |
getAt(int index)
Supports integer based subscript operators for accessing at numbered columns starting at zero. |
Object |
getProperty(String columnName)
Gets the value of the designated column in the current row of as an Object . |
protected ResultSet |
getResultSet()
Gets the current result set. |
Object |
invokeMethod(String name,
Object args)
Invokes the given method. |
boolean |
next()
Moves the cursor down one row from its current position. |
protected int |
normalizeIndex(int index)
Takes a zero based index and convert it into an SQL based 1 based index. |
boolean |
previous()
Moves the cursor to the previous row in this getResultSet() object. |
void |
putAt(int index,
Object newValue)
Supports integer based subscript operators for updating the values of numbered columns starting at zero. |
void |
setProperty(String columnName,
Object newValue)
Updates the designated column with an Object value. |
String |
toString()
|
Methods inherited from class groovy.lang.GroovyObjectSupport |
---|
getMetaClass, setMetaClass |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public GroovyResultSetExtension(ResultSet set)
set
- the result setMethod Detail |
---|
protected ResultSet getResultSet() throws SQLException
SQLException
- if the result set can not be returnedpublic String toString()
toString
in class Object
public Object invokeMethod(String name, Object args)
GroovyObject
invokeMethod
in interface GroovyObject
invokeMethod
in class GroovyObjectSupport
name
- the name of the method to callargs
- the arguments to use for the method call
public Object getProperty(String columnName)
Object
.
getProperty
in interface GroovyObject
getProperty
in class GroovyObjectSupport
columnName
- the SQL name of the column
MissingPropertyException
- if an SQLException happens while getting the objectGroovyObject.getProperty(java.lang.String)
,
ResultSet.getObject(java.lang.String)
public void setProperty(String columnName, Object newValue)
Object
value.
setProperty
in interface GroovyObject
setProperty
in class GroovyObjectSupport
columnName
- the SQL name of the columnnewValue
- the updated value
MissingPropertyException
- if an SQLException happens while setting the new valueGroovyObject.setProperty(java.lang.String, java.lang.Object)
,
ResultSet.updateObject(java.lang.String, java.lang.Object)
public Object getAt(int index) throws SQLException
index
- is the number of the column to look at starting at 1
SQLException
- if something goes wrongResultSet.getObject(int)
public void putAt(int index, Object newValue) throws SQLException
index
- is the number of the column to look at starting at 1newValue
- the updated value
SQLException
- if something goes wrongResultSet.updateObject(java.lang.String, java.lang.Object)
public void add(Map values) throws SQLException
values
- a map containing the mappings for column names and values
SQLException
- if something goes wrongResultSet.insertRow()
,
ResultSet.updateObject(java.lang.String, java.lang.Object)
,
ResultSet.moveToInsertRow()
protected int normalizeIndex(int index) throws SQLException
index
- the raw requested index (may be negative)
SQLException
- if some exception occurs finding out the column countpublic void eachRow(Closure closure) throws SQLException
closure
- the closure to perform on each row
SQLException
- if something goes wrongpublic boolean next() throws SQLException
getResultSet()
cursor is initially positioned
before the first row; the first call to the method
next
makes 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 next
will
implicitly close it. A getResultSet()
object's
warning chain is cleared when a new row is read.
true
if the new current row is valid;
false
if there are no more rows
SQLException
- if a database access error occurspublic boolean previous() throws SQLException
getResultSet()
object.
true
if the cursor is on a valid row;
false
if it is off the result set
SQLException
- if a database access error
occurs or the result set type is TYPE_FORWARD_ONLY
|
Copyright © 2003-2009 The Codehaus. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |