net.sourceforge.sqlunit.beans
Class ResultSetBean

java.lang.Object
  extended by net.sourceforge.sqlunit.beans.ResultSetBean

public class ResultSetBean
extends java.lang.Object

Models a ResultSet element, wrapping multiple Row objects.

Version:
$Revision: 1.9 $
Author:
Sujit Pal (spal@users.sourceforge.net)

Constructor Summary
ResultSetBean()
          Default constructor.
ResultSetBean(java.sql.ResultSet rs, int id)
          Constructs and populates a ResultSetBean object from a ResultSet object.
 
Method Summary
 java.lang.String getId()
          Returns the Id for this row.
 int getRowCount()
          Returns the rowCount override (if specified) for the resultset.
 Row[] getRows()
          Returns the rows in the resultset.
 java.lang.String[] getSortBy()
          Returns the array of column ids on which the rows of this ResultSetBean was sorted.
 boolean isPartial()
          Return true if the resultset specifies rows partially, else false.
 boolean isRowCountOverriden()
          Returns true if rowcount has been overriden by the caller.
 void setId(java.lang.String id)
          Set the id for this row.
 void setPartial(java.lang.String partial)
          Sets the partial row specification attribute for the resultset.
 void setRowCount(int rowCount)
          Sets the rowCount override for the resultset.
 void setRows(Row[] rows)
          Sets the rows in the resultset.
 void setSortBy(java.lang.String colIdList)
          Sets the colIds from the colIdList.
 void sort()
          Allows sorting of rows in a resultset by the columns specified in the sortColIds array.
 org.jdom.Element toElement()
          Returns a JDOM Element representing this ResultSet object.
 java.lang.String toString()
          Useful method for debugging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ResultSetBean

public ResultSetBean()
Default constructor.


ResultSetBean

public ResultSetBean(java.sql.ResultSet rs,
                     int id)
              throws SQLUnitException
Constructs and populates a ResultSetBean object from a ResultSet object.

Parameters:
rs - the ResultSet object to build from.
id - the id for the resultset, defaults to 1 if not set.
Throws:
SQLUnitException - if there was a problem building the bean.
Method Detail

getId

public final java.lang.String getId()
Returns the Id for this row.

Returns:
the id for this row.

setId

public final void setId(java.lang.String id)
Set the id for this row.

Parameters:
id - the id for this row.

isPartial

public final boolean isPartial()
Return true if the resultset specifies rows partially, else false.

Returns:
true if rows are partially specified. Default is false.

setPartial

public final void setPartial(java.lang.String partial)
Sets the partial row specification attribute for the resultset.

Parameters:
partial - true or false.

getRowCount

public final int getRowCount()
Returns the rowCount override (if specified) for the resultset. If the rowcount has been set from the rowcount attribute (overrides the actual value of the rowcount), then it returns that, else it returns the number of Row objects.

Returns:
the rowcount override (if specified) for the resultset.

setRowCount

public final void setRowCount(int rowCount)
Sets the rowCount override for the resultset.

Parameters:
rowCount - the rowcount override to set.

isRowCountOverriden

public final boolean isRowCountOverriden()
Returns true if rowcount has been overriden by the caller.

Returns:
true if rowcount has been overriden by caller.

getRows

public final Row[] getRows()
Returns the rows in the resultset.

Returns:
an array of Row objects in the ResultSet object.

setRows

public final void setRows(Row[] rows)
Sets the rows in the resultset.

Parameters:
rows - an array of Row objects to set.

getSortBy

public final java.lang.String[] getSortBy()
Returns the array of column ids on which the rows of this ResultSetBean was sorted. This value is set as a side-effect of the sortBy() call.

Returns:
an array of column ids.

setSortBy

public final void setSortBy(java.lang.String colIdList)
Sets the colIds from the colIdList.

Parameters:
colIdList - a comma-separated list of col ids to sort by.

sort

public final void sort()
Allows sorting of rows in a resultset by the columns specified in the sortColIds array.


toElement

public final org.jdom.Element toElement()
Returns a JDOM Element representing this ResultSet object.

Returns:
a JDOM Element representing this ResultSet object.

toString

public final java.lang.String toString()
Useful method for debugging. Returns the String representation of this ResultSetBean.

Overrides:
toString in class java.lang.Object
Returns:
the String representation of this result set bean.