sqlj.runtime
Interface Scrollable


public interface Scrollable

This interface is not usable with Open SQL / SQLJ. Scrollable result sets are not supported in Open SQL for Java.

This interface provides a set of methods that all scrollable iterator objects support. The effect of an update on a Scrollable iterator object is implementation-defined.


Method Summary
 boolean absolute(int row)
          Moves the iterator object to the row with the given row number.
 void afterLast()
          Moves the iterator object to immediately after its last row.
 void beforeFirst()
          Moves the iterator object to immediately before its first row.
 boolean first()
          Moves the iterator object to its first row.
 int getFetchDirection()
          Retrieves the direction for fetching rows for this iterator object.
 boolean isAfterLast()
          Indicates whether the iterator object is after its last row.
 boolean isBeforeFirst()
          Indicates whether the iterator object is before its first row.
 boolean isFirst()
          Indicates whether the iterator object is on its first row.
 boolean isLast()
          Indicates whether the iterator object is on its last row.
 boolean last()
          Moves the iterator object to its last row.
 boolean previous()
          Moves the iterator object to its previous row.
 boolean relative(int rows)
          Moves the iterator object the given number of rows, either positive or negative, from its current position.
 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 row with the given row number. If the row number is positive, the iterator object moves to the row with the given row number with respect to its beginning. 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 its end. 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 its first or last row leaves the iterator object before or after its first or last row, respectively.
Returns:
true if iterator object is on a row
Throws:
java.sql.SQLException - if a database access error occurs or row is 0 (zero).

afterLast

public void afterLast()
               throws java.sql.SQLException
Moves the iterator object to immediately after its last row. Has no effect if the iterator object 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 immediately before its first row. Has no effect if the iterator object 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 its first row.
Returns:
true if the iterator object is on a row; if there are no rows, then false.
Throws:
java.sql.SQLException - if a database access error occurs

getFetchDirection

public int getFetchDirection()
                      throws java.sql.SQLException
Retrieves the direction for fetching rows for this iterator object. If this iterator object has not set a fetch direction by calling the method setFetchDirection( ), then the value returned is the default specified in Subclause 13.1.6.2.13, setFetchDirection (int).
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 its last row.
Returns:
If the iterator object is positioned after its last row, then true; otherwise false. Returns false when the iterator object 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 its first row.
Throws:
java.sql.SQLException - if a database access error occurs

isFirst

public boolean isFirst()
                throws java.sql.SQLException
Indicates whether the iterator object is on its first row.
Returns:
If the iterator object is positioned on its first row, then true; otherwise false. Returns false when the iterator object contains no rows.
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 its last row.
Returns:
If the iterator object is positioned on its last row, then true; otherwise false. Returns false when the iterator object contains no rows.
Throws:
java.sql.SQLException - if a database access error occurs

last

public boolean last()
             throws java.sql.SQLException
Moves the iterator object to its last row.
Returns:
If the iterator object is positioned on a row, then true; otherwise false. Returns false when the iterator object contains no rows.
Throws:
java.sql.SQLException - if a database access error occurs

previous

public boolean previous()
                 throws java.sql.SQLException
Moves the iterator object to its previous row.
Returns:
If the iterator object is positioned on a row, then true; if it is positioned before its first row or after its last row, then false. Returns false when the iterator object contains no rows.
Throws:
java.sql.SQLException - if a database access error occurs

relative

public boolean relative(int rows)
                 throws java.sql.SQLException
Moves the iterator object the given number of rows, either positive or negative, from its current position. Attempting to move beyond its first or last row positions the iterator object before or after its first or last row, respectively. Invoking relative(0) is valid, but does not change the iterator object position.
Returns:
If the iterator object is positioned on a row, then true; otherwise false. Returns false when the iterator object contains no rows.
Throws:
java.sql.SQLException - if a database access error occurs

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.
Throws:
java.sql.SQLException - if a database access error occurs, or the given direction is not one of ResultSetIterator.FETCH_FORWARD, ResultSetIterator.FETCH_REVERSE, or ResultSetIterator.FETCH_UNKNOWN.