sqlj.runtime
Interface Scrollable

All Known Implementing Classes:
ScrollableResultSetIterImpl

public abstract interface Scrollable

An interface implemented by scrollable iterators


Method Summary
 boolean absolute(int row)
          Moves the iterator object to the given row number in the result set.
 void afterLast()
          Moves the iterator object to the end of the result set, just after the last row.
 void beforeFirst()
          Moves the iterator object to the front of the result set, just before the first row.
 boolean first()
          Moves the iterator object to the first row in the result set.
 int getFetchDirection()
          Retrieves the direction for fetching rows from database tables for this iterator object.
 boolean isAfterLast()
          Indicates whether the iterator object is after the last row in the result set.
 boolean isBeforeFirst()
          Indicates whether the iterator object is before the first row in the result set.
 boolean isFirst()
          Indicates whether the iterator object is on the first row of the result set.
 boolean isLast()
          Indicates whether the iterator object is on the last row of the result set.
 boolean last()
          Moves the iterator object to the last row in the result set.
 boolean previous()
          Moves the iterator object to the previous row in the result set.
 boolean relative(int rows)
          Moves the iterator object a relative number of rows, either positive or negative.
 void setFetchDirection(int direction)
          Gives the SQLJ runtime a hint as to the direction in which rows of this iterator object are processed.
 

Method Detail

absolute

public boolean absolute(int row)
                 throws java.sql.SQLException
Moves the iterator object to the given row number in the result set.

If the row number is positive, the iterator object moves to the given row number with respect to the beginning of the result set. The first row is row 1, the second is row 2, and so on.

If the given row number is negative, the iterator object moves to an absolute row position with respect to the end of the result set. For example, calling absolute(-1) positions the iterator object on the last row, absolute(-2) indicates the next-to-last row, and so on.

An attempt to position the iterator object beyond the first/last row in the result set leaves the iterator object before/after the first/last row, respectively.

Note: Calling absolute(1) is the same as calling first(). Calling absolute(-1) is the same as calling last().

Returns:
true if the iterator object is on the result set; false otherwise
Throws:
java.sql.SQLException - if a database access error occurs or row is 0

afterLast

public void afterLast()
               throws java.sql.SQLException
Moves the iterator object to the end of the result set, just after the last row. Has no effect if the result set contains no rows.
Throws:
java.sql.SQLException - if a database access error occurs

beforeFirst

public void beforeFirst()
                 throws java.sql.SQLException
Moves the iterator object to the front of the result set, just before the first row. Has no effect if the result set contains no rows.
Throws:
java.sql.SQLException - if a database access error occurs

first

public boolean first()
              throws java.sql.SQLException
Moves the iterator object to the first row in the result set.
Returns:
true if the iterator object is on a valid row; false if there are no rows in the result set
Throws:
java.sql.SQLException - if a database access error occurs

getFetchDirection

public int getFetchDirection()
                      throws java.sql.SQLException
Retrieves the direction for fetching rows from database tables for this iterator object. If this iterator object has not set a fetch direction by calling the method setFetchDirection, the return value is implementation-specific.
Returns:
the fetch direction for this iterator object.
Throws:
java.sql.SQLException - if a database access error occurs.

isAfterLast

public boolean isAfterLast()
                    throws java.sql.SQLException
Indicates whether the iterator object is after the last row in the result set.
Returns:
true if the iterator object is after the last row, false otherwise. Returns false when the result set contains no rows.
Throws:
java.sql.SQLException - if a database access error occurs

isBeforeFirst

public boolean isBeforeFirst()
                      throws java.sql.SQLException
Indicates whether the iterator object is before the first row in the result set.
Returns:
true if the iterator object is before the first row, false otherwise. Returns false when the result set contains no rows.
Throws:
java.sq1l.SQLException - if a database access error occurs

isFirst

public boolean isFirst()
                throws java.sql.SQLException
Indicates whether the iterator object is on the first row of the result set.
Returns:
true if the iterator object is on the first row, false otherwise.
Throws:
java.sql.SQLException - - if a database access error occurs

isLast

public boolean isLast()
               throws java.sql.SQLException
Indicates whether the iterator object is on the last row of the result set.

Note: Calling the method isLast may be expensive because the SQLJ driver might need to fetch ahead one row in order to determine whether the current row is the last row in the result set.

Returns:
true if the iterator object is on the last row, false otherwise.
Throws:
java.sql.SQLException - if a database access error occurs

last

public boolean last()
             throws java.sql.SQLException
Moves the iterator object to the last row in the result set.
Returns:
true if the iterator object is on a valid row; false if there are no rows in the result set
Throws:
java.sql.SQLException - if a database access error occurs.

previous

public boolean previous()
                 throws java.sql.SQLException
Moves the iterator object to the previous row in the result set.
Returns:
true if the iterator object is on a valid row; false if it is off the result set
Throws:
java.sql.SQLException - if a database access error occurs

relative

public boolean relative(int rows)
                 throws java.sql.SQLException
Moves the iterator object a relative number of rows, either positive or negative. Attempting to move beyond the first/last row in the result set positions the iterator object before/after the first/last row. Calling relative(0) is valid, but does not change the iterator object position.
Returns:
true if the iterator object is on a row; false otherwise
Throws:
java.sql.SQLException - if a database access error occurs, or there is no current row.

setFetchDirection

public void setFetchDirection(int direction)
                       throws java.sql.SQLException
Gives the SQLJ runtime a hint as to the direction in which rows of this iterator object are processed. The default value is sqlj.runtime.ResultSetIterator.FETCH_FORWARD.
Parameters:
direction - the initial direction for processing rows.
Throws:
java.sql.SQLException - if a database access error occurs, or the or the given direction is not one of ResultSetIterator.FETCH_FORWARD, ResultSetIterator.FETCH_REVERSE, or ResultSetIterator.FETCH_UNKNOWN.