com.imaginary.util
Class ResultSetIterator

java.lang.Object
  |
  +--com.imaginary.util.ResultSetIterator

public class ResultSetIterator
extends java.lang.Object
implements com.sun.java.util.collections.Iterator

Provides an Iterator interface into a JDBC ResultSet. Using this iterator, you can move through a result set sequentially and pull each row out as a HashMap whose keys are column names and whose values are the column values. This class will currently function poorly for result sets with two columns of the same name.
Last modified $Date: 1999/11/06 19:50:56 $


Constructor Summary
ResultSetIterator(java.sql.ResultSet rs)
          Constructs a new ResultSetIterator using the specified ResultSet as its source of data.
 
Method Summary
 boolean hasNext()
           
 java.lang.Object next()
          Provides the next row in the result set as a HashMap where the keys are the column names and the values are the column values.
 void remove()
          This method is currently unsupported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultSetIterator

public ResultSetIterator(java.sql.ResultSet rs)
                  throws java.sql.SQLException
Constructs a new ResultSetIterator using the specified ResultSet as its source of data.
Parameters:
rs - the source of data for this iterator
Throws:
java.sql.SQLException - could not get the meta data
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface com.sun.java.util.collections.Iterator
Returns:
true if there are more rows to be processed

next

public java.lang.Object next()
Provides the next row in the result set as a HashMap where the keys are the column names and the values are the column values.
Specified by:
next in interface com.sun.java.util.collections.Iterator
Returns:
the next row as a HashMap

remove

public void remove()
This method is currently unsupported.
Specified by:
remove in interface com.sun.java.util.collections.Iterator
Throws:
java.lang.UnsupportedOperationException - always thrown