sky.engine.connector.database
Class DBRowIterator

java.lang.Object
  extended bysky.engine.connector.database.DBRowIterator

public class DBRowIterator
extends java.lang.Object

DBRowIterator is an interface over JDBC ResultSet and ResultSetMetaData classes which has the ability to iterate over the rows in the result set, fetch, modify, or delete data in the current row.

$RCSfile: DBRowIterator.java,v $
$Revision: 1.4 $, $Date: 2005/04/24 03:14:03 $


Field Summary
protected  int _id
          id of the query that led to creation of this row iterator.
protected  java.sql.ResultSet _rset
          JDBC result set object produced by executing query with id _id.
protected  java.sql.ResultSetMetaData _rsmd
          JDBC ResultSetMetaData object produced by executing the query with id _id.
static FormattedResourceBundle STRINGS
           
 
Constructor Summary
DBRowIterator(int id, java.sql.ResultSet rset, java.sql.ResultSetMetaData rsmd)
          Constructor
 
Method Summary
 boolean absolute(int row)
          Position this row iterator over the row with specified id.
 void deleteRow()
           
 boolean first()
          Position this Row Iterator over the first row of the result set.
 DBCachedRow getCachedRow()
          Get the current row as a DBCachedRow object.
 int getCursorDirection()
           
 java.lang.String getCursorName()
           
 DBDirectRow getDirectRow()
          Get current row as DBDirectRow object.
 int getFetchSize()
           
 int getPos()
          Get absolute position of the current row.
 boolean hasData()
          Check if there are any rows in the result set.
 void insertRow(DBRow row)
           
 boolean isFirst()
          Is the row positioned over the first row.
 boolean isLast()
          Is the row positioned over the last row.
 boolean last()
          Position this Row Iterator over the last row of the result set.
 boolean next()
          Position this row iterator over the next row of the result set.
 boolean previous()
          Position this row iterator over the previous row of the result set.
 boolean relative(int rows)
          Position this row iterator over the row which is at specified offset with the current row.
 boolean rowDeleted()
           
 boolean rowInserted()
           
 boolean rowUpdated()
           
 void setCursorDirection(int direction)
           
 void setFetchSize(int size)
           
 void updateRow(DBRow row)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_id

protected int _id
id of the query that led to creation of this row iterator.


_rset

protected java.sql.ResultSet _rset
JDBC result set object produced by executing query with id _id.


_rsmd

protected java.sql.ResultSetMetaData _rsmd
JDBC ResultSetMetaData object produced by executing the query with id _id.


STRINGS

public static final FormattedResourceBundle STRINGS
Constructor Detail

DBRowIterator

public DBRowIterator(int id,
                     java.sql.ResultSet rset,
                     java.sql.ResultSetMetaData rsmd)
Constructor

Parameters:
id - id of the query over which this row iterator operates.
rset - ResetSet produced by executing query of specified id.
rsmd - ResultSetMetaData produced by executing query of specified id.
Method Detail

hasData

public boolean hasData()
                throws ErrorMessage
Check if there are any rows in the result set.

Returns:
true if more rows are available
Throws:
ErrorMessage - if there is a problem.

first

public boolean first()
              throws ErrorMessage
Position this Row Iterator over the first row of the result set.

Returns:
true if the iterator was successfully positioned.
Throws:
ErrorMessage - if iterator could not be appropriately positioned.

last

public boolean last()
             throws ErrorMessage
Position this Row Iterator over the last row of the result set.

Returns:
true if iterator was positioned properly else false.
Throws:
ErrorMessage - if there was a runtime error.

next

public boolean next()
             throws ErrorMessage
Position this row iterator over the next row of the result set.

Returns:
true if iterator was positioned properly else false.
Throws:
ErrorMessage - if there was a runtime error.

previous

public boolean previous()
                 throws ErrorMessage
Position this row iterator over the previous row of the result set.

Returns:
true if iterator was positioned properly else false.
Throws:
ErrorMessage - if there was a runtime error.

relative

public boolean relative(int rows)
                 throws ErrorMessage
Position this row iterator over the row which is at specified offset with the current row.

Returns:
true if iterator was positioned properly else false.
Throws:
ErrorMessage - if there was a runtime error.

absolute

public boolean absolute(int row)
                 throws ErrorMessage
Position this row iterator over the row with specified id.

Returns:
true if iterator was positioned properly else false.
Throws:
ErrorMessage - if there was a runtime error.

isFirst

public boolean isFirst()
                throws ErrorMessage
Is the row positioned over the first row.

Returns:
true if the row is positioned properly; else, false.
Throws:
ErrorMessage - if there was a runtime error.

isLast

public boolean isLast()
               throws ErrorMessage
Is the row positioned over the last row.

Returns:
true if the row is positioned properly; else, false.
Throws:
ErrorMessage - if there was a runtime error.

getPos

public int getPos()
           throws ErrorMessage
Get absolute position of the current row.

Returns:
absolute position of the current row.
Throws:
ErrorMessage - if there was a runtime error.

getCursorName

public java.lang.String getCursorName()
                               throws ErrorMessage
Throws:
ErrorMessage

getCursorDirection

public int getCursorDirection()
                       throws ErrorMessage
Throws:
ErrorMessage

setCursorDirection

public void setCursorDirection(int direction)
                        throws ErrorMessage
Throws:
ErrorMessage

getFetchSize

public int getFetchSize()
                 throws ErrorMessage
Throws:
ErrorMessage

setFetchSize

public void setFetchSize(int size)
                  throws ErrorMessage
Throws:
ErrorMessage

rowDeleted

public boolean rowDeleted()
                   throws ErrorMessage
Throws:
ErrorMessage

rowUpdated

public boolean rowUpdated()
                   throws ErrorMessage
Throws:
ErrorMessage

rowInserted

public boolean rowInserted()
                    throws ErrorMessage
Throws:
ErrorMessage

deleteRow

public void deleteRow()
               throws ErrorMessage
Throws:
ErrorMessage

updateRow

public void updateRow(DBRow row)
               throws ErrorMessage
Throws:
ErrorMessage

insertRow

public void insertRow(DBRow row)
               throws ErrorMessage
Throws:
ErrorMessage

getCachedRow

public DBCachedRow getCachedRow()
Get the current row as a DBCachedRow object.

Returns:
current row.

getDirectRow

public DBDirectRow getDirectRow()
Get current row as DBDirectRow object.

Returns:
current row.