sqlj.runtime

Interface ResultSetIterator

All Known Subinterfaces:
NamedIterator, PositionedIterator

public interface ResultSetIterator

An interface that defines the shared functionality of those objects used to iterate over the contents of a result set.


Field Summary
static int ASENSITIVE
          Constant used by the "sensitivity" field, indicating that the iterator is defined to have an asensitive cursor.
static int FETCH_FORWARD
          Constant to indicate that the rows in an iterator object will be processed in a forward direction first-to-last.
static int FETCH_REVERSE
          Constant to indicate that the rows in an iterator object will be processed in a forward direction first-to-last.
static int FETCH_UNKNOWN
          Constant to indicate that the rows in an iterator object will be processed in an unknown direction.
static int INSENSITIVE
          Constant used by the "sensitivity" field, indicating that the iterator is defined to have an insensitive cursor.
static int SENSITIVE
          Constant used by the "sensitivity" field, indicating that the iterator is defined to have a sensitive cursor.
 
Method Summary
 void clearWarnings()
          After this call getWarnings returns null until a new warning is reported for this iterator.
 void close()
          Closes the iterator object, releasing any underlying resources.
 int getFetchSize()
          This method is not supported in Open SQL / SQLJ.
 ResultSet getResultSet()
          Returns the JDBC result set associated with this iterator.
 int getRow()
          Retrieves the current row number.
 int getSensitivity()
          Retrieves the sensitivity of this iterator object.
 SQLWarning getWarnings()
          The first warning reported by calls on this iterator is returned.
 boolean isClosed()
           
 boolean next()
          Advances the iterator to the next row.
 void setFetchSize(int rows)
          This method is not supported in Open SQL / SQLJ.
 

Field Detail

ASENSITIVE

static final int ASENSITIVE
Constant used by the "sensitivity" field, indicating that the iterator is defined to have an asensitive cursor. This means that the sensitivity is unknown.

See Also:
Constant Field Values

INSENSITIVE

static final int INSENSITIVE
Constant used by the "sensitivity" field, indicating that the iterator is defined to have an insensitive cursor. This means that result set will not see changes made by others.

See Also:
Constant Field Values

SENSITIVE

static final int SENSITIVE
Constant used by the "sensitivity" field, indicating that the iterator is defined to have a sensitive cursor. This means that the result set will see changes made by others.

See Also:
Constant Field Values

FETCH_FORWARD

static final int FETCH_FORWARD
Constant to indicate that the rows in an iterator object will be processed in a forward direction first-to-last.

See Also:
Constant Field Values

FETCH_REVERSE

static final int FETCH_REVERSE
Constant to indicate that the rows in an iterator object will be processed in a forward direction first-to-last.

See Also:
Constant Field Values

FETCH_UNKNOWN

static final int FETCH_UNKNOWN
Constant to indicate that the rows in an iterator object will be processed in an unknown direction.

See Also:
Constant Field Values
Method Detail

close

void close()
           throws SQLException
Closes the iterator object, releasing any underlying resources. It is recommended that iterators be explicitely closed as soon as they are no longer needed to allow for the immediate release of resources that are no longer needed.

Note: An iterator is not automatically closed when it is garbage collected. Allways close an iterator in the finally block.

Throws:
SQLException - If there is a problem closing the iterator.
See Also:
isClosed()

isClosed

boolean isClosed()
                 throws SQLException
Returns:
true if the close() method on this iterator has been called; false otherwise.
Throws:
SQLException - if an error occurs determining the close-status of the iterator.
See Also:
close()

next

boolean next()
             throws SQLException
Advances the iterator to the next row. At the begining the iterator is positioned before the first row.

Note: A FETCH ... INTO statement performs an implicit next() call on the iterator passed.

Returns:
true if there was a next row in the iterator; false otherwise.
Throws:
SQLException - If an exception occurs while changing the position of the iterator.

getResultSet

ResultSet getResultSet()
                       throws SQLException
Returns the JDBC result set associated with this iterator. The result set produced must have normal JDBC functionality, as defined in the JDBC specification (in particular, SQL NULL values fetched with primitive accessor methods will not raise a SQLNullException). This method is provided to facilitate interoperablity with JDBC.

Notes:

Returns:
a JDBC result set for this iterator.
Throws:
SQLException - if no result set is available for this iterator.
See Also:
ResultSet

getRow

int getRow()
           throws SQLException
Retrieves the current row number. The first row is number 1, the second number 2, and so on.

Returns:
the current row number; 0 if there is no current row
Throws:
SQLException - if there is no JDBC result set associated with this iterator.

getFetchSize

int getFetchSize()
                 throws SQLException
This method is not supported in Open SQL / SQLJ. Retreives the number of rows that is the current fetch size for this iterator object. If this iterator object has not set a fetch size by calling the method setFetchSize, or has set a fetch size of 0, then the value returned is implementation-defined.

Returns:
the current fetch size forthe iterator object.
Throws:
SQLException - if a database error occurs.

setFetchSize

void setFetchSize(int rows)
                  throws SQLException
This method is not supported in Open SQL / SQLJ. Gives the SQLJ runtime a hint as to the number of rows that should be fetched when more rows are needed from this iterator object. If the value specified is zero, then the the runtime is free to choose an implementation-dependent fetch size.

Parameters:
rows - - the default fetch size for result sets generated from this iterator object
Throws:
- - if a database access error occurs, or the condition 0 <= rows <= eCtxt.getMaxRows() is not satisfied, where eCtxt is the ExecutionContext object that was used to create this iterator object.
SQLException

getWarnings

SQLWarning getWarnings()
                       throws SQLException
The first warning reported by calls on this iterator is returned. Subsequent iterator warings will be chained to this SQLWarning.

The warning chain is automatically cleared each time a new role is read.

Note: This warning chain only covers warnings caused by iterator methods. Any warning caused by statement execution (such as fetching OUT parameters) will be chained on the ExecutionContext object.

Returns:
the first SQLWarning or null it there are no errors
Throws:
SQLException - if a database-access error occurs.

clearWarnings

void clearWarnings()
                   throws SQLException
After this call getWarnings returns null until a new warning is reported for this iterator.

Throws:
SQLException - if a database-access error occurs.

getSensitivity

int getSensitivity()
                   throws SQLException
Retrieves the sensitivity of this iterator object. The sensitivity is determined by the iterator declaration clause and by the SQLJ runtime implementation that created the iterator object.

Returns:

Case:

  • If this iterator object was declared with the predefined iterator with keyword sensitivity and a corresponding with value SENSITIVE, and the SQLJ runtime that created this iterator object supports sensitive iterators, then ResultSetIterator.SENSITIVE.
  • If this iterator object was declared with the predefined iterator with keyword sensitivity and a corresponding with value INSENSITIVE, and the SQLJ runtime that created this iterator object supports insensitive iterators, then ResultSetIterator.INSENSITIVE.
  • If this iterator object was declared with the predefined iterator with keyword sensitivity and a corresponding with value ASENSITIVE, then ResultSetIterator.ASENSITIVE.
  • Otherwise, an implementation-dependent value.
Note: In Open SQL / SQLJ, this method is not supported.
Throws:
SQLException
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] ENGINEAPI [sap.com] opensqldeprecated default BC-JAS-PER-SQL
[sap.com] ENGFACADE [sap.com] tc/je/opensql/api api BC-JAS
[sap.com] CORE-TOOLS [sap.com] com.sap.engine.client.libdeprecated default BC-JAS


Copyright 2012 SAP AG Complete Copyright Notice