org.apache.ddlutils.platform
Class ModelBasedResultSetIterator

java.lang.Object
  extended byorg.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 $
Author:
Thomas Dudziak

Constructor Summary
ModelBasedResultSetIterator(PlatformImplBase platform, Database model, ResultSet resultSet, Table[] queryHints, boolean cleanUpAfterFinish)
          Creates a new iterator.
 
Method Summary
 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 DynaSqlException
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
Method Detail

hasNext

public boolean hasNext()
                throws DynaSqlException

Specified by:
hasNext in interface Iterator
Throws:
DynaSqlException

next

public Object next()
            throws DynaSqlException

Specified by:
next in interface Iterator
Throws:
DynaSqlException

remove

public void remove()
            throws DynaSqlException

Specified by:
remove in interface Iterator
Throws:
DynaSqlException

cleanUp

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


finalize

protected void finalize()
                 throws Throwable

Throws:
Throwable

isConnectionOpen

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

Returns:
true if the connection is still open


Copyright © 2005 Apache Software Foundation. All Rights Reserved.