sqlj.runtime.Scrollable interface

sqlj.runtime.Scrollable provides methods to move around in the result table and to check the position in the result table.

sqlj.runtime.Scrollable is implemented when a scrollable iterator is declared.

Methods

absolute(int)
Format:
public abstract boolean absolute (int n) throws SQLException

Moves the iterator to a specified row.

If n>0, positions the iterator on row n of the result table. If n<0, and m is the number of rows in the result table, positions the iterator on row m+n+1 of the result table.

If the absolute value of n is greater than the number of rows in the result table, positions the cursor after the last row if n is positive, or before the first row if n is negative.

absolute(0) is the same as beforeFirst(). absolute(1) is the same as first(). absolute(-1) is the same as last().

Returns true if the iterator is on a row. Otherwise, returns false.

afterLast()
Format:
public abstract void afterLast() throws SQLException

Moves the iterator after the last row of the result table.

beforeFirst()
Format:
public abstract void beforeFirst() throws SQLException

Moves the iterator before the first row of the result table.

first()
Format:
public abstract boolean first() throws SQLException

Moves the iterator to the first row of the result table.

Returns true if the iterator is on a row. Otherwise, returns false.

getFetchDirection()
Format:
public abstract int getFetchDirection() throws SQLException
Returns the fetch direction of the iterator. Possible values are:
sqlj.runtime.ResultSetIterator.FETCH_FORWARD
Rows are processed in a forward direction, from first to last.
sqlj.runtime.ResultSetIterator.FETCH_REVERSE
Rows are processed in a backward direction, from last to first.
sqlj.runtime.ResultSetIterator.FETCH_UNKNOWN
The order of processing is not known.
isAfterLast()
Format:
public abstract boolean isAfterLast() throws SQLException

Returns true if the iterator is positioned after the last row of the result table. Otherwise, returns false.

isBeforeFirst()
Format:
public abstract boolean isBeforeFirst() throws SQLException

Returns true if the iterator is positioned before the first row of the result table. Otherwise, returns false.

isFirst()
Format:
public abstract boolean isFirst() throws SQLException

Returns true if the iterator is positioned on the first row of the result table. Otherwise, returns false.

isLast()
Format:
public abstract boolean isLast() throws SQLException

Returns true if the iterator is positioned on the last row of the result table. Otherwise, returns false.

last()
Format:
public abstract boolean last() throws SQLException

Moves the iterator to the last row of the result table.

Returns true if the iterator is on a row. Otherwise, returns false.

previous()
Format:
public abstract boolean previous() throws SQLException

Moves the iterator to the previous row of the result table.

Returns true if the iterator is on a row. Otherwise, returns false.

relative(int)
Format:
public abstract boolean relative(int n) throws SQLException

If n>0, positions the iterator on the row that is n rows after the current row. If n<0, positions the iterator on the row that is n rows before the current row. If n=0, positions the iterator on the current row.

The cursor must be on a valid row of the result table before you can use this method. If the cursor is before the first row or after the last throw, the method throws an SQLException.

Suppose that m is the number of rows in the result table and x is the current row number in the result table. If n>0 and x+n>m, the iterator is positioned after the last row. If n<0 and x+n<1, the iterator is positioned before the first row.

Returns true if the iterator is on a row. Otherwise, returns false.

setFetchDirection(int)
Format:
public abstract void setFetchDirection (int) throws SQLException
Gives the SQLJ runtime environment a hint as to the direction in which rows of this iterator object are processed. Possible values are:
sqlj.runtime.ResultSetIterator.FETCH_FORWARD
Rows are processed in a forward direction, from first to last.
sqlj.runtime.ResultSetIterator.FETCH_REVERSE
Rows are processed in a backward direction, from last to first.
sqlj.runtime.ResultSetIterator.FETCH_UNKNOWN
The order of processing is not known.