sqlj.runtime.ResultSetIterator interface

The sqlj.runtime.ResultSetIterator interface is implemented by SQLJ for all iterator declaration clauses.

An untyped iterator can be generated by declaring an instance of the sqlj.runtime.ResultSetIterator interface directly. In general, use of untyped iterators is not recommended.

Variables

ASENSITIVE
Format:
public static final int ASENSITIVE

A constant that can be returned by the getSensitivity method. It indicates that the iterator is defined as ASENSITIVE.

This value is not returned by IBM® Informix®.

FETCH_FORWARD
Format:
public static final int FETCH_FORWARD
A constant that can be used by the following methods:
  • Set by sqlj.runtime.Scrollable.setFetchDirection and sqlj.runtime.ExecutionContext.setFetchDirection
  • Returned by sqlj.runtime.ExecutionContext.getFetchDirection
It indicates that the iterator fetches rows in a result table in the forward direction, from first to last.
FETCH_REVERSE
Format:
public static final int FETCH_REVERSE
A constant that can be used by the following methods:
  • Set by sqlj.runtime.Scrollable.setFetchDirection and sqlj.runtime.ExecutionContext.setFetchDirection
  • Returned by sqlj.runtime.ExecutionContext.getFetchDirection
It indicates that the iterator fetches rows in a result table in the backward direction, from last to first.

This value is not returned by IBM Informix.

FETCH_UNKNOWN
Format:
public static final int FETCH_UNKNOWN
A constant that can be used by the following methods:
  • Set by sqlj.runtime.Scrollable.setFetchDirection and sqlj.runtime.ExecutionContext.setFetchDirection
  • Returned by sqlj.runtime.ExecutionContext.getFetchDirection
It indicates that the iterator fetches rows in a result table in an unknown order.

This value is not returned by IBM Informix.

INSENSITIVE
Format:
public static final int INSENSITIVE

A constant that can be returned by the getSensitivity method. It indicates that the iterator is defined as INSENSITIVE.

SENSITIVE
Format:
public static final int SENSITIVE

A constant that can be returned by the getSensitivity method. It indicates that the iterator is defined as SENSITIVE.

This value is not returned by IBM Informix.

Methods

clearWarnings
Format:
public abstract void clearWarnings() throws SQLException

After clearWarnings is called, getWarnings returns null until a new warning is reported for the iterator.

close
Format:
public abstract void close() throws SQLException

Closes the iterator and releases underlying database resources.

getFetchSize
Format:
synchronized public int getFetchSize() throws SQLException

Returns the number of rows that should be fetched by SQLJ when more rows are needed. The returned value is the value that was set by the setFetchSize method, or 0 if no value was set by setFetchSize.

getResultSet
Format:
public abstract ResultSet getResultSet() throws SQLException

Returns the JDBC ResultSet object that is associated with the iterator.

getRow
Format:
synchronized public int getRow() throws SQLException

Returns the current row number. The first row is number 1, the second is number 2, and so on. If the iterator is not positioned on a row, 0 is returned.

getSensitivity
Format:
synchronized public int getSensitivity() throws SQLException

Returns the sensitivity of the iterator. The sensitivity is determined by the sensitivity value that was specified or defaulted in the with clause of the iterator declaration clause.

getWarnings
Format:
public abstract SQLWarning getWarnings() throws SQLException

Returns the first warning that is reported by calls on the iterator. Subsequent iterator warnings are be chained to this SQLWarning. The warning chain is automatically cleared each time the iterator moves to a new row.

isClosed
Format:
public abstract boolean isClosed() throws SQLException

Returns a value of true if the iterator is closed. Returns false otherwise.

next
Format:
public abstract boolean next() throws SQLException

Advances the iterator to the next row. Before next is invoked for the first time, the iterator is positioned before the first row of the result table. next returns a value of true when a next row is available and false when all rows have been retrieved.

setFetchSize
Format:
synchronized public void setFetchSize(int number-of-rows) throws SQLException

Gives SQLJ a hint as to the number of rows that should be fetched when more rows are needed.

Parameters:
number-of-rows
The expected number of rows that SQLJ should fetch for the iterator that is associated with the given execution context.
If number-of-rows is less than 0 or greater than the maximum number of rows that can be fetched, an SQLException is thrown.