All Packages    This Package  Previous  Next  

Class sqlj.runtime.ref.ResultSetIterImpl

java.lang.Object
   |
   +----sqlj.runtime.ref.ResultSetIterImpl

public class ResultSetIterImpl
extends Object
implements ResultSetIterator
The result set iter(ator) impl(ementation) class implements the functionality of both a positioned iterator, and a named iterator. However, it does not directly implement either of these interfaces. Rather, the translator will generate iterator classes which subclass this class and implement only the iterator interface that they were declared to implement (thus avoiding iterators which appear to be both positional and named).

This class is used internally by the reference translator code generation. It is expected that clients will not directly reference this class.

See Also:
PositionedIterator, NamedIterator, ForUpdate

Variable Index

 o resultSet
The underlying reference runtime result set

Constructor Index

 o ResultSetIterImpl(RTResultSet)
Creates a new result set iter impl object that uses data found in the passed result set.
 o ResultSetIterImpl(RTResultSet, int)
Creates a new result set iter impl object that uses data found in the passed result set.

Method Index

 o checkColumns(RTResultSet, int)
Verifies that the passed result set has the passed expected number of columns.
 o clearWarnings()
After this call getWarnings returns null until a new warning is reported for this iterator.
 o close()
closes this iterator and the underlying result set.
 o endFetch()
Returns false if currently on a row, true otherwise.
 o finalize()
finalizes the super object and calls close if this iterator has not already been closed.
 o findColumn(String)
Returns the index associated with the passed column name on the underlying result set.
 o getCursorName()
Returns the cursor name of the underlying result set.
 o getResultSet()
Returns the JDBC result set associated with this iterator, if any.
 o getWarnings()
Returns the first warning reported by calls on this iterator is returned.
 o isClosed()
Returns true if this iterator has been closed, false otherwise.
 o next()
Fetches the next row in the iterator and returns true if there was a row to fetch, false otherwise.

Variables

 o resultSet
 protected RTResultSet resultSet
The underlying reference runtime result set

Constructors

 o ResultSetIterImpl
 public ResultSetIterImpl(RTResultSet rs)
Creates a new result set iter impl object that uses data found in the passed result set.

 o ResultSetIterImpl
 public ResultSetIterImpl(RTResultSet rs,
                          int numColumns) throws SQLException
Creates a new result set iter impl object that uses data found in the passed result set. Verifies that the passed result set contains the same number of columns as is passed in the numColumns parameter.

Note: If a SQLException is raised by the constructor, the passed result set is automatically closed.

Parameters:
rs - the underlying result set
numColumns - the expected number of columns in the result set
Throws: SQLException
if the result set does not contain the expected number of columns
See Also:
checkColumns

Methods

 o checkColumns
 public static void checkColumns(RTResultSet rs,
                                 int expectedColumns) throws SQLException
Verifies that the passed result set has the passed expected number of columns. An exception is raised if not. This method is provided for uniformity of error reporting between select..into and iterators.

Parameters:
rs - the result set to check.
expectedColumns - the expected number of columns in the result set.
Throws: SQLException
if the result set does not have the expected number of columns.
 o findColumn
 protected int findColumn(String name) throws SQLException
Returns the index associated with the passed column name on the underlying result set. Throws an exception if the column name does not exist. Used by generated named iterators for uniform treatment of findColumn. Assumes that this method is called during construction

Note: We assume that this method is only called during subclass construction, and thus if a SQLException is raised during this method, the underlying result set is automatically closed.

Parameters:
name - the name of the column in question
Throws: SQLException
if the column cannot be found. Underlying result set is closed in this case.
 o getResultSet
 public ResultSet getResultSet() throws SQLException
Returns the JDBC result set associated with this iterator, if any.

Throws: SQLException
if there is no JDBC result set associated with this iterator.
 o close
 public void close() throws SQLException
closes this iterator and the underlying result set.

Throws: SQLException
if an error occurs during close
See Also:
close
 o isClosed
 public boolean isClosed() throws SQLException
Returns true if this iterator has been closed, false otherwise.

Throws: SQLException
if a database access error occurs.
See Also:
isClosed
 o getCursorName
 public String getCursorName() throws SQLException
Returns the cursor name of the underlying result set.

Throws: SQLException
if the underlying result set does not have a cursor name.
See Also:
getCursorName
 o endFetch
 public boolean endFetch() throws SQLException
Returns false if currently on a row, true otherwise. Provides a termination condition for FETCH..INTO statements, as endFetch will be true after the last row has been FETCHed.

Throws: SQLException
if a database access error occurs.
See Also:
endFetch
 o next
 public boolean next() throws SQLException
Fetches the next row in the iterator and returns true if there was a row to fetch, false otherwise.

Throws: SQLException
if an error occurs in the underlying result set's call to next.
See Also:
next
 o getWarnings
 public SQLWarning getWarnings() throws SQLException
Returns the first warning reported by calls on this iterator is returned. Subsequent iterator warings will be chained to this SQLWarning.

Throws: SQLException
if a database access error occurs.
See Also:
getWarnings
 o clearWarnings
 public 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.
 o finalize
 protected void finalize() throws Throwable
finalizes the super object and calls close if this iterator has not already been closed.

Throws: Throwable
if an error occurs during finalization
Overrides:
finalize in class Object
See Also:
close, isClosed

All Packages    This Package  Previous  Next