jxDBCon 0.9z

org.sourceforge.jxdbcon.postgresql
Class PGCursorResultSet

java.lang.Object
  |
  +--org.sourceforge.jxdbcon.AbstractResultSet
        |
        +--org.sourceforge.jxdbcon.AbstractResultSetRO
              |
              +--org.sourceforge.jxdbcon.postgresql.PGCursorResultSet
All Implemented Interfaces:
ResultSet

public class PGCursorResultSet
extends AbstractResultSetRO

PGCursorResultSet is a cursor driven ResultSet. You get an instance of this class by setting the cursor name for a statement. This ResultSet fetches rows on demand. PostgreSQL's notion of cursors is different from the SQL92 standard. Especially the following is true: MOVE does move the cursor, but does not return the number of rows skipped. Thus it can't be used to move to the last row. Fetch direction can be forward and backward, but there is no notion of an absolute position.

Version:
$Revision: 1.9 $
Author:
Keve Müller

Field Summary
private  int absIdx
          The absolute position within the cursor's result.
private  PGConnection conn
          The connection we are fetching from.
private  int curIdx
          The current row within the current set.
private  boolean hasNext
           
private  PGExecResult res
          Stores up to fetchSize number of rows of the cursor's data.
private  ResultSetMetaData resMeta
          The meta data for the ResultSet.
private  AbstractStatement statement
          The statement that created this ResultSet.
 
Fields inherited from class org.sourceforge.jxdbcon.AbstractResultSet
fetchDirection, fetchSize, isClosed, resContext, resData, resTypes
 
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
PGCursorResultSet(AbstractStatement statement, Object[] rr, PGExecResult res, DefaultResultSetMetaData resMeta, int fetchSize)
           
 
Method Summary
 boolean absolute(int row)
           
 void afterLast()
           
 void beforeFirst()
           
 void close()
           
 int findColumn(String columnName)
          Find a column by name.
 boolean first()
           
 String getCursorName()
           
 ResultSetMetaData getMetaData()
           
 int getRow()
           
 Statement getStatement()
           
 boolean isAfterLast()
           
 boolean isBeforeFirst()
           
 boolean isFirst()
           
 boolean isLast()
           
 boolean last()
           
 boolean next()
           
 boolean previous()
           
 boolean relative(int rows)
           
 
Methods inherited from class org.sourceforge.jxdbcon.AbstractResultSetRO
cancelRowUpdates, deleteRow, getConcurrency, insertRow, moveToCurrentRow, moveToInsertRow, refreshRow, rowDeleted, rowInserted, rowUpdated, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateShort, updateShort, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp
 
Methods inherited from class org.sourceforge.jxdbcon.AbstractResultSet
clearWarnings, finalize, getArray, getArray, getAsciiStream, getAsciiStream, getBigDecimal, getBigDecimal, getBinaryStream, getBinaryStream, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getContext, getDate, getDate, getDate, getDate, getDouble, getDouble, getFetchDirection, getFetchSize, getFloat, getFloat, getInt, getInt, getLong, getLong, getObject, getObject, getObject, getObject, getRef, getRef, getShort, getShort, getString, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getType, getType, getURL, getURL, getWarnings, setFetchDirection, setFetchSize, wasNull
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.sql.ResultSet
getBigDecimal, getBigDecimal, getUnicodeStream, getUnicodeStream
 

Field Detail

absIdx

private int absIdx
The absolute position within the cursor's result.


conn

private PGConnection conn
The connection we are fetching from.


curIdx

private int curIdx
The current row within the current set.


hasNext

private boolean hasNext

res

private PGExecResult res
Stores up to fetchSize number of rows of the cursor's data.


resMeta

private ResultSetMetaData resMeta
The meta data for the ResultSet.


statement

private AbstractStatement statement
The statement that created this ResultSet.

Constructor Detail

PGCursorResultSet

public PGCursorResultSet(AbstractStatement statement,
                         Object[] rr,
                         PGExecResult res,
                         DefaultResultSetMetaData resMeta,
                         int fetchSize)
                  throws SQLException
Method Detail

absolute

public boolean absolute(int row)
                 throws SQLException
SQLException

afterLast

public void afterLast()
               throws SQLException
SQLException

beforeFirst

public void beforeFirst()
                 throws SQLException
SQLException

close

public void close()
Specified by:
close in interface ResultSet
Overrides:
close in class AbstractResultSet

findColumn

public int findColumn(String columnName)
               throws SQLException
Description copied from class: AbstractResultSet
Find a column by name. Extending classes should override this method. This implementation iterates over the ResultSetMetaData object returned by getMetaData.

Specified by:
findColumn in interface ResultSet
Overrides:
findColumn in class AbstractResultSet
SQLException

first

public boolean first()
              throws SQLException
SQLException

getCursorName

public String getCursorName()

getMetaData

public ResultSetMetaData getMetaData()

getRow

public int getRow()
           throws SQLException
SQLException

getStatement

public Statement getStatement()

isAfterLast

public boolean isAfterLast()
                    throws SQLException
SQLException

isBeforeFirst

public boolean isBeforeFirst()
                      throws SQLException
SQLException

isFirst

public boolean isFirst()
                throws SQLException
SQLException

isLast

public boolean isLast()
               throws SQLException
SQLException

last

public boolean last()
             throws SQLException
SQLException

next

public boolean next()
             throws SQLException
SQLException

previous

public boolean previous()
                 throws SQLException
SQLException

relative

public boolean relative(int rows)
                 throws SQLException
SQLException

jxDBCon 0.9z

Copyright © 2001,2002 Keve Müller; see LICENSE file for details.