org.apache.cayenne.access
Interface ResultIterator

All Known Implementing Classes:
DefaultResultIterator, DistinctResultIterator, JDBCResultIterator

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.

For more information see Cayenne User Guide.

Author:
Andrei Adamchik

Method Summary
 void close()
          Closes ResultIterator and associated ResultSet.
 java.util.List dataRows(boolean close)
          Returns all unread data rows from ResultSet and closes this iterator if asked to do so.
 int getDataRowWidth()
          Returns the number of columns in the result row.
 boolean hasNextRow()
          Returns true if there is at least one more record that can be read from the iterator.
 java.util.Map nextDataRow()
          Returns the next result row as a Map.
 java.util.Map nextObjectId(DbEntity entity)
          Returns a map of ObjectId values from the next result row.
 void skipDataRow()
          Skips current data row instead of reading it.
 

Method Detail

dataRows

java.util.List dataRows(boolean close)
                        throws CayenneException
Returns all unread data rows from ResultSet and closes this iterator if asked to do so.

Throws:
CayenneException

hasNextRow

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

Throws:
CayenneException

nextDataRow

java.util.Map nextDataRow()
                          throws CayenneException
Returns the next result row as a Map.

Throws:
CayenneException

nextObjectId

java.util.Map nextObjectId(DbEntity entity)
                           throws CayenneException
Returns a map of ObjectId values from the next result row. Primary key columns are determined from the provided DbEntity.

Throws:
CayenneException
Since:
1.1

skipDataRow

void skipDataRow()
                 throws CayenneException
Skips current data row instead of reading it.

Throws:
CayenneException

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

getDataRowWidth

int getDataRowWidth()
Returns the number of columns in the result row.

Since:
1.0.6


Copyright © 2001-2006 Apache.org All Rights Reserved.