Overview | Package | Class
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## groovy.sql
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!

author:
  Jochen Theodorou

see:
  GroovyResultSet

see:
  GroovyResultSetProxy

Field Summary
`ResultSet` | `resultSet`
`boolean` | `updated`

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`.
`ResultSet` | `getResultSet()` Gets the current result set.
`Object` | `invokeMethod(String name, Object args)`
`boolean` | `next()` Moves the cursor down one row from its current position.
`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()`

Constructor Detail

### GroovyResultSetExtension

    public GroovyResultSetExtension(ResultSet set)

  Creats a GroovyResultSet implementation-
  param:
    set the result set

Method Detail

### add

    public void add(Map values)

  Adds a new row to the result set
  param:
    values a map containing the mappings for column names and values
  throws:
    java.sql.SQLException if something goes wrong
  see:
    ResultSet#insertRow()
  see:
    ResultSet#updateObject(java.lang.String, java.lang.Object)
  see:
    ResultSet#moveToInsertRow()

### eachRow

    public void eachRow(Closure closure)

  Call the closure once for each row in the result set.
  param:
    closure the closure to perform on each row
  throws:
    SQLException if something goes wrong

### getAt

    public Object getAt(int index)

  Supports integer based subscript operators for accessing at numbered columns starting at zero. Negative indices are supported, they will count from the last column backwards.
  param:
    index is the number of the column to look at starting at 1
  return:
    the returned column value
  throws:
    java.sql.SQLException if something goes wrong
  see:
    ResultSet#getObject(int)

### getProperty

    public Object getProperty(String columnName)

  Gets the value of the designated column in the current row of as an `Object`.
  param:
    columnName the SQL name of the column
  return:
    the returned column value
  throws:
    MissingPropertyException if an SQLException happens while getting the object
  see:
    GroovyObject#getProperty
  see:
    ResultSet#getObject(java.lang.String)

### getResultSet

    ResultSet getResultSet()

  Gets the current result set.
  return:
    the result set
  throws:
    SQLException if the result set can not be returned

### invokeMethod

    public Object invokeMethod(String name, Object args)

### next

    public boolean next()

  Moves the cursor down one row from its current position. A `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.

  return:
    `true` if the new current row is valid;
  `false` if there are no more rows
  throws:
    SQLException if a database access error occurs

### normalizeIndex

    int normalizeIndex(int index)

  Takes a zero based index and convert it into an SQL based 1 based index. A negative index will count backwards from the last column.
  param:
    index the raw requested index (may be negative)
  return:
    a JDBC index
  throws:
    SQLException if some exception occurs finding out the column count

### previous

    public boolean previous()

  Moves the cursor to the previous row in this `getResultSet()` object.
  return:
    `true` if the cursor is on a valid row;
  `false` if 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

### putAt

    public void putAt(int index, Object newValue)

  Supports 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.
  param:
    index is the number of the column to look at starting at 1
  param:
    newValue the updated value
  throws:
    java.sql.SQLException if something goes wrong
  see:
    ResultSet#updateObject(java.lang.String, java.lang.Object)

### setProperty

    public void setProperty(String columnName, Object newValue)

  Updates the designated column with an `Object` value.
  param:
    columnName the SQL name of the column
  param:
    newValue the updated value
  throws:
    MissingPropertyException if an SQLException happens while setting the new value
  see:
    GroovyObject#setProperty
  see:
    ResultSet#updateObject(java.lang.String, java.lang.Object)

### toString

    public String toString()