|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.sqlunit.handlers.SqlHandler
public class SqlHandler
The SqlHandler class processes the contents of an sql tag in the input XML file.
| Constructor Summary | |
|---|---|
SqlHandler()
|
|
| Method Summary | |
|---|---|
protected java.sql.Connection |
acquireConnection(java.lang.String connectionId)
Acquires a Connection object with the specified connectionId. |
protected java.sql.Statement |
acquireStatementObject(java.sql.Connection conn,
java.lang.String stmt)
Builds the Statement object from the Connection and the SQL string. |
protected void |
clrOutputParameters(java.sql.Statement ps,
Param[] params)
Clears output parameter symbol table variables. |
protected void |
executeQuery(java.sql.Statement ps,
DatabaseResult result)
Executes the SQL query with a prefilled Statement object, and populates the DatabaseResult object in place. |
protected java.lang.Object |
executeSQL(java.lang.String connectionId,
java.lang.String stmt,
Param[] params)
Executes JDBC calls to build the DatabaseResult object and returns it. |
protected DatabaseResult |
initDatabaseResult()
Initializes a DatabaseResult object for use by the Statement after it finishes executing. |
protected boolean |
isMoreResultsAvailable(boolean hasResults,
int rowsUpdated)
Returns whether there are more resultsets to loop through in the returned result from the SQL call. |
java.lang.Object |
process(org.jdom.Element elSql)
Runs the SQL statement contained in the sql tag in the input XML file. |
protected void |
setOutputParameters(java.sql.Statement ps,
Param[] params,
DatabaseResult result)
Sets the output parameters into the DatabaseResult. |
protected java.sql.Statement |
setParameters(java.sql.Statement ps,
Param[] params)
Sets replaceable parameters, if any, into the Statement object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SqlHandler()
| Method Detail |
|---|
public java.lang.Object process(org.jdom.Element elSql)
throws java.lang.Exception
process in interface IHandlerelSql - the JDOM Element representing the sql tag.
java.lang.Exception - if there was a problem running the SQL.
protected java.lang.Object executeSQL(java.lang.String connectionId,
java.lang.String stmt,
Param[] params)
throws java.lang.Exception
connectionId - the connection id string.stmt - the SQL statement.params - an array of Param objects.
java.lang.Exception - if there was a problem building the DatabaseResult.
protected java.sql.Connection acquireConnection(java.lang.String connectionId)
throws java.lang.Exception
connectionId - the connectionId to look up the ConnectionRegistry.
java.lang.Exception - if there was a problem getting the Connection.
protected java.sql.Statement acquireStatementObject(java.sql.Connection conn,
java.lang.String stmt)
throws java.lang.Exception
conn - the Connection object.stmt - the SQL string.
java.lang.Exception - if there was a problem building the Statement.
protected java.sql.Statement setParameters(java.sql.Statement ps,
Param[] params)
throws java.lang.Exception
ps - the Statement object.params - an array of Param objects.
java.lang.Exception - if there was a problem setting parameters.protected DatabaseResult initDatabaseResult()
protected void executeQuery(java.sql.Statement ps,
DatabaseResult result)
throws java.lang.Exception
ps - the Statement object.result - the DatabaseResult object.
java.lang.Exception - if there was a problem in the execute().
protected boolean isMoreResultsAvailable(boolean hasResults,
int rowsUpdated)
hasResults - a boolean generated from ps.execute().rowsUpdated - an int generated from ps.getUpdateCount().
protected void setOutputParameters(java.sql.Statement ps,
Param[] params,
DatabaseResult result)
throws java.lang.Exception
ps - the Statement object.params - the array of Param objects.result - the DatabaseResult object.
java.lang.Exception - if one is thrown by this method.
protected void clrOutputParameters(java.sql.Statement ps,
Param[] params)
throws java.lang.Exception
ps - the Statement object.params - the array of Param objects.
java.lang.Exception - if one is thrown by this method.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||