Exemplo n.º 1
0
  /**
   * Normalization method - this method may be called when putting a value into a SQLDecimal, for
   * example, when inserting into a SQLDecimal column. See NormalizeResultSet in execution.
   *
   * <p>Note that truncation is allowed on the decimal portion of a numeric only.
   *
   * @param desiredType The type to normalize the source column to
   * @param source The value to normalize
   * @throws StandardException Thrown for null into non-nullable column, and for truncation error
   */
  public void normalize(DataTypeDescriptor desiredType, DataValueDescriptor source)
      throws StandardException {
    int desiredScale = desiredType.getScale();
    int desiredPrecision = desiredType.getPrecision();

    setFrom(source);
    setWidth(desiredPrecision, desiredScale, true);
  }
Exemplo n.º 2
0
  /**
   * Normalization method - this method may be called when putting a value into a SQLBit, for
   * example, when inserting into a SQLBit column. See NormalizeResultSet in execution.
   *
   * @param desiredType The type to normalize the source column to
   * @param source The value to normalize
   * @exception StandardException Thrown for null into non-nullable column, and for truncation error
   */
  public void normalize(DataTypeDescriptor desiredType, DataValueDescriptor source)
      throws StandardException {
    int desiredWidth = desiredType.getMaximumWidth();

    ((SQLBinary) this).setValue(source.getBytes());
    setWidth(desiredWidth, 0, true);
  }