org.apache.cayenne.access
Interface ResultIterator

All Known Implementing Classes:
DistinctResultIterator, DistinctResultIterator, JDBCResultIterator, LimitResultIterator

public interface ResultIterator

Defines API of an iterator over the records returned as a result of SelectQuery execution. Usually a ResultIterator is supported by an open java.sql.ResultSet, therefore most of the methods would throw checked exceptions. ResultIterators must be explicitly closed when the user is done working with them.

Result "rows", depending on the query, may be represented as scalar values, DataRows, or Object[] arrays containing a mix of scalars and DataRows.


Method Summary
 List<?> allRows()
          Returns all yet unread rows from ResultSet without closing it.
 void close()
          Closes ResultIterator and associated ResultSet.
 boolean hasNextRow()
          Returns true if there is at least one more record that can be read from the iterator.
 Object nextRow()
          Returns the next result row that is, depending on the query, may be a scalar value, a DataRow, or an Object[] array containing a mix of scalars and DataRows.
 void skipRow()
           
 

Method Detail

allRows

List<?> allRows()
                throws CayenneException
Returns all yet unread rows from ResultSet without closing it.

Throws:
CayenneException
Since:
3.0

hasNextRow

boolean hasNextRow()
                   throws CayenneException
Returns true if there is at least one more record that can be read from the iterator.

Throws:
CayenneException

nextRow

Object nextRow()
               throws CayenneException
Returns the next result row that is, depending on the query, may be a scalar value, a DataRow, or an Object[] array containing a mix of scalars and DataRows.

Throws:
CayenneException
Since:
3.0

skipRow

void skipRow()
             throws CayenneException
Throws:
CayenneException
Since:
3.0

close

void close()
           throws CayenneException
Closes ResultIterator and associated ResultSet. This method must be called explicitly when the user is finished processing the records. Otherwise unused database resources will not be released properly.

Throws:
CayenneException


Copyright © 2001-2011 Apache Cayenne. All Rights Reserved.