Because OrderableDataType is a subtype of DataType, SQLDecimal can play a role in either a DataType/Row or a OrderableDataType/Row, interchangeably.
We assume the store has a flag for nullness of the value, and simply return a 0-length array for the stored form when the value is null.
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private static final int | |
| private byte[] | rawData
See comments for value |
| private int | rawScale
See comments for value |
| private BigDecimal | value
object state. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public DataValueDescriptor | cloneValue(boolean
any streams representing the data value will
be materialized if forceMaterialization)true, the data value will be kept as a
stream if possible if falseImplements org. Clone this DataValueDescriptor. |
| public NumberDataValue | Returns: A SQLDecimal containing the result of the divisionThe numerator dividend, NumberDataValue The denominator divisor, NumberDataValue The result of a previous call to this method, null
if not called yet result)Overrides org. Implements org. This method implements the / operator for BigDecimal/BigDecimal |
| public NumberDataValue | Returns: A SQLDecimal containing the result of the divisionThe numerator dividend, NumberDataValue The denominator divisor, NumberDataValue The result of a previous call to this method, null
if not called yet result, int The result scale, if < 0, calculate the scale according
to the actual values' sizes scale)Overrides org. Implements org. This method implements the / operator for BigDecimal/BigDecimal |
| public int | estimateMemoryUsage()
Implements org. Estimate the memory usage in bytes of the data value and the overhead of the class. |
| private BigDecimal | |
| public static BigDecimal | Returns: BigDecimal valueNon-null value to be converted value)Get a BigDecimal representing the value of a DataValueDescriptor |
| public boolean | getBoolean()
Overrides org. Implements org. Gets the value in the data value descriptor as a boolean. |
| public byte | getByte()
Overrides org. Implements org. Gets the value in the data value descriptor as a byte. |
| public int | getDecimalValuePrecision()
Return the SQL scale of this value, number of digits after the decimal point, or zero for a whole number. |
| public int | getDecimalValueScale()
Return the SQL scale of this value, number of digits after the decimal point, or zero for a whole number. |
| public double | getDouble()
Overrides org. Implements org. If we have a value that is greater than the maximum double, exception is thrown. |
| public float | getFloat()
Overrides org. Implements org. Gets the value in the data value descriptor as a float. |
| public int | getInt()
Overrides org. Implements org. Gets the value in the data value descriptor as an int. |
| public int | getLength()
Implements org. Gets the length of the data value. |
| public long | getLong()
Overrides org. Implements org. Gets the value in the data value descriptor as a long. |
| public DataValueDescriptor | getNewNull()
Implements org. Get a new null value of the same type as this data value. |
| public Object | getObject()
Overrides org. Implements org. Gets the value in the data value descriptor as a Java Object. |
| public short | getShort()
Overrides org. Implements org. Gets the value in the data value descriptor as a short. |
| public String | getString()
Implements org. Gets the value in the data value descriptor as a String. |
| public int | getTypeFormatId()
Implements org. Return my format identifier. |
| public String | getTypeName()
Implements org. Get the SQL name of the datatype |
| private static int | Returns: number of whole digits.Value to get whole digits from, never null. decimalValue)Calculate the number of digits to the left of the decimal point of the passed in value. |
| public int | |
| protected boolean | Returns: A boolean. If this.value is negative, return true. For positive values or null, return false.Implements abstract org. This method implements the isNegative method. |
| public boolean | isNull()
Implements org. Return whether the value is null or not. |
| public NumberDataValue | Returns: A SQLDecimal containing the result of the subtractionThe value to be subtracted from left, NumberDataValue The value to be subtracted right, NumberDataValue The result of a previous call to this method, null
if not called yet result)Overrides org. Implements org. This method implements the - operator for "decimal - decimal". |
| public NumberDataValue | Returns: A SQLDecimal containing the result of the divisionThe result of a previous call to this method, null
if not called yet result)Implements org. This method implements the unary minus operator for double. |
| public void | normalize(DataTypeDescriptor
The type to normalize the source column to desiredType, DataValueDescriptor The value to normalize source)Overrides org. Implements org. Normalization method - this method may be called when putting a value into a SQLDecimal, for example, when inserting into a SQLDecimal column. |
| public NumberDataValue | Returns: A SQLDecimal containing the result of the additionOne of the addends addend1, NumberDataValue The other addend addend2, NumberDataValue The result of a previous call to this method, null
if not called yet result)Overrides org. Implements org. This method implements the + operator for DECIMAL. |
| public void | readExternal(ObjectInput
the stream to read data from in order to restore the object in)Implements java. Note the use of rawData: we reuse the array if the incoming array is the same length or smaller than the array length. |
| public void | restoreToNull()
Implements org. Restore this object to its (SQL)null value. |
| public void | setBigDecimal(BigDecimal
required to be a BigDecimal or null. theValue)Overrides org. Implements org. Only to be called when the application sets a value using BigDecimal through setBigDecimal calls. |
| private void | |
| private void | |
| protected void | setFrom(DataValueDescriptor
The DataValueDescriptor that holds the value to
which we want to set this DataValueDescriptor's value. theValue)Overrides org. Set the value of this DataValueDescriptor based on the value of the specified DataValueDescriptor. |
| public final void | setInto(PreparedStatement ps, int position)
Overrides org. Implements org. Set the value into a PreparedStatement. |
| pack-priv void | setObject(Object theValue)
Overrides org. Set the value from a correctly typed BigDecimal object. |
| public void | setValue(String
The String value to set this DataValueDescriptor to theValue)Overrides org. Implements org. Warning there is no checking to make sure that theValue doesn't exceed the precision/scale of the current SQLDecimal. |
| public void | setValue(double
The value to set this DataValueDescriptor to theValue)Overrides org. Implements org. Set the value of this DataValueDescriptor to the given double value |
| public void | setValue(float
A Double containing the value to set this
DataValueDescriptor to. Null means set the value
to SQL null. theValue)Overrides org. Implements org. Set the value of this DataValueDescriptor to the given double value |
| public void | setValue(long
The value to set this DataValueDescriptor to theValue)Overrides org. Implements org. Set the value of this DataValueDescriptor to the given long value |
| public void | setValue(int
The value to set this DataValueDescriptor to theValue)Overrides org. Implements org. Set the value of this DataValueDescriptor to the given int value |
| public void | setValue(Number
An Number containing the value to set this
NumberDataValue to. Null means set the value
to SQL null. theValue)Overrides org. Implements org. Called when setting a DECIMAL value internally or from through a procedure or function. |
| public void | setValue(boolean
Contains the boolean value to set this to theValue)Overrides org. Implements org. Set the value. |
| public void | setValueFromResultSet(ResultSet
The specified ResultSet. resultSet, int The 1-based column # into the resultSet. colNumber, boolean Whether or not the column is nullable
(No need to call wasNull() if not) isNullable)Implements org. Set the value based on the value for the specified DataValueDescriptor from the specified ResultSet. |
| public void | setWidth(int
the desired precision -- IGNORE_PREICISION
if it is to be ignored. desiredPrecision, int the desired scale desiredScale, boolean throw error on truncation (ignored --
always thrown if we truncate the non-decimal part of
the value) errorOnTrunc)Implements org. Set the precision/scale of the to the desired values. |
| public NumberDataValue | Returns: A SQLDecimal containing the result of the multiplicationThe first value to be multiplied left, NumberDataValue The second value to be multiplied right, NumberDataValue The result of a previous call to this method, null
if not called yet result)Implements org. This method implements the * operator for "double * double". |
| public String | |
| protected int | typeCompare(DataValueDescriptor arg)
Implements abstract org. Compare this (not null) to a non-null value. |
| public int | typePrecedence()
Overrides org. Implements org. Each built-in type in JSQL has a precedence. |
| public int | typeToBigDecimal()
Overrides org. Implements org. DECIMAL implementation. |
| public void | writeExternal(ObjectOutput
the stream to write the object to out)Implements java. Distill the BigDecimal to a byte array and write out:
|