net.sourceforge.sqlunit.handlers
Class FuncHandler

java.lang.Object
  extended by net.sourceforge.sqlunit.handlers.SqlHandler
      extended by net.sourceforge.sqlunit.handlers.FuncHandler
All Implemented Interfaces:
IHandler

public class FuncHandler
extends SqlHandler

The FuncHandler looks up the named definition from the symbol table and runs it after resolving the query, then returns a result. It is used to populate the SQLUnit SymbolTable with values for later test runs. It cannot be used directly as inputs for a test. It is similar to the set tag with an embedded query but more compact. Unlike the set tag, which can be called within the setup tag or a per-test prepare tag, the func tag is called standalone before a test to populate a variable in the scope.

Version:
$Revision: 1.2 $
Author:
Victor Alekseev (krocodl@users.sourceforge.net)

Constructor Summary
FuncHandler()
           
 
Method Summary
 java.lang.Object process(org.jdom.Element elFunc)
          Looks up the SQL string for the corresponding FuncDef, replaces with parameters if defined, runs it, and returns a single result.
 
Methods inherited from class net.sourceforge.sqlunit.handlers.SqlHandler
acquireConnection, acquireStatementObject, clrOutputParameters, executeQuery, executeSQL, initDatabaseResult, isMoreResultsAvailable, setOutputParameters, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FuncHandler

public FuncHandler()
Method Detail

process

public final java.lang.Object process(org.jdom.Element elFunc)
                               throws java.lang.Exception
Looks up the SQL string for the corresponding FuncDef, replaces with parameters if defined, runs it, and returns a single result.

Specified by:
process in interface IHandler
Overrides:
process in class SqlHandler
Parameters:
elFunc - the JDOM Element representing the func element.
Returns:
the value of the result of the SQL execution as a String.
Throws:
java.lang.Exception - if something went wrong with the func operation.