com.mockrunner.jdbc
Class AbstractParameterResultSetHandler

java.lang.Object
  extended by com.mockrunner.jdbc.AbstractResultSetHandler
      extended by com.mockrunner.jdbc.AbstractParameterResultSetHandler
Direct Known Subclasses:
AbstractOutParameterResultSetHandler, PreparedStatementResultSetHandler

public abstract class AbstractParameterResultSetHandler
extends AbstractResultSetHandler

Abstract base class for all statement types that support parameters, i.e. PreparedStatement and CallableStatement.


Nested Class Summary
protected  class AbstractParameterResultSetHandler.ParameterWrapper
           
 
Constructor Summary
AbstractParameterResultSetHandler()
           
 
Method Summary
 void addParameterMapForExecutedStatement(java.lang.String sql, java.util.Map parameters)
          Collects all SQL strings that were executed.
 void clearGeneratedKeys()
          Clears the list of statements that return generated keys.
 void clearResultSets()
          Clears the ResultSet objects.
 void clearThrowsSQLException()
          Clears the list of statements that should throw an exception
 void clearUpdateCounts()
          Clears the update counts.
 java.util.Map getExecutedStatementParameter()
          Deprecated. use getExecutedStatementParameterMap()
 java.util.Map getExecutedStatementParameterMap()
          Returns the Map of executed SQL strings.
 MockResultSet getGeneratedKeys(java.lang.String sql, java.util.Map parameters)
          Returns the first generated keys ResultSet that matches the specified SQL string.
protected  AbstractParameterResultSetHandler.ParameterWrapper getMatchingParameterWrapper(java.lang.String sql, java.util.Map parameters, java.util.Map statementMap)
           
 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.
 MockResultSet[] getResultSets(java.lang.String sql, java.util.Map parameters)
          Returns the first ResultSet[] that matches the specified SQL string and the specified parameters.
 java.sql.SQLException getSQLException(java.lang.String sql, java.util.Map parameters)
          Returns the SQLException the specified SQL string should throw.
 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.
 java.lang.Integer[] getUpdateCounts(java.lang.String sql, java.util.Map parameters)
          Returns the first update count array that matches the specified SQL string and the specified parameters.
 boolean hasMultipleResultSets(java.lang.String sql, java.util.Map parameters)
          Returns the if the specified SQL string with the specified parameters returns multiple result sets.
 boolean hasMultipleUpdateCounts(java.lang.String sql, java.util.Map parameters)
          Returns the if the specified SQL string with the specified parameters returns multiple update counts.
 void prepareGeneratedKeys(java.lang.String sql, MockResultSet generatedKeysResult, java.util.List parameters)
          Prepare the generated keys ResultSet for a specified SQL string.
 void prepareGeneratedKeys(java.lang.String sql, MockResultSet generatedKeysResult, java.util.Map parameters)
          Prepare the generated keys ResultSet for a specified SQL string.
 void prepareGeneratedKeys(java.lang.String sql, MockResultSet generatedKeysResult, java.lang.Object[] parameters)
          Prepare the generated keys ResultSet for a specified SQL string.
 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 prepareResultSets(java.lang.String sql, MockResultSet[] resultSets, java.util.List parameters)
          Prepare an array of ResultSet objects for a specified SQL string and the specified parameters.
 void prepareResultSets(java.lang.String sql, MockResultSet[] resultSets, java.util.Map parameters)
          Prepare an array of ResultSet objects for a specified SQL string and the specified parameters.
 void prepareResultSets(java.lang.String sql, MockResultSet[] resultSets, java.lang.Object[] parameters)
          Prepare an array of ResultSet objects for a specified SQL string and the specified parameters.
 void prepareThrowsSQLException(java.lang.String sql, java.util.List parameters)
          Prepare that the specified SQL string with the specified parameters should raise an exception.
 void prepareThrowsSQLException(java.lang.String sql, java.util.Map parameters)
          Prepare that the specified SQL string with the specified parameters should raise an exception.
 void prepareThrowsSQLException(java.lang.String sql, java.lang.Object[] parameters)
          Prepare that the specified SQL string with the specified parameters should raise an exception.
 void prepareThrowsSQLException(java.lang.String sql, java.sql.SQLException exc, java.util.List parameters)
          Prepare that the specified SQL string with the specified parameters should raise an exception.
 void prepareThrowsSQLException(java.lang.String sql, java.sql.SQLException exc, java.util.Map parameters)
          Prepare that the specified SQL string with the specified parameters should raise an exception.
 void prepareThrowsSQLException(java.lang.String sql, java.sql.SQLException exc, java.lang.Object[] parameters)
          Prepare that 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 prepareUpdateCounts(java.lang.String sql, int[] updateCounts, java.util.List parameters)
          Prepare an array update count values for execute update calls for a specified SQL string and the specified parameters.
 void prepareUpdateCounts(java.lang.String sql, int[] updateCounts, java.util.Map parameters)
          Prepare an array update count values for execute update calls for a specified SQL string and the specified parameters.
 void prepareUpdateCounts(java.lang.String sql, int[] updateCounts, java.lang.Object[] parameters)
          Prepare an array update count values 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 com.mockrunner.jdbc.AbstractResultSetHandler
addExecutedStatement, addReturnedResultSet, addReturnedResultSets, clearGlobalGeneratedKeys, clearGlobalResultSet, clearGlobalUpdateCount, clearReturnsResultSet, createResultSet, createResultSet, createResultSet, createResultSet, getCaseSensitive, getContinueProcessingOnBatchFailure, getExactMatch, getExecutedStatements, getGeneratedKeys, getGeneratedKeysMap, getGlobalGeneratedKeys, getGlobalResultSet, getGlobalResultSets, getGlobalUpdateCount, getGlobalUpdateCounts, getResultSet, getResultSetMap, getResultSets, getReturnedResultSets, getReturnsResultSet, getSQLException, getThrowsSQLException, getUpdateCount, getUpdateCountMap, getUpdateCounts, getUseRegularExpressions, hasMultipleGlobalResultSets, hasMultipleGlobalUpdateCounts, hasMultipleResultSets, hasMultipleUpdateCounts, prepareGeneratedKeys, prepareGlobalGeneratedKeys, prepareGlobalResultSet, prepareGlobalResultSets, prepareGlobalUpdateCount, prepareGlobalUpdateCounts, prepareResultSet, prepareResultSets, prepareReturnsResultSet, prepareThrowsSQLException, prepareThrowsSQLException, prepareUpdateCount, prepareUpdateCounts, setCaseSensitive, setContinueProcessingOnBatchFailure, setExactMatch, setUseRegularExpressions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractParameterResultSetHandler

public AbstractParameterResultSetHandler()
Method Detail

addParameterMapForExecutedStatement

public void addParameterMapForExecutedStatement(java.lang.String sql,
                                                java.util.Map parameters)
Collects all SQL strings that were executed.

Parameters:
sql - the SQL string
parameters - a copy of the corresponding parameter map

getParametersForExecutedStatement

public ParameterSets getParametersForExecutedStatement(java.lang.String sql)
Returns the ParameterSets for a specified SQL string.

Parameters:
sql - the SQL string
Returns:
the Map of parameters

getExecutedStatementParameterMap

public java.util.Map getExecutedStatementParameterMap()
Returns the Map of executed SQL strings. Each string maps to the corresponding ParameterSets object.

Returns:
the Map of parameters

getExecutedStatementParameter

public java.util.Map getExecutedStatementParameter()
Deprecated. use getExecutedStatementParameterMap()


setExactMatchParameter

public void setExactMatchParameter(boolean exactMatchParameter)
Sets if the specified parameters must match exactly in order and number. Defaults to 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.

Parameters:
exactMatchParameter - must parameters match exactly

getUpdateCount

public 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. If the specified SQL string was prepared to return multiple update counts, the first one will be returned. 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).

Parameters:
sql - the SQL string
parameters - the parameters
Returns:
the corresponding update count

getUpdateCounts

public java.lang.Integer[] getUpdateCounts(java.lang.String sql,
                                           java.util.Map parameters)
Returns the first update count array that matches the specified SQL string and the specified parameters. If the specified SQL string was prepared to return one update count, this value will be wrapped in an array with one element. 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).

Parameters:
sql - the SQL string
parameters - the parameters
Returns:
the corresponding update count

hasMultipleUpdateCounts

public boolean hasMultipleUpdateCounts(java.lang.String sql,
                                       java.util.Map parameters)
Returns the if the specified SQL string with the specified parameters returns multiple update counts. Please note that you can modify the match parameters with AbstractResultSetHandler.setCaseSensitive(boolean), AbstractResultSetHandler.setExactMatch(boolean) and AbstractResultSetHandler.setUseRegularExpressions(boolean).

Parameters:
sql - the SQL string
Returns:
true if the SQL string returns multiple update counts, false otherwise

getResultSet

public MockResultSet getResultSet(java.lang.String sql,
                                  java.util.Map parameters)
Returns the first ResultSet that matches the specified SQL string and the specified parameters. If the specified SQL string was prepared to return multiple result sets, the first one will be returned. 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).

Parameters:
sql - the SQL string
parameters - the parameters
Returns:
the corresponding MockResultSet

getResultSets

public MockResultSet[] getResultSets(java.lang.String sql,
                                     java.util.Map parameters)
Returns the first ResultSet[] that matches the specified SQL string and the specified parameters. If the specified SQL string was prepared to return one single ResultSet, this ResultSet will be wrapped in an array with one element. 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).

Parameters:
sql - the SQL string
parameters - the parameters
Returns:
the corresponding update count

hasMultipleResultSets

public boolean hasMultipleResultSets(java.lang.String sql,
                                     java.util.Map parameters)
Returns the if the specified SQL string with the specified parameters returns multiple result sets. Please note that you can modify the match parameters with AbstractResultSetHandler.setCaseSensitive(boolean), AbstractResultSetHandler.setExactMatch(boolean) and AbstractResultSetHandler.setUseRegularExpressions(boolean).

Parameters:
sql - the SQL string
Returns:
true if the SQL string returns multiple update counts, false otherwise

getThrowsSQLException

public boolean getThrowsSQLException(java.lang.String sql,
                                     java.util.Map parameters)
Returns if the specified SQL string with the specified parameters should raise an exception. This can be used to simulate database exceptions. 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).

Parameters:
sql - the SQL string
parameters - the parameters
Returns:
true if the specified SQL string should raise an exception, false otherwise

getSQLException

public java.sql.SQLException getSQLException(java.lang.String sql,
                                             java.util.Map parameters)
Returns the SQLException the specified SQL string should throw. Returns null if the specified SQL string should not throw an exception. This can be used to simulate database exceptions. 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).

Parameters:
sql - the SQL string
parameters - the parameters
Returns:
the SQLException or null

getGeneratedKeys

public MockResultSet getGeneratedKeys(java.lang.String sql,
                                      java.util.Map parameters)
Returns the first generated keys ResultSet that matches the specified SQL string. 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).

Parameters:
sql - the SQL string
parameters - the parameters
Returns:
the corresponding generated keys MockResultSet

getMatchingParameterWrapper

protected AbstractParameterResultSetHandler.ParameterWrapper getMatchingParameterWrapper(java.lang.String sql,
                                                                                         java.util.Map parameters,
                                                                                         java.util.Map statementMap)

clearResultSets

public void clearResultSets()
Clears the ResultSet objects.

Overrides:
clearResultSets in class AbstractResultSetHandler

clearUpdateCounts

public void clearUpdateCounts()
Clears the update counts.

Overrides:
clearUpdateCounts in class AbstractResultSetHandler

clearThrowsSQLException

public void clearThrowsSQLException()
Clears the list of statements that should throw an exception

Overrides:
clearThrowsSQLException in class AbstractResultSetHandler

clearGeneratedKeys

public void clearGeneratedKeys()
Clears the list of statements that return generated keys.

Overrides:
clearGeneratedKeys in class AbstractResultSetHandler

prepareResultSet

public void prepareResultSet(java.lang.String sql,
                             MockResultSet resultSet,
                             java.lang.Object[] parameters)
Prepare a ResultSet for a specified SQL string and the specified parameters. The specified parameters array must contain the parameters in the correct order starting with index 0 for 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).

Parameters:
sql - the SQL string
resultSet - the corresponding MockResultSet
parameters - the parameters

prepareResultSets

public void prepareResultSets(java.lang.String sql,
                              MockResultSet[] resultSets,
                              java.lang.Object[] parameters)
Prepare an array of ResultSet objects for a specified SQL string and the specified parameters. This method can be used for queries that return multiple result sets. The specified parameters array must contain the parameters in the correct order starting with index 0 for 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).

Parameters:
sql - the SQL string
resultSets - the corresponding MockResultSet[]
parameters - the parameters

prepareResultSet

public void prepareResultSet(java.lang.String sql,
                             MockResultSet resultSet,
                             java.util.List parameters)
Prepare a ResultSet for a specified SQL string and the specified parameters. The specified parameters List must contain the parameters in the correct order starting with index 0 for 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).

Parameters:
sql - the SQL string
resultSet - the corresponding MockResultSet
parameters - the parameters

prepareResultSets

public void prepareResultSets(java.lang.String sql,
                              MockResultSet[] resultSets,
                              java.util.List parameters)
Prepare an array of ResultSet objects for a specified SQL string and the specified parameters. This method can be used for queries that return multiple result sets. The specified parameters List must contain the parameters in the correct order starting with index 0 for 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).

Parameters:
sql - the SQL string
resultSets - the corresponding MockResultSet[]
parameters - the parameters

prepareResultSet

public void prepareResultSet(java.lang.String sql,
                             MockResultSet resultSet,
                             java.util.Map parameters)
Prepare a 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, String keys for named parameters are also allowed. 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).

Parameters:
sql - the SQL string
resultSet - the corresponding MockResultSet
parameters - the parameters

prepareResultSets

public void prepareResultSets(java.lang.String sql,
                              MockResultSet[] resultSets,
                              java.util.Map parameters)
Prepare an array of ResultSet objects for a specified SQL string and the specified parameters. This method can be used for queries that return multiple result sets. 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, String keys for named parameters are also allowed. 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).

Parameters:
sql - the SQL string
resultSets - the corresponding MockResultSet[]
parameters - the parameters

prepareThrowsSQLException

public void prepareThrowsSQLException(java.lang.String sql,
                                      java.lang.Object[] parameters)
Prepare that the specified SQL string with the specified parameters should raise an exception. This can be used to simulate database exceptions. This method creates an SQLException and will throw this exception. With prepareThrowsSQLException(String, SQLException, Object[]) you can specify the exception. The specified parameters array must contain the parameters in the correct order starting with index 0 for 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).

Parameters:
sql - the SQL string
parameters - the parameters

prepareThrowsSQLException

public void prepareThrowsSQLException(java.lang.String sql,
                                      java.util.List parameters)
Prepare that the specified SQL string with the specified parameters should raise an exception. This can be used to simulate database exceptions. This method creates an SQLException and will throw this exception. With prepareThrowsSQLException(String, SQLException, List) you can specify the exception. The specified parameters List must contain the parameters in the correct order starting with index 0 for 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).

Parameters:
sql - the SQL string
parameters - the parameters

prepareThrowsSQLException

public void prepareThrowsSQLException(java.lang.String sql,
                                      java.util.Map parameters)
Prepare that the specified SQL string with the specified parameters should raise an exception. This can be used to simulate database exceptions. This method creates an SQLException and will throw this exception. With prepareThrowsSQLException(String, SQLException, Map) you can specify the exception. 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, String keys for named parameters are also allowed. 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).

Parameters:
sql - the SQL string
parameters - the parameters

prepareThrowsSQLException

public void prepareThrowsSQLException(java.lang.String sql,
                                      java.sql.SQLException exc,
                                      java.lang.Object[] parameters)
Prepare that the specified SQL string with the specified parameters should raise an exception. This can be used to simulate database exceptions. This method takes an exception object that will be thrown. The specified parameters array must contain the parameters in the correct order starting with index 0 for 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).

Parameters:
sql - the SQL string
exc - the SQLException that should be thrown
parameters - the parameters

prepareThrowsSQLException

public void prepareThrowsSQLException(java.lang.String sql,
                                      java.sql.SQLException exc,
                                      java.util.List parameters)
Prepare that the specified SQL string with the specified parameters should raise an exception. This can be used to simulate database exceptions. This method takes an exception object that will be thrown. The specified parameters List must contain the parameters in the correct order starting with index 0 for 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).

Parameters:
sql - the SQL string
exc - the SQLException that should be thrown
parameters - the parameters

prepareThrowsSQLException

public void prepareThrowsSQLException(java.lang.String sql,
                                      java.sql.SQLException exc,
                                      java.util.Map parameters)
Prepare that the specified SQL string with the specified parameters should raise an exception. This can be used to simulate database exceptions. This method takes an exception object that will be thrown. 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, String keys for named parameters are also allowed. 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).

Parameters:
sql - the SQL string
exc - the SQLException that should be thrown
parameters - the parameters

prepareUpdateCount

public 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. The specified parameters array must contain the parameters in the correct order starting with index 0 for 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).

Parameters:
sql - the SQL string
updateCount - the update count
parameters - the parameters

prepareUpdateCounts

public void prepareUpdateCounts(java.lang.String sql,
                                int[] updateCounts,
                                java.lang.Object[] parameters)
Prepare an array update count values for execute update calls for a specified SQL string and the specified parameters. This method can be used if multiple update counts are returned. The specified parameters array must contain the parameters in the correct order starting with index 0 for 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).

Parameters:
sql - the SQL string
updateCounts - the update count array
parameters - the parameters

prepareUpdateCount

public 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. The specified parameters List must contain the parameters in the correct order starting with index 0 for 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).

Parameters:
sql - the SQL string
updateCount - the update count
parameters - the parameters

prepareUpdateCounts

public void prepareUpdateCounts(java.lang.String sql,
                                int[] updateCounts,
                                java.util.List parameters)
Prepare an array update count values for execute update calls for a specified SQL string and the specified parameters. This method can be used if multiple update counts are returned. The specified parameters List must contain the parameters in the correct order starting with index 0 for 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).

Parameters:
sql - the SQL string
updateCounts - the update count array
parameters - the parameters

prepareUpdateCount

public 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. 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, String keys for named parameters are also allowed. 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).

Parameters:
sql - the SQL string
updateCount - the update count
parameters - the parameters

prepareUpdateCounts

public void prepareUpdateCounts(java.lang.String sql,
                                int[] updateCounts,
                                java.util.Map parameters)
Prepare an array update count values for execute update calls for a specified SQL string and the specified parameters. This method can be used if multiple update counts are returned. 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, String keys for named parameters are also allowed. 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).

Parameters:
sql - the SQL string
updateCounts - the update count array
parameters - the parameters

prepareGeneratedKeys

public void prepareGeneratedKeys(java.lang.String sql,
                                 MockResultSet generatedKeysResult,
                                 java.lang.Object[] parameters)
Prepare the generated keys ResultSet for a specified SQL string. The specified parameters array must contain the parameters in the correct order starting with index 0 for 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).

Parameters:
sql - the SQL string
generatedKeysResult - the generated keys MockResultSet
parameters - the parameters

prepareGeneratedKeys

public void prepareGeneratedKeys(java.lang.String sql,
                                 MockResultSet generatedKeysResult,
                                 java.util.List parameters)
Prepare the generated keys ResultSet for a specified SQL string. The specified parameters List must contain the parameters in the correct order starting with index 0 for 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).

Parameters:
sql - the SQL string
generatedKeysResult - the generated keys MockResultSet
parameters - the parameters

prepareGeneratedKeys

public void prepareGeneratedKeys(java.lang.String sql,
                                 MockResultSet generatedKeysResult,
                                 java.util.Map parameters)
Prepare the generated keys ResultSet for a specified SQL string. 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, String keys for named parameters are also allowed. 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).

Parameters:
sql - the SQL string
generatedKeysResult - the generated keys MockResultSet
parameters - the parameters