/** * Invoke the callable statement * @return the output parameters resulting from the invocation. */ public OutParameters invoke() { try { final PreparedStatement stmt = this.internalExecute(); OutParameters out = new OutParameters(); for (OutParamArgument param : params) { Object obj = param.map((CallableStatement) stmt); // convert from JDBC 1-based position to Jdbi's 0-based int index = param.position - 1; out.getMap().put(index, obj); if (param.name != null) { out.getMap().put(param.name, obj); } } return out; } finally { close(); } }
/** * Invoke the callable statement * @return the output parameters resulting from the invocation. */ public OutParameters invoke() { try { final PreparedStatement stmt = this.internalExecute(); OutParameters out = new OutParameters(); for ( OutParamArgument param : params ) { Object obj = param.map((CallableStatement)stmt); // convert from JDBC 1-based position to Jdbi's 0-based int index = param.position - 1; out.getMap().put(index, obj); if ( param.name != null ) { out.getMap().put(param.name, obj); } } return out; } finally { close(); } }
/** * Register a named output parameter * @param name the parameter name * @param sqlType an SQL type constant as defined by {@link java.sql.Types} or by the JDBC vendor. * @param mapper a mapper which converts the {@link CallableStatement} to a desired output type. * @return self */ public Call registerOutParameter(String name, int sqlType, CallableStatementMapper mapper) { getBinding().addNamed(name, new OutParamArgument(sqlType, mapper, name)); return this; }
/** * Register a positional output parameter * @param position the parameter position (zero-based) * @param sqlType an SQL type constant as defined by {@link java.sql.Types} or by the JDBC vendor. * @param mapper a mapper which converts the {@link CallableStatement} to a desired output type. * @return self */ public Call registerOutParameter(int position, int sqlType, CallableStatementMapper mapper) { getBinding().addPositional(position, new OutParamArgument(sqlType, mapper, null)); return this; }
/** * Register a positional output parameter * @param position the parameter position (zero-based) * @param sqlType an SQL type constant as defined by {@link java.sql.Types} or by the JDBC vendor. * @param mapper a mapper which converts the {@link CallableStatement} to a desired output type. * @return self */ public Call registerOutParameter(int position, int sqlType, CallableStatementMapper mapper) { getBinding().addPositional(position, new OutParamArgument(sqlType, mapper, null)); return this; }
/** * Register a named output parameter * @param name the parameter name * @param sqlType an SQL type constant as defined by {@link java.sql.Types} or by the JDBC vendor. * @param mapper a mapper which converts the {@link CallableStatement} to a desired output type. * @return self */ public Call registerOutParameter(String name, int sqlType, CallableStatementMapper mapper) { getBinding().addNamed(name, new OutParamArgument(sqlType, mapper, name)); return this; }