org.gjt.rec.jdbc
Class QueryResults

java.lang.Object
  |
  +--org.gjt.rec.jdbc.QueryResults
All Implemented Interfaces:
Serializable

public final class QueryResults
extends Object
implements Serializable

A disconnected JDBC result set. Feed it a ResultSet, close the ResultSet, then access the data that has been copied out of the ResultSet in a random access (rather than serial) manner, or squirt it down the wire to another tier.

See Also:
Serialized Form

Nested Class Summary
static class QueryResults.QueryResultImpl
          The implementation of QueryResult.
 
Field Summary
static String COPYRIGHT
           
static String LICENSE
           
static String REVISION
           
 
Constructor Summary
QueryResults(ResultSet resultSet)
          Constructs a new QueryResults from a particular ResultSet.
 
Method Summary
 QueryResult get(int index)
          Looks up the QueryResult at a particular index in the results.
 int getColumnCount()
          Determines the number of columns in this QueryResults.
 String getColumnName(int columnIndex)
          Looks up the name of the column at a particular column index.
 boolean isEmpty()
          Determines if this QueryResults is empty or not.
 int size()
          Determines the number of elements in this QueryResults.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final String COPYRIGHT
See Also:
Constant Field Values

LICENSE

public static final String LICENSE
See Also:
Constant Field Values

REVISION

public static final String REVISION
See Also:
Constant Field Values
Constructor Detail

QueryResults

public QueryResults(ResultSet resultSet)
             throws SQLException
Constructs a new QueryResults from a particular ResultSet. Note: This method does not close the ResultSet.

Parameters:
resultSet - the result set from which to take the data
Throws:
NullPointerException - if (resultSet) is null
SQLException
Method Detail

getColumnCount

public int getColumnCount()
Determines the number of columns in this QueryResults.

Returns:
the number of columns in this QueryResults

getColumnName

public String getColumnName(int columnIndex)
Looks up the name of the column at a particular column index.

Parameters:
columnIndex - the index at which to look for the desired column
Returns:
the name of the column at the specified column index
Throws:
IndexOutOfBoundsException - if (columnIndex) is out of range (columnIndex < 0 || getColumnCount() <= columnIndex)

isEmpty

public boolean isEmpty()
Determines if this QueryResults is empty or not.

Returns:
true if this QueryResults is empty, false otherwise

size

public int size()
Determines the number of elements in this QueryResults.

Returns:
the number of elements in this QueryResults

get

public QueryResult get(int index)
Looks up the QueryResult at a particular index in the results.

Parameters:
index - the index at which to look for the desired QueryResult
Returns:
the QueryResult at the specified index
Throws:
IndexOutOfBoundsException - if the index is out of range (index < 0 || size() <= index)