org.eigenbase.runtime
Class AbstractIterResultSet

java.lang.Object
  extended by org.eigenbase.jdbc4.Unwrappable
      extended by org.eigenbase.util14.AbstractResultSet
          extended by org.eigenbase.runtime.AbstractIterResultSet
All Implemented Interfaces:
ResultSet
Direct Known Subclasses:
IteratorResultSet, TupleIterResultSet

public abstract class AbstractIterResultSet
extends AbstractResultSet

AbstractIterResultSet provides functionality common to all ResultSet implementations that convert from iterator convention.

Version:
$Id: //open/dev/farrago/src/org/eigenbase/runtime/AbstractIterResultSet.java#11 $
Author:
Stephan Zuercher

Nested Class Summary
static interface AbstractIterResultSet.ColumnGetter
          A ColumnGetter retrieves a column from an input row based upon its 1-based ordinal.
static class AbstractIterResultSet.FieldGetter
          A FieldGetter retrieves each public field as a separate column.
 class AbstractIterResultSet.MetaData
           
static class AbstractIterResultSet.SingletonColumnGetter
          A SingletonColumnGetter retrieves the object itself.
static class AbstractIterResultSet.SqlTimeoutException
          Indicates that an operation timed out.
static class AbstractIterResultSet.SyntheticColumnGetter
          A SyntheticColumnGetter retrieves columns from a synthetic object.
 
Field Summary
private  AbstractIterResultSet.ColumnGetter columnGetter
           
protected  Object current
           
protected  int row
           
protected  long timeoutMillis
           
 
Fields inherited from class org.eigenbase.util14.AbstractResultSet
fetchSize, maxRows, wasNull
 
Fields inherited from interface java.sql.ResultSet
CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE
 
Constructor Summary
protected AbstractIterResultSet(AbstractIterResultSet.ColumnGetter columnGetter)
           
 
Method Summary
private  String[] getColumnNames()
           
 int getFetchSize()
           
 ResultSetMetaData getMetaData()
           
protected  Object getRaw(int columnIndex)
          Returns the raw value of a column as an object.
 int getRow()
           
 boolean isAfterLast()
           
 boolean isBeforeFirst()
           
 boolean isFirst()
           
 boolean isLast()
           
 void setFetchSize(int rows)
           
 void setTimeout(long timeoutMillis)
          Sets the timeout that this AbstractIterResultSet will wait for a row from the underlying iterator.
 
Methods inherited from class org.eigenbase.util14.AbstractResultSet
absolute, afterLast, beforeFirst, cancelRowUpdates, clearWarnings, close, deleteRow, findColumn, first, getArray, getArray, getAsciiStream, getAsciiStream, getBigDecimal, getBigDecimal, getBigDecimal, getBigDecimal, getBinaryStream, getBinaryStream, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getConcurrency, getCursorName, getDate, getDate, getDate, getDate, getDouble, getDouble, getFetchDirection, getFloat, getFloat, getHoldability, getInt, getInt, getLong, getLong, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getObject, getObject, getRaw, getRef, getRef, getRowId, getRowId, getShort, getShort, getSQLXML, getSQLXML, getStatement, getString, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getURL, getURL, getWarnings, insertRow, isClosed, last, moveToCurrentRow, moveToInsertRow, newConversionError, newConversionError, newDirectionError, newFetchError, newUpdatabilityError, previous, refreshRow, relative, rowDeleted, rowInserted, rowUpdated, setFetchDirection, setMaxRows, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateClob, updateClob, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNString, updateNString, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateRowId, updateRowId, updateShort, updateShort, updateSQLXML, updateSQLXML, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp, wasNull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.sql.ResultSet
next
 

Field Detail

columnGetter

private final AbstractIterResultSet.ColumnGetter columnGetter

current

protected Object current

row

protected int row

timeoutMillis

protected long timeoutMillis
Constructor Detail

AbstractIterResultSet

protected AbstractIterResultSet(AbstractIterResultSet.ColumnGetter columnGetter)
Method Detail

getColumnNames

private String[] getColumnNames()

setTimeout

public void setTimeout(long timeoutMillis)
Sets the timeout that this AbstractIterResultSet will wait for a row from the underlying iterator. Note that the timeout must be implemented in the abstract method ResultSet.next().

Parameters:
timeoutMillis - Timeout in milliseconds. Must be greater than zero.
"Precondition:"
timeoutMillis > 0, this.timeoutMillis == 0

isAfterLast

public boolean isAfterLast()
                    throws SQLException
Specified by:
isAfterLast in interface ResultSet
Overrides:
isAfterLast in class AbstractResultSet
Throws:
SQLException

isBeforeFirst

public boolean isBeforeFirst()
                      throws SQLException
Specified by:
isBeforeFirst in interface ResultSet
Overrides:
isBeforeFirst in class AbstractResultSet
Throws:
SQLException

setFetchSize

public void setFetchSize(int rows)
                  throws SQLException
Specified by:
setFetchSize in interface ResultSet
Overrides:
setFetchSize in class AbstractResultSet
Throws:
SQLException

getFetchSize

public int getFetchSize()
                 throws SQLException
Specified by:
getFetchSize in interface ResultSet
Overrides:
getFetchSize in class AbstractResultSet
Throws:
SQLException

isFirst

public boolean isFirst()
                throws SQLException
Specified by:
isFirst in interface ResultSet
Overrides:
isFirst in class AbstractResultSet
Throws:
SQLException

isLast

public boolean isLast()
               throws SQLException
Specified by:
isLast in interface ResultSet
Overrides:
isLast in class AbstractResultSet
Throws:
SQLException

getMetaData

public ResultSetMetaData getMetaData()
                              throws SQLException
Throws:
SQLException

getRow

public int getRow()
           throws SQLException
Specified by:
getRow in interface ResultSet
Overrides:
getRow in class AbstractResultSet
Throws:
SQLException

getRaw

protected Object getRaw(int columnIndex)
Returns the raw value of a column as an object.

Specified by:
getRaw in class AbstractResultSet
Parameters:
columnIndex - Column index, 1-based