Beispiel #1
0
 private void retrieveOutputParameters(
     StatementScope statementScope,
     CallableStatement cs,
     ParameterMapping[] mappings,
     Object[] parameters,
     RowHandlerCallback callback)
     throws SQLException {
   for (int i = 0; i < mappings.length; i++) {
     ParameterMapping mapping = ((ParameterMapping) mappings[i]);
     if (mapping.isOutputAllowed()) {
       if ("java.sql.ResultSet".equalsIgnoreCase(mapping.getJavaTypeName())) {
         ResultSet rs = (ResultSet) cs.getObject(i + 1);
         ResultMap resultMap;
         if (mapping.getResultMapName() == null) {
           resultMap = statementScope.getResultMap();
           handleOutputParameterResults(statementScope, resultMap, rs, callback);
         } else {
           SqlMapClientImpl client =
               (SqlMapClientImpl) statementScope.getSession().getSqlMapClient();
           resultMap = client.getDelegate().getResultMap(mapping.getResultMapName());
           DefaultRowHandler rowHandler = new DefaultRowHandler();
           RowHandlerCallback handlerCallback =
               new RowHandlerCallback(resultMap, null, rowHandler);
           handleOutputParameterResults(statementScope, resultMap, rs, handlerCallback);
           parameters[i] = rowHandler.getList();
         }
         rs.close();
       } else {
         parameters[i] = mapping.getTypeHandler().getResult(cs, i + 1);
       }
     }
   }
 }
Beispiel #2
0
 private void registerOutputParameters(CallableStatement cs, ParameterMapping[] mappings)
     throws SQLException {
   for (int i = 0; i < mappings.length; i++) {
     ParameterMapping mapping = ((ParameterMapping) mappings[i]);
     if (mapping.isOutputAllowed()) {
       if (null != mapping.getTypeName() && !mapping.getTypeName().equals("")) { // @added
         cs.registerOutParameter(i + 1, mapping.getJdbcType(), mapping.getTypeName());
       } else {
         if (mapping.getNumericScale() != null
             && (mapping.getJdbcType() == Types.NUMERIC
                 || mapping.getJdbcType() == Types.DECIMAL)) {
           cs.registerOutParameter(
               i + 1, mapping.getJdbcType(), mapping.getNumericScale().intValue());
         } else {
           cs.registerOutParameter(i + 1, mapping.getJdbcType());
         }
       }
     }
   }
 }