private int setMultipleUpdateCounts(Integer[] updateCounts, MockParameterMap params) {
   setUpdateCounts(updateCounts);
   setGeneratedKeysResultSet(sql, params);
   if (null != updateCounts && updateCounts.length > 0) {
     return updateCounts[0];
   }
   return 0;
 }
 private MockResultSet cloneAndSetSingleResultSet(MockResultSet result, MockParameterMap params) {
   result = cloneResultSet(result);
   if (null != result) {
     resultSetHandler.addReturnedResultSet(result);
   }
   setResultSets(new MockResultSet[] {result});
   setGeneratedKeysResultSet(sql, params);
   return result;
 }
 private MockResultSet cloneAndSetMultipleResultSets(
     MockResultSet[] results, MockParameterMap params) {
   results = cloneResultSets(results);
   if (null != results) {
     resultSetHandler.addReturnedResultSets(results);
   }
   setResultSets(results);
   setGeneratedKeysResultSet(sql, params);
   if (null != results && results.length > 0) {
     return results[0];
   }
   return null;
 }
 protected int executeUpdate(MockParameterMap params) throws SQLException {
   SQLException exception = resultSetHandler.getSQLException(sql, params);
   if (null != exception) {
     throw exception;
   }
   exception = resultSetHandler.getSQLException(sql);
   if (null != exception) {
     throw exception;
   }
   resultSetHandler.addParameterMapForExecutedStatement(getSQL(), getParameterMapCopy(params));
   Integer[] updateCounts = resultSetHandler.getUpdateCounts(getSQL(), params);
   if (updateCounts != null && updateCounts.length != 0) {
     resultSetHandler.addExecutedStatement(getSQL());
     if (updateCounts.length > 1) {
       return setMultipleUpdateCounts(updateCounts.clone(), params);
     } else {
       return setSingleUpdateCount(updateCounts[0], params);
     }
   }
   int superUpdateCount = super.executeUpdate(getSQL());
   setGeneratedKeysResultSet(sql, params);
   return superUpdateCount;
 }
 protected ResultSet executeQuery(MockParameterMap params) throws SQLException {
   SQLException exception = resultSetHandler.getSQLException(sql, params);
   if (null != exception) {
     throw exception;
   }
   exception = resultSetHandler.getSQLException(sql);
   if (null != exception) {
     throw exception;
   }
   resultSetHandler.addParameterMapForExecutedStatement(getSQL(), getParameterMapCopy(params));
   MockResultSet[] results = resultSetHandler.getResultSets(getSQL(), params);
   if (results != null && results.length != 0) {
     resultSetHandler.addExecutedStatement(getSQL());
     if (results.length > 1) {
       return cloneAndSetMultipleResultSets(results, params);
     } else {
       return cloneAndSetSingleResultSet(results[0], params);
     }
   }
   ResultSet superResultSet = super.executeQuery(getSQL());
   setGeneratedKeysResultSet(sql, params);
   return superResultSet;
 }
 private int setSingleUpdateCount(int updateCount, MockParameterMap params) {
   setUpdateCounts(new Integer[] {updateCount});
   setGeneratedKeysResultSet(sql, params);
   return updateCount;
 }