Exemple #1
0
 /**
  * Get Input values to be bound to this statement.
  *
  * @param updateDesc The update descriptor.
  * @return An Object array containing input values to be bound to this statement.
  */
 private Object[] getInputValues(UpdateObjectDescImpl updateDesc) {
   Object[] inputValues = new Object[getColumnRefs().size() + columnRefsForWhereClause.size()];
   for (Iterator i = getColumnRefs().iterator(); i.hasNext(); ) {
     ColumnRef columnRef = (ColumnRef) i.next();
     // columnRef's index are 1 based.
     inputValues[columnRef.getIndex() - 1] = getInputValue(updateDesc, columnRef, false);
   }
   final boolean getBeforeValue = updateDesc.isBeforeImageRequired();
   for (Iterator i = columnRefsForWhereClause.iterator(); i.hasNext(); ) {
     ColumnRef columnRef = (ColumnRef) i.next();
     inputValues[columnRef.getIndex() - 1] = getInputValue(updateDesc, columnRef, getBeforeValue);
   }
   return inputValues;
 }
Exemple #2
0
  /**
   * Binds the value in the specified update descriptor corresponding with the specified column
   * reference to the specified statement.
   *
   * @param stmt the statement
   * @param columnRef the column reference
   * @param updateDesc the update descriptor
   * @throws SQLException thrown by setter methods on java.sql.PreparedStatement
   */
  private void bindInputColumn(
      DBStatement stmt,
      ColumnRef columnRef,
      UpdateObjectDescImpl updateDesc,
      boolean getBeforeValue)
      throws SQLException {

    Object inputValue = getInputValue(updateDesc, columnRef, getBeforeValue);
    stmt.bindInputColumn(
        columnRef.getIndex(), inputValue, columnRef.getColumnElement(), vendorType);
  }