org.rimudb.generic
Class IterativeQuery

java.lang.Object
  extended by org.rimudb.generic.AbstractGenericBase
      extended by org.rimudb.generic.IterativeQuery

public class IterativeQuery
extends AbstractGenericBase

This class is used to allow the caller to iterate over the result set. It is designed for handling large result sets where the entire set may be too large to be held in memory.

Author:
Simon Ritchie

Constructor Summary
IterativeQuery(Database database)
          Create an IterativeQuery.
IterativeQuery(Database database, java.lang.Class<? extends DataObject>[] dataObjectClasses, java.lang.String sql)
          Create an IterativeQuery.
IterativeQuery(Database database, java.lang.Class<? extends DataObject> dataObjectClass, java.lang.String sql)
          Create an IterativeQuery.
IterativeQuery(Database database, IIterativeResultSetBinder binder, java.lang.String sql)
          Create an IterativeQuery.
IterativeQuery(Database database, java.lang.String sql)
          Create an IterativeQuery.
 
Method Summary
 DataObjectArrayIterator createDataObjectArrayIterator(java.lang.Object... parameters)
          Use this method to return an Iterator that will return multiple rows each containing multiple Data Objects.
 DataObjectIterator createDataObjectIterator(java.lang.Object... parameters)
          Use this method if the SQL statement will return multiple rows each containing a DataObject.
 ObjectIterator createObjectIterator(java.lang.Object... parameters)
          Use this method if the SQL statement will return multiple rows each containing a single column.
 ObjectIterator createObjectIteratorWithBinder(java.lang.Object... parameters)
          Use this method if the SQL statement will return multiple rows each containing a selection of the available columns or scalar results.
 IIterativeResultSetBinder getBinder()
          Return the binder.
 void setBinder(IIterativeResultSetBinder binder)
          Set the binder.
 
Methods inherited from class org.rimudb.generic.AbstractGenericBase
buildElementString, buildParameterString, getDatabase, getFetchSize, getSQL, parse, setFetchSize, setSQL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IterativeQuery

public IterativeQuery(Database database)
               throws RimuDBException
Create an IterativeQuery.

Parameters:
database - Database
Throws:
RimuDBException

IterativeQuery

public IterativeQuery(Database database,
                      java.lang.String sql)
               throws RimuDBException
Create an IterativeQuery.

Parameters:
database - Database
sql - String
Throws:
RimuDBException

IterativeQuery

public IterativeQuery(Database database,
                      java.lang.Class<? extends DataObject>[] dataObjectClasses,
                      java.lang.String sql)
               throws RimuDBException
Create an IterativeQuery.

Parameters:
database - Database
dataObjectClasses - Class[]
sql - String
Throws:
RimuDBException

IterativeQuery

public IterativeQuery(Database database,
                      java.lang.Class<? extends DataObject> dataObjectClass,
                      java.lang.String sql)
               throws RimuDBException
Create an IterativeQuery.

Parameters:
database - Database
dataObjectClass - Class
sql - String
Throws:
RimuDBException

IterativeQuery

public IterativeQuery(Database database,
                      IIterativeResultSetBinder binder,
                      java.lang.String sql)
               throws RimuDBException
Create an IterativeQuery.

Parameters:
database - Database
binder - IIterativeResultSetBinder
sql - String
Throws:
RimuDBException
Method Detail

createDataObjectArrayIterator

public DataObjectArrayIterator createDataObjectArrayIterator(java.lang.Object... parameters)
                                                      throws RimuDBException
Use this method to return an Iterator that will return multiple rows each containing multiple Data Objects. If the SQL statement contains a join of two or more tables then multiple Data Objects can be returned. Note that in order for this to work, the select statement must return all the columns required by the Data Objects.

Parameters:
parameters -
Returns:
DataObjectArrayIterator
Throws:
RimuDBException

createDataObjectIterator

public DataObjectIterator createDataObjectIterator(java.lang.Object... parameters)
                                            throws RimuDBException
Use this method if the SQL statement will return multiple rows each containing a DataObject. Note that in order for this to work, the select statement must return all the columns required by the Data Object.

Parameters:
parameters -
Returns:
DataObjectIterator
Throws:
RimuDBException

createObjectIteratorWithBinder

public ObjectIterator createObjectIteratorWithBinder(java.lang.Object... parameters)
                                              throws RimuDBException
Use this method if the SQL statement will return multiple rows each containing a selection of the available columns or scalar results. This is the most flexible form of the methods, allowing any any values that can be returned by a select statement to be returned. It does however, require that a bean class and a binder class are created for handling the selection. The bean class must implement IResultSetBean and the binder must implement IIterativeResultSetBinder.

Parameters:
parameters -
Returns:
ObjectIterator
Throws:
RimuDBException

createObjectIterator

public ObjectIterator createObjectIterator(java.lang.Object... parameters)
                                    throws RimuDBException
Use this method if the SQL statement will return multiple rows each containing a single column.

Parameters:
parameters -
Returns:
ObjectIterator
Throws:
RimuDBException

getBinder

public IIterativeResultSetBinder getBinder()
Return the binder.

Returns:
IIterativeResultSetBinder

setBinder

public void setBinder(IIterativeResultSetBinder binder)
Set the binder.

Parameters:
binder - IIterativeResultSetBinder


Copyright © 2008-2011 Simon Ritchie. All Rights Reserved.