|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.mockrunner.jdbc.AbstractResultSetHandler
com.mockrunner.jdbc.AbstractParameterResultSetHandler
Abstract base class for all statement types
that support parameters, i.e. PreparedStatement
and CallableStatement.
| Constructor Summary | |
AbstractParameterResultSetHandler()
|
|
| Method Summary | |
void |
addParameterMapForExecutedStatement(java.lang.String sql,
java.util.Map parameters)
Collects all SQL strings that were executed. |
void |
clearResultSets()
Clears the ResultSet objects. |
void |
clearThrowsSQLException()
Clears the list of statements that should throw an exception |
void |
clearUpdateCounts()
Clears the update counts. |
protected boolean |
doParameterMatch(java.util.Map expectedParameters,
java.util.Map actualParameters)
|
java.util.Map |
getExecutedStatementParameter()
Returns the Map of executed SQL strings. |
ParameterSets |
getParametersForExecutedStatement(java.lang.String sql)
Returns the ParameterSets for a specified
SQL string. |
MockResultSet |
getResultSet(java.lang.String sql,
java.util.Map parameters)
Returns the first ResultSet that matches the
specified SQL string and the specified parameters. |
boolean |
getThrowsSQLException(java.lang.String sql,
java.util.Map parameters)
Returns if the specified SQL string with the specified parameters should raise an exception. |
java.lang.Integer |
getUpdateCount(java.lang.String sql,
java.util.Map parameters)
Returns the first update count that matches the specified SQL string and the specified parameters. |
void |
prepareResultSet(java.lang.String sql,
MockResultSet resultSet,
java.util.List parameters)
Prepare a ResultSet for a specified SQL string and
the specified parameters. |
void |
prepareResultSet(java.lang.String sql,
MockResultSet resultSet,
java.util.Map parameters)
Prepare a ResultSet for a specified SQL string and
the specified parameters. |
void |
prepareResultSet(java.lang.String sql,
MockResultSet resultSet,
java.lang.Object[] parameters)
Prepare a ResultSet for a specified SQL string and
the specified parameters. |
void |
prepareThrowsSQLException(java.lang.String sql,
java.util.List parameters)
Prepare if the specified SQL string with the specified parameters should raise an exception. |
void |
prepareThrowsSQLException(java.lang.String sql,
java.util.Map parameters)
Prepare if the specified SQL string with the specified parameters should raise an exception. |
void |
prepareThrowsSQLException(java.lang.String sql,
java.lang.Object[] parameters)
Prepare if the specified SQL string with the specified parameters should raise an exception. |
void |
prepareUpdateCount(java.lang.String sql,
int updateCount,
java.util.List parameters)
Prepare the update count for execute update calls for a specified SQL string and the specified parameters. |
void |
prepareUpdateCount(java.lang.String sql,
int updateCount,
java.util.Map parameters)
Prepare the update count for execute update calls for a specified SQL string and the specified parameters. |
void |
prepareUpdateCount(java.lang.String sql,
int updateCount,
java.lang.Object[] parameters)
Prepare the update count for execute update calls for a specified SQL string and the specified parameters. |
void |
setExactMatchParameter(boolean exactMatchParameter)
Sets if the specified parameters must match exactly in order and number. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public AbstractParameterResultSetHandler()
| Method Detail |
public void addParameterMapForExecutedStatement(java.lang.String sql,
java.util.Map parameters)
sql - the SQL stringparameters - a copy of the corresponding parameter mappublic ParameterSets getParametersForExecutedStatement(java.lang.String sql)
ParameterSets for a specified
SQL string.
sql - the SQL string
Map of parameterspublic java.util.Map getExecutedStatementParameter()
Map of executed SQL strings.
Each string maps to the corresponding ParameterSets
object.
Map of parameterspublic void setExactMatchParameter(boolean exactMatchParameter)
false, i.e. the specified
parameters must be present in the actual parameter
list of the prepared statement with the correct index
but it's ok if there are more actual parameters.
exactMatchParameter - must parameters match exactly
public java.lang.Integer getUpdateCount(java.lang.String sql,
java.util.Map parameters)
AbstractResultSetHandler.setCaseSensitive(boolean), AbstractResultSetHandler.setExactMatch(boolean) and
AbstractResultSetHandler.setUseRegularExpressions(boolean) and the match parameters for the
specified parameter list with setExactMatchParameter(boolean).
sql - the SQL stringparameters - the parameters
public MockResultSet getResultSet(java.lang.String sql,
java.util.Map parameters)
ResultSet that matches the
specified SQL string and the specified parameters.
Please note that you can modify the match parameters with
AbstractResultSetHandler.setCaseSensitive(boolean), AbstractResultSetHandler.setExactMatch(boolean) and
AbstractResultSetHandler.setUseRegularExpressions(boolean) and the match parameters for the
specified parameter list with setExactMatchParameter(boolean).
sql - the SQL stringparameters - the parameters
MockResultSet
public boolean getThrowsSQLException(java.lang.String sql,
java.util.Map parameters)
AbstractResultSetHandler.setCaseSensitive(boolean), AbstractResultSetHandler.setExactMatch(boolean) and
AbstractResultSetHandler.setUseRegularExpressions(boolean) and the match parameters for the
specified parameter list with setExactMatchParameter(boolean).
sql - the SQL stringparameters - the parameters
true if the specified SQL string should raise an exception,
false otherwise
protected boolean doParameterMatch(java.util.Map expectedParameters,
java.util.Map actualParameters)
public void clearResultSets()
ResultSet objects.
clearResultSets in class AbstractResultSetHandlerpublic void clearUpdateCounts()
clearUpdateCounts in class AbstractResultSetHandlerpublic void clearThrowsSQLException()
clearThrowsSQLException in class AbstractResultSetHandler
public void prepareResultSet(java.lang.String sql,
MockResultSet resultSet,
java.lang.Object[] parameters)
ResultSet for a specified SQL string and
the specified parameters. The specified parameters array
must contain the parameters in the correct order starting with 0 as
the first parameter. Please keep in mind that parameters in
PreparedStatement objects start with 1 as the first
parameter. So parameters[0] maps to the
parameter with index 1.
Please note that you can modify the match parameters with
AbstractResultSetHandler.setCaseSensitive(boolean), AbstractResultSetHandler.setExactMatch(boolean) and
AbstractResultSetHandler.setUseRegularExpressions(boolean) and the match parameters for the
specified parameter list with setExactMatchParameter(boolean).
sql - the SQL stringresultSet - the corresponding MockResultSetparameters - the parameters
public void prepareResultSet(java.lang.String sql,
MockResultSet resultSet,
java.util.List parameters)
ResultSet for a specified SQL string and
the specified parameters. The specified parameters List
must contain the parameters in the correct order starting with 0 as
the first parameter. Please keep in mind that parameters in
PreparedStatement objects start with 1 as the first
parameter. So parameters.get(0) maps to the
parameter with index 1.
Please note that you can modify the match parameters with
AbstractResultSetHandler.setCaseSensitive(boolean), AbstractResultSetHandler.setExactMatch(boolean) and
AbstractResultSetHandler.setUseRegularExpressions(boolean) and the match parameters for the
specified parameter list with setExactMatchParameter(boolean).
sql - the SQL stringresultSet - the corresponding MockResultSetparameters - the parameters
public void prepareResultSet(java.lang.String sql,
MockResultSet resultSet,
java.util.Map parameters)
ResultSet for a specified SQL string and
the specified parameters. The specified parameters Map
must contain the parameters by mapping Integer objects
to the corresponding parameter. The Integer object
is the index of the parameter. In the case of a CallableStatement
there are also allowed String keys for named parameters.
Please note that you can modify the match parameters with
AbstractResultSetHandler.setCaseSensitive(boolean), AbstractResultSetHandler.setExactMatch(boolean) and
AbstractResultSetHandler.setUseRegularExpressions(boolean) and the match parameters for the
specified parameter list with setExactMatchParameter(boolean).
sql - the SQL stringresultSet - the corresponding MockResultSetparameters - the parameters
public void prepareThrowsSQLException(java.lang.String sql,
java.lang.Object[] parameters)
PreparedStatement
objects start with 1 as the first parameter. So parameters[0]
maps to the parameter with index 1.
Please note that you can modify the match parameters with
AbstractResultSetHandler.setCaseSensitive(boolean), AbstractResultSetHandler.setExactMatch(boolean) and
AbstractResultSetHandler.setUseRegularExpressions(boolean) and the match parameters for the
specified parameter list with setExactMatchParameter(boolean).
sql - the SQL stringparameters - the parameters
public void prepareThrowsSQLException(java.lang.String sql,
java.util.List parameters)
List must contain the
parameters in the correct order starting with 0 as the first
parameter. Please keep in mind that parameters in
PreparedStatement objects start with 1 as the first
parameter. So parameters.get(0) maps to the parameter
with index 1.
Please note that you can modify the match parameters with
AbstractResultSetHandler.setCaseSensitive(boolean), AbstractResultSetHandler.setExactMatch(boolean) and
AbstractResultSetHandler.setUseRegularExpressions(boolean) and the match parameters for the
specified parameter list with setExactMatchParameter(boolean).
sql - the SQL stringparameters - the parameters
public void prepareThrowsSQLException(java.lang.String sql,
java.util.Map parameters)
AbstractResultSetHandler.setCaseSensitive(boolean), AbstractResultSetHandler.setExactMatch(boolean) and
AbstractResultSetHandler.setUseRegularExpressions(boolean) and the match parameters for the
specified parameter list with setExactMatchParameter(boolean).
sql - the SQL stringparameters - the parameters
public void prepareUpdateCount(java.lang.String sql,
int updateCount,
java.lang.Object[] parameters)
PreparedStatement objects start with 1 as the first
parameter. So parameters[0] maps to the
parameter with index 1.
Please note that you can modify the match parameters with
AbstractResultSetHandler.setCaseSensitive(boolean), AbstractResultSetHandler.setExactMatch(boolean) and
AbstractResultSetHandler.setUseRegularExpressions(boolean) and the match parameters for the
specified parameter list with setExactMatchParameter(boolean).
sql - the SQL stringupdateCount - the update countparameters - the parameters
public void prepareUpdateCount(java.lang.String sql,
int updateCount,
java.util.List parameters)
List
must contain the parameters in the correct order starting with 0 as
the first parameter. Please keep in mind that parameters in
PreparedStatement objects start with 1 as the first
parameter. So parameters.get(0) maps to the
parameter with index 1.
Please note that you can modify the match parameters with
AbstractResultSetHandler.setCaseSensitive(boolean), AbstractResultSetHandler.setExactMatch(boolean) and
AbstractResultSetHandler.setUseRegularExpressions(boolean) and the match parameters for the
specified parameter list with setExactMatchParameter(boolean).
sql - the SQL stringupdateCount - the update countparameters - the parameters
public void prepareUpdateCount(java.lang.String sql,
int updateCount,
java.util.Map parameters)
Map
must contain the parameters by mapping Integer objects
to the corresponding parameter. The Integer object
is the index of the parameter. In the case of a CallableStatement
there are also allowed String keys for named parameters.
Please note that you can modify the match parameters with
AbstractResultSetHandler.setCaseSensitive(boolean), AbstractResultSetHandler.setExactMatch(boolean) and
AbstractResultSetHandler.setUseRegularExpressions(boolean) and the match parameters for the
specified parameter list with setExactMatchParameter(boolean).
sql - the SQL stringupdateCount - the update countparameters - the parameters
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||