org.dspace.storage.rdbms
Class TableRowIterator

java.lang.Object
  extended by org.dspace.storage.rdbms.TableRowIterator

public class TableRowIterator
extends Object

Represents the results of a database query

Version:
$Revision: 3705 $
Author:
Peter Breton

Method Summary
 void close()
          Close the Iterator and release any associated resources
protected  void finalize()
          Finalize -- this method is called when this object is GC-ed.
 boolean hasNext()
          Return true if there are more rows, false otherwise
 TableRow next()
          Advance to the next row and return it.
 void setStatement(Statement st)
          setStatement -- this method saves the statement used to do the query.
 List toList()
          Saves all the values returned by iterator into a list.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

finalize

protected void finalize()
Finalize -- this method is called when this object is GC-ed.

Overrides:
finalize in class Object

setStatement

public void setStatement(Statement st)
setStatement -- this method saves the statement used to do the query. We must keep this so that the statement can be closed when we are finished.

Parameters:
st - - The statement used to do the query that created this TableRowIterator

next

public TableRow next()
              throws SQLException
Advance to the next row and return it. Returns null if there are no more rows.

Returns:
- The next row, or null if no more rows
Throws:
SQLException - - If a database error occurs while fetching values

hasNext

public boolean hasNext()
                throws SQLException
Return true if there are more rows, false otherwise

Returns:
- true if there are more rows, false otherwise
Throws:
SQLException - - If a database error occurs while fetching values

toList

public List toList()
            throws SQLException
Saves all the values returned by iterator into a list. As a side effect the result set is closed and no more operations can be preformed on this object.

Returns:
- A list of all the values returned by the iterator.
Throws:
SQLException - - If a database error occurs while fetching values

close

public void close()
Close the Iterator and release any associated resources



Copyright © 2010 DuraSpace. All Rights Reserved.