Exemplo n.º 1
0
  /** set input parameter bindings */
  private void setInputParameterBinding() throws DataException {
    assert odaStatement != null;

    //		 set input parameter bindings
    Iterator inputParamValueslist = getInputParamValues().iterator();
    while (inputParamValueslist.hasNext()) {
      ParameterBinding paramBind = (ParameterBinding) inputParamValueslist.next();
      if (paramBind.getPosition() <= 0 || odaStatement.supportsNamedParameter()) {
        try {
          odaStatement.setParameterValue(paramBind.getName(), paramBind.getValue());
        } catch (DataException e) {
          if (paramBind.getPosition() <= 0) {
            throw e;
          } else {
            odaStatement.setParameterValue(paramBind.getPosition(), paramBind.getValue());
          }
        }
      } else {
        odaStatement.setParameterValue(paramBind.getPosition(), paramBind.getValue());
      }
    }
  }
Exemplo n.º 2
0
  /** Adds input and output parameter hints to odaStatement */
  private void addParameterDefns() throws DataException {
    assert odaStatement != null;

    if (this.parameterHints == null) return; // nothing to add

    // iterate thru the collection to add parameter hints
    Iterator it = this.parameterHints.iterator();
    while (it.hasNext()) {
      ParameterHint parameterHint = (ParameterHint) it.next();
      odaStatement.addParameterHint(parameterHint);

      // If the parameter is input parameter then add it to input value list.
      if (parameterHint.isInputMode()) {
        Object inputValue = getParameterInputValue(parameterHint);
        if (parameterHint.getPosition() <= 0 || odaStatement.supportsNamedParameter()) {
          this.setInputParamValue(parameterHint.getName(), parameterHint.getPosition(), inputValue);

        } else {
          this.setInputParamValue(parameterHint.getPosition(), inputValue);
        }
      }
    }
    this.setInputParameterBinding();
  }