/** * INTERNAL: * Return 1-based index of out cursor parameter, or -1. */ public int getCursorOutIndex() { for (int i = 0; i < getParameters().size(); i++) { Object parameter = getParameters().elementAt(i); if (parameter instanceof OutputParameterForCallableStatement) { if (((OutputParameterForCallableStatement)parameter).isCursor()) { return i + 1; } } } return -1; }
/** * INTERNAL: * Return DatabaseRow containing output fields and values. * Called only if shouldBuildOutputRow method returns true. */ public AbstractRecord buildOutputRow(CallableStatement statement) throws SQLException { AbstractRecord row = new DatabaseRecord(); for (int index = 0; index < parameters.size(); index++) { Object parameter = parameters.elementAt(index); if (parameter instanceof OutputParameterForCallableStatement) { OutputParameterForCallableStatement outParameter = (OutputParameterForCallableStatement)parameter; if (!outParameter.isCursor()) { Object value = statement.getObject(index + 1); DatabaseField field = outParameter.getOutputField(); row.put(field, value); } } } return row; }
public void prepare(DatabasePlatform platform) { if (isCursor()) { jdbcType = platform.getCursorCode();// Oracle code for cursors } else { jdbcType = platform.getJDBCType(getOutputField()); isTypeNameRequired = platform.requiresTypeNameToRegisterOutputParameter(); if (isTypeNameRequired) { typeName = platform.getJdbcTypeName(jdbcType); } } }