org.apache.ddlutils.platform
Class ModelBasedResultSetIterator

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

public class ModelBasedResultSetIterator
extends Object
implements 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, 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.
 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,
                                   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 Iterator
Throws:
DatabaseOperationException

next

public Object next()
            throws DatabaseOperationException

Specified by:
next in interface 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 Iterator
Throws:
DatabaseOperationException

cleanUp

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


finalize

protected void finalize()
                 throws Throwable

Overrides:
finalize in class Object
Throws:
Throwable

isConnectionOpen

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

Returns:
true if the connection is still open


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