org.apache.ddlutils.platform
Class ModelBasedResultSetIterator

java.lang.Object
  extended by org.apache.ddlutils.platform.ModelBasedResultSetIterator
All Implemented Interfaces:
java.util.Iterator

public class ModelBasedResultSetIterator
extends java.lang.Object
implements java.util.Iterator

This is an iterator that is specifically targeted at traversing result sets. If the query is against a known table, then SqlDynaBean instances are created from the rows, otherwise normal DynaBean instances are created.

Version:
$Revision: 289996 $

Constructor Summary
ModelBasedResultSetIterator(PlatformImplBase platform, Database model, java.sql.ResultSet resultSet, Table[] queryHints, boolean cleanUpAfterFinish)
          Creates a new iterator.
 
Method Summary
 void advance()
          Advances the iterator without materializing the object.
 void cleanUp()
          Closes the resources (connection, statement, resultset).
protected  void finalize()
          
 boolean hasNext()
          
 boolean isConnectionOpen()
          Determines whether the connection is still open.
 java.lang.Object next()
          
 void remove()
          
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelBasedResultSetIterator

public ModelBasedResultSetIterator(PlatformImplBase platform,
                                   Database model,
                                   java.sql.ResultSet resultSet,
                                   Table[] queryHints,
                                   boolean cleanUpAfterFinish)
                            throws DatabaseOperationException
Creates a new iterator.

Parameters:
platform - The platform
model - The database model
resultSet - The result set
queryHints - The tables that were queried in the query that produced the given result set (optional)
cleanUpAfterFinish - Whether to close the statement and connection after finishing the iteration, upon on exception, or when this iterator is garbage collected
Throws:
DatabaseOperationException
Method Detail

hasNext

public boolean hasNext()
                throws DatabaseOperationException

Specified by:
hasNext in interface java.util.Iterator
Throws:
DatabaseOperationException

next

public java.lang.Object next()
                      throws DatabaseOperationException

Specified by:
next in interface java.util.Iterator
Throws:
DatabaseOperationException

advance

public void advance()
Advances the iterator without materializing the object. This is the same effect as calling next() except that no object is created and nothing is read from the result set.


remove

public void remove()
            throws DatabaseOperationException

Specified by:
remove in interface java.util.Iterator
Throws:
DatabaseOperationException

cleanUp

public void cleanUp()
Closes the resources (connection, statement, resultset).


finalize

protected void finalize()
                 throws java.lang.Throwable

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

isConnectionOpen

public boolean isConnectionOpen()
Determines whether the connection is still open.

Returns:
true if the connection is still open


Copyright © 2005-2009 Apache Software Foundation. All Rights Reserved.