public class GroovyResultSetExtension extends GroovyObjectSupport
This class is not intended to be used directly. Should be used through GroovyResultSetProxy only!
GroovyResultSet
,
GroovyResultSetProxy
Constructor and Description |
---|
GroovyResultSetExtension(java.sql.ResultSet set)
Creats a GroovyResultSet implementation-
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.util.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.
|
java.lang.Object |
getAt(int index)
Supports integer based subscript operators for accessing at numbered columns
starting at zero.
|
java.lang.Object |
getProperty(java.lang.String columnName)
Gets the value of the designated column in the current row
of as an
Object . |
protected java.sql.ResultSet |
getResultSet()
Gets the current result set.
|
java.lang.Object |
invokeMethod(java.lang.String name,
java.lang.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,
java.lang.Object newValue)
Supports integer based subscript operators for updating the values of numbered columns
starting at zero.
|
void |
setProperty(java.lang.String columnName,
java.lang.Object newValue)
Updates the designated column with an
Object value. |
java.lang.String |
toString() |
getMetaClass, setMetaClass
public GroovyResultSetExtension(java.sql.ResultSet set)
set
- the result setprotected java.sql.ResultSet getResultSet() throws java.sql.SQLException
java.sql.SQLException
- if the result set can not be returnedpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args)
GroovyObject
invokeMethod
in interface GroovyObject
invokeMethod
in class GroovyObjectSupport
public java.lang.Object getProperty(java.lang.String columnName)
Object
.getProperty
in interface GroovyObject
getProperty
in class GroovyObjectSupport
columnName
- the SQL name of the columnMissingPropertyException
- if an SQLException happens while getting the objectGroovyObject.getProperty(java.lang.String)
,
ResultSet.getObject(java.lang.String)
public void setProperty(java.lang.String columnName, java.lang.Object newValue)
Object
value.setProperty
in interface GroovyObject
setProperty
in class GroovyObjectSupport
columnName
- the SQL name of the columnMissingPropertyException
- if an SQLException happens while getting the objectGroovyObject.setProperty(java.lang.String, java.lang.Object)
,
ResultSet.updateObject(java.lang.String, java.lang.Object)
public java.lang.Object getAt(int index) throws java.sql.SQLException
index
- is the number of the column to look at starting at 1java.sql.SQLException
ResultSet.getObject(int)
public void putAt(int index, java.lang.Object newValue) throws java.sql.SQLException
index
- is the number of the column to look at starting at 1java.sql.SQLException
ResultSet.updateObject(java.lang.String, java.lang.Object)
public void add(java.util.Map values) throws java.sql.SQLException
values
- a map containing the mappings for column names and valuesjava.sql.SQLException
ResultSet.insertRow()
,
ResultSet.updateObject(java.lang.String, java.lang.Object)
,
ResultSet.moveToInsertRow()
protected int normalizeIndex(int index) throws java.sql.SQLException
index
- java.sql.SQLException
- if some exception occurs finding out the column countpublic void eachRow(Closure closure) throws java.sql.SQLException
closure
- java.sql.SQLException
public boolean next() throws java.sql.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 rowsjava.sql.SQLException
- if a database access error occurspublic boolean previous() throws java.sql.SQLException
getResultSet()
object.true
if the cursor is on a valid row;
false
if it is off the result setjava.sql.SQLException
- if a database access error
occurs or the result set type is TYPE_FORWARD_ONLY