public class StoredProcedure
extends java.lang.Object
| Constructor and Description |
|---|
StoredProcedure(DataAccess da)
Create a new SQL Stored Procedure from a literal SQL query string.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addColumnParameter(java.lang.String columnName,
java.lang.String value)
Add a parameter to the list of parameters for this SQL command.
|
void |
addParameter(java.lang.String columnName,
int value)
Add a parameter to the list of parameters for this SQL command.
|
void |
addParameter(java.lang.String columnName,
java.lang.String value)
Add a parameter to the list of parameters for this SQL command.
|
void |
clearParameters()
Removes all parameters from the parameter list.
|
void |
closeConnection()
Closes the current database connection.
|
void |
closeConnection(java.sql.ResultSet result)
Closes the connection of the given ResultSet object.
|
java.sql.ResultSet |
execute()
Executes this stored procedure's SQL as if it would return a ResultSet.
|
int |
executeNonQuery()
Executes this stored procedure's SQL as if it would not return a ResultSet.
|
java.lang.String |
getCommandText()
Returns the current command text.
|
java.util.Hashtable |
getParameters()
Returns the parameters stored for this instance of StoredProcedure.
|
java.lang.String |
getSql()
Returns an SQL representation of the query.
|
void |
setCommandText(java.lang.String cmdTxt)
Set the Stored Procedure command text to a literal SQL command string.
|
void |
setCommandText(java.lang.String cmdTxt,
java.lang.String xmlDocument)
Set the Stored Procedure command text to a SQL string stored in an XML configuration file.
|
public StoredProcedure(DataAccess da)
da - A data access class to help with the stored procedure execution.public java.lang.String getCommandText()
public void setCommandText(java.lang.String cmdTxt)
cmdTxt - A string representing the SQL command text.public void setCommandText(java.lang.String cmdTxt,
java.lang.String xmlDocument)
throws java.lang.Exception
cmdTxt - The SQL command to run.xmlDocument - The path of the XML file.java.lang.Exception - If the command type of this Stored Procedure
is STRING, if the command could not be found in
the XML doc, or if there is an XML parse error.public java.util.Hashtable getParameters()
Hashtablepublic void addParameter(java.lang.String columnName,
java.lang.String value)
columnName - The name of the coded parameter to replace, %SOME_NAME% or @SOME_NAME.value - The value to replace an instance of the coded parameter with.public void addColumnParameter(java.lang.String columnName,
java.lang.String value)
columnName - The name of the coded parameter to replace, %SOME_NAME% or @SOME_NAME.value - The value to replace an instance of the coded parameter with.public void addParameter(java.lang.String columnName,
int value)
columnName - The name of the coded parameter to replace, %SOME_NAME% or @SOME_NAME.value - An integer value to replace an instance of the coded parameter with.public void clearParameters()
public java.lang.String getSql()
public java.sql.ResultSet execute()
ResultSetpublic int executeNonQuery()
public void closeConnection()
public void closeConnection(java.sql.ResultSet result)
result - A result set object to close connections for.