Example usage for java.sql CallableStatement registerOutParameter

List of usage examples for java.sql CallableStatement registerOutParameter

Introduction

In this page you can find the example usage for java.sql CallableStatement registerOutParameter.

Prototype

default void registerOutParameter(String parameterName, SQLType sqlType, String typeName) throws SQLException 

Source Link

Document

Registers the designated output parameter.

Usage

From source file:com.toxind.benchmark.thrid.ibatis.sqlmap.engine.execution.SqlExecutor.java

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());
                }/*from ww  w.j  a va  2 s .  co m*/
            }
        }
    }
}