net.sourceforge.sqlunit.beans
Class DatabaseResult

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

public class DatabaseResult
extends java.lang.Object

The DatabaseResult models a Database Result.

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

Constructor Summary
DatabaseResult()
          Default constructor.
 
Method Summary
 boolean getEchoOnly()
          Returns the echoOnly property of the DatabaseResult object.
 ExceptionBean getException()
          Returns the exception from the DatabaseResult object.
 int getNumCols(int resultSetIndex)
          Returns the number of columns in resultset identified by resultset index.
 int getNumResults()
          Returns the number of result sets in the DatabaseResult.
 int getNumRows(int resultSetIndex)
          Returns the number of rows in resultset identified by resultset index.
 OutParam[] getOutParams()
          Returns an array of OutParam objects for this DatabaseResult object.
 ResultSetBean[] getResultSets()
          Returns an array of ResultSetBean objects for this DatabaseResult object.
 int getUpdateCount()
          Returns the update count associated with this DatabaseResult.
 boolean isException()
          Returns true if the DatabaseResult represents an Exception.
 void resetAsException(java.lang.String errCode, java.lang.String errMessage)
          Creates the exception version of a DatabaseResult (this).
 void setEchoOnly(boolean echoOnly)
          Sets the echoOnly property of the DatabaseResult object.
 void setOutParams(OutParam[] outParams)
          Sets the outparams into the DatabaseResult object.
 void setResultSets(ResultSetBean[] rsbs)
          Sets the resultsets into the DatabaseResult object.
 void setUpdateCount(int updateCount)
          Sets the update count for the DatabaseResult.
 org.jdom.Element toElement()
          Returns the DatabaseResult object as a JDOM Element.
 java.lang.String toString()
          Returns a String representation of the DatabaseResult object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DatabaseResult

public DatabaseResult()
Default constructor. Sets up all underlying map and scalar objects.

Method Detail

getNumResults

public final int getNumResults()
Returns the number of result sets in the DatabaseResult.

Returns:
the number of set elements in the result element.

getNumRows

public final int getNumRows(int resultSetIndex)
Returns the number of rows in resultset identified by resultset index.

Parameters:
resultSetIndex - the index of the resultset in the DatabaseResult. The resultset index is 1-based.
Returns:
the number of rows in the resultset.

getNumCols

public final int getNumCols(int resultSetIndex)
Returns the number of columns in resultset identified by resultset index.

Parameters:
resultSetIndex - the index of the resultset in the DatabaseResult.
Returns:
the number of columns in the row.

getOutParams

public final OutParam[] getOutParams()
Returns an array of OutParam objects for this DatabaseResult object.

Returns:
an array of OutParam objects. May be null.

setOutParams

public final void setOutParams(OutParam[] outParams)
Sets the outparams into the DatabaseResult object.

Parameters:
outParams - an array of OutParam objects.

getResultSets

public final ResultSetBean[] getResultSets()
Returns an array of ResultSetBean objects for this DatabaseResult object.

Returns:
an array of ResultSetBean objects. May be null.

setResultSets

public final void setResultSets(ResultSetBean[] rsbs)
Sets the resultsets into the DatabaseResult object.

Parameters:
rsbs - an array of ResultSetBean objects.

isException

public final boolean isException()
Returns true if the DatabaseResult represents an Exception.

Returns:
true if this DatabaseResult is an exception, else false.

getException

public final ExceptionBean getException()
Returns the exception from the DatabaseResult object.

Returns:
the ExceptionBean object.

resetAsException

public final void resetAsException(java.lang.String errCode,
                                   java.lang.String errMessage)
Creates the exception version of a DatabaseResult (this).

Parameters:
errCode - the code to populate.
errMessage - the message to populate.

getUpdateCount

public final int getUpdateCount()
Returns the update count associated with this DatabaseResult. If the update count is not applicable for this DatabaseResult, then it will return -1. If applicable, this represents the number of rows updated by the SQL query or Stored Procedure that generated this DatabaseResult.

Returns:
the update count for the DatabaseResult.

setUpdateCount

public final void setUpdateCount(int updateCount)
Sets the update count for the DatabaseResult.

Parameters:
updateCount - the updateCount to update.

getEchoOnly

public final boolean getEchoOnly()
Returns the echoOnly property of the DatabaseResult object.

Returns:
true or false.

setEchoOnly

public final void setEchoOnly(boolean echoOnly)
Sets the echoOnly property of the DatabaseResult object. If this property is set to true in the expected result, SQLUnit will not attempt to match with the generated result. Instead it will print the XML String representation of the generated result to the output.

Parameters:
echoOnly - the echoOnly property. Valid values are true and false.

toElement

public final org.jdom.Element toElement()
Returns the DatabaseResult object as a JDOM Element.

Returns:
the DatabaseResult object as a JDOM Element.

toString

public final java.lang.String toString()
Returns a String representation of the DatabaseResult object.

Overrides:
toString in class java.lang.Object
Returns:
a String representation of the DatabaseResult object.