org.springframework.jdbc.core.JdbcTemplate.extractOutputParameters()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中org.springframework.jdbc.core.JdbcTemplate.extractOutputParameters()方法的一些代码示例,展示了JdbcTemplate.extractOutputParameters()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JdbcTemplate.extractOutputParameters()方法的具体详情如下:
包路径:org.springframework.jdbc.core.JdbcTemplate
类名称:JdbcTemplate
方法名:extractOutputParameters

JdbcTemplate.extractOutputParameters介绍

[英]Extract output parameters from the completed stored procedure.
[中]从已完成的存储过程中提取输出参数。

代码示例

代码示例来源:origin: spring-projects/spring-framework

returnedResults.putAll(extractReturnedResults(cs, updateCountParameters, resultSetParameters, updateCount));
  returnedResults.putAll(extractOutputParameters(cs, callParameters));
  return returnedResults;
});

代码示例来源:origin: oVirt/ovirt-engine

@SuppressWarnings({ "rawtypes", "unchecked" })
  @Override
  protected Map extractOutputParameters(CallableStatement cs, List parameters) throws SQLException {
    Map<String, Object> outputParameters = super.extractOutputParameters(cs, parameters);
    Map<String, Object> returnMap = new HashMap<>(outputParameters.size());
    for (Map.Entry<String, Object> outputEntry : outputParameters.entrySet()) {
      // Get the value before we change the key (otherwise we won't be able to get it later when we need it).
      String parameter = outputEntry.getKey();
      Object value = outputEntry.getValue();
      if (parameter != null && parameter.length() > PREFIX.length() && parameter.startsWith(PREFIX)) {
        parameter = parameter.substring(PREFIX.length());
      }
      returnMap.put(parameter, value);
    }
    return returnMap;
  }
}

代码示例来源:origin: org.springframework/org.springframework.jdbc

public Map<String, Object> doInCallableStatement(CallableStatement cs) throws SQLException {
    boolean retVal = cs.execute();
    int updateCount = cs.getUpdateCount();
    if (logger.isDebugEnabled()) {
      logger.debug("CallableStatement.execute() returned '" + retVal + "'");
      logger.debug("CallableStatement.getUpdateCount() returned " + updateCount);
    }
    Map<String, Object> returnedResults = createResultsMap();
    if (retVal || updateCount != -1) {
      returnedResults.putAll(extractReturnedResults(cs, updateCountParameters, resultSetParameters, updateCount));
    }
    returnedResults.putAll(extractOutputParameters(cs, callParameters));
    return returnedResults;
  }
});

相关文章