This is the base class for all value classes.
It provides conversion and comparison methods.
| Methods |
| static Value |
cache(Value v)
Check if a value is in the cache that is equal to this value.
|
| static Value |
cache(Value v)
Check if a value is in the cache that is equal to this value. If yes,
this value should be used to save memory. If the value is not in the
cache yet, it is added.
Parameters:
v - the value to look for
Returns:
the value in the cache or the value passed
|
| static void |
clearCache()
Clear the value cache.
|
| static void |
clearCache()
Clear the value cache. Used for testing.
|
| static int |
getHigherOrder(int t1, int t2)
Get the higher value order type of two value types.
|
| static int |
getHigherOrder(int t1, int t2)
Get the higher value order type of two value types. If values need to be
converted to match the other operands value type, the value with the
lower order is converted to the value with the higher order.
Parameters:
t1 - the first value type
t2 - the second value type
Returns:
the higher value type of the two
|
| static int |
getOrder(int type)
Get the order of this value type.
|
| static int |
getOrder(int type)
Get the order of this value type.
Parameters:
type - the value type
Returns:
the order number
|
| static void |
rangeCheck(long zeroBasedOffset, long length, long dataSize)
Check the range of the parameters.
|
| static void |
rangeCheck(long zeroBasedOffset, long length, long dataSize)
Check the range of the parameters.
Parameters:
zeroBasedOffset - the offset (0 meaning no offset)
length - the length of the target
dataSize - the length of the source
|
| Value |
add(Value v)
Add a value and return the result.
|
| Value |
add(Value v)
Add a value and return the result.
Parameters:
v - the value to add
Returns:
the result
|
| boolean |
checkPrecision(long precision)
Check if the precision is smaller or equal than the given precision.
|
| boolean |
checkPrecision(long precision)
Check if the precision is smaller or equal than the given precision.
Parameters:
precision - the maximum precision
Returns:
true if the precision of this value is smaller or equal to the
given precision
|
| int |
compareSecure(Value v, CompareMode mode)
Compare the value with another value of the same type.
|
| int |
compareSecure(Value v, CompareMode mode)
Compare the value with another value of the same type.
Parameters:
v - the other value
mode - the compare mode
Returns:
0 if both values are equal, -1 if the other value is smaller, and
1 otherwise
|
| int |
compareTo(Value v, CompareMode mode)
Compare this value against another value using the specified compare
mode.
|
| int |
compareTo(Value v, CompareMode mode)
Compare this value against another value using the specified compare
mode.
Parameters:
v - the other value
mode - the compare mode
Returns:
0 if both values are equal, -1 if the other value is smaller, and
1 otherwise
|
| int |
compareTypeSafe(Value v, CompareMode mode)
Compare this value against another value given that the values are of the
same data type.
|
| int |
compareTypeSafe(Value v, CompareMode mode)
Compare this value against another value given that the values are of the
same data type.
Parameters:
v - the other value
mode - the compare mode
Returns:
0 if both values are equal, -1 if the other value is smaller, and
1 otherwise
|
| Value |
convertPrecision(long precision, boolean force)
Convert the precision to the requested value.
|
| Value |
convertPrecision(long precision, boolean force)
Convert the precision to the requested value. The precision of the
returned value may be somewhat larger than requested, because values with
a fixed precision are not truncated.
Parameters:
precision - the new precision
force - true if losing numeric precision is allowed
Returns:
the new value
|
| Value |
convertScale(boolean onlyToSmallerScale, int targetScale)
Convert the scale.
|
| Value |
convertScale(boolean onlyToSmallerScale, int targetScale)
Convert the scale.
Parameters:
onlyToSmallerScale - if the scale should not reduced
targetScale - the requested scale
Returns:
the value
|
| Value |
convertTo(int targetType)
Compare a value to the specified type.
|
| Value |
convertTo(int targetType)
Compare a value to the specified type.
Parameters:
targetType - the type of the returned value
Returns:
the converted value
|
| Value |
convertTo(int targetType, int precision, Mode mode)
Compare a value to the specified type.
|
| Value |
convertTo(int targetType, int precision, Mode mode)
Compare a value to the specified type.
Parameters:
targetType - the type of the returned value
precision - the precision of the column to convert this value to.
The special constant -1 is used to indicate that
the precision plays no role when converting the value
mode - the mode
Returns:
the converted value
|
| Value |
convertTo(int targetType, int precision, Mode mode, Object column, String[] enumerators)
Compare a value to the specified type.
|
| Value |
convertTo(int targetType, int precision, Mode mode, Object column, String[] enumerators)
Compare a value to the specified type.
Parameters:
targetType - the type of the returned value
precision - the precision of the column to convert this value to.
The special constant -1 is used to indicate that
the precision plays no role when converting the value
mode - the conversion mode
column - the column (if any), used for to improve the error message if conversion fails
enumerators - the ENUM datatype enumerators (if any),
for dealing with ENUM conversions
Returns:
the converted value
|
| Value |
convertToEnum(String[] enumerators)
Convert value to ENUM value
|
| Value |
convertToEnum(String[] enumerators)
Convert value to ENUM value
Parameters:
enumerators - allowed values for the ENUM to which the value is converted
Returns:
value represented as ENUM
|
| Value |
copy(DataHandler handler, int tableId)
Copy a large value, to be used in the given table.
|
| Value |
copy(DataHandler handler, int tableId)
Copy a large value, to be used in the given table. For values that are
kept fully in memory this method has no effect.
Parameters:
handler - the data handler
tableId - the table where this object is used
Returns:
the new value or itself
|
| Value |
copyToResult()
Create an independent copy of this value if needed, that will be bound to
a result.
|
| Value |
copyToResult()
Create an independent copy of this value if needed, that will be bound to
a result. If the original row is removed, this copy is still readable.
Returns:
the value (this for small objects)
|
| Value |
copyToTemp()
Copy this value to a temporary file if necessary.
|
| Value |
copyToTemp()
Copy this value to a temporary file if necessary.
Returns:
the new value
|
| Value |
divide(Value v)
Divide by a value and return the result.
|
| Value |
divide(Value v)
Divide by a value and return the result.
Parameters:
v - the value to divide by
Returns:
the result
|
| boolean |
equals(Object other)
Check if the two values have the same hash code.
|
| boolean |
equals(Object other)
Check if the two values have the same hash code. No data conversion is
made; this method returns false if the other object is not of the same
class. For some values, compareTo may return 0 even if equals return
false. Example: ValueDecimal 0.0 and 0.00.
Parameters:
other - the other value
Returns:
true if they are equal
|
| BigDecimal |
getBigDecimal()
|
| BigDecimal |
getBigDecimal()
|
| boolean |
getBoolean()
|
| boolean |
getBoolean()
|
| byte |
getByte()
|
| byte |
getByte()
|
| byte[] |
getBytes()
|
| byte[] |
getBytes()
|
| byte[] |
getBytesNoCopy()
|
| byte[] |
getBytesNoCopy()
|
| DataHandler |
getDataHandler()
Return the data handler for the values that support it
(actually only Java objects).
|
| DataHandler |
getDataHandler()
Return the data handler for the values that support it
(actually only Java objects).
Returns:
the data handler
|
| Date |
getDate()
|
| Date |
getDate()
|
| int |
getDisplaySize()
Get the display size in characters.
|
| int |
getDisplaySize()
Get the display size in characters.
Returns:
the display size
|
| double |
getDouble()
|
| double |
getDouble()
|
| float |
getFloat()
|
| float |
getFloat()
|
| InputStream |
getInputStream()
|
| InputStream |
getInputStream()
|
| InputStream |
getInputStream(long oneBasedOffset, long length)
Get the input stream
|
| InputStream |
getInputStream(long oneBasedOffset, long length)
Get the input stream
Parameters:
oneBasedOffset - the offset (1 means no offset)
length - the requested length
Returns:
the new input stream
|
| int |
getInt()
|
| int |
getInt()
|
| long |
getLong()
|
| long |
getLong()
|
| int |
getMemory()
Get the memory used by this object.
|
| int |
getMemory()
Get the memory used by this object.
Returns:
the memory used in bytes
|
| Object |
getObject()
Get the value as an object.
|
| Object |
getObject()
Get the value as an object.
Returns:
the object
|
| long |
getPrecision()
Get the precision.
|
| long |
getPrecision()
Get the precision.
Returns:
the precision
|
| Reader |
getReader()
|
| Reader |
getReader()
|
| Reader |
getReader(long oneBasedOffset, long length)
Get the reader
|
| Reader |
getReader(long oneBasedOffset, long length)
Get the reader
Parameters:
oneBasedOffset - the offset (1 means no offset)
length - the requested length
Returns:
the new reader
|
| ResultSet |
getResultSet()
|
| ResultSet |
getResultSet()
|
| String |
getSQL()
Get the SQL expression for this value.
|
| String |
getSQL()
Get the SQL expression for this value.
Returns:
the SQL expression
|
| int |
getScale()
|
| int |
getScale()
|
| short |
getShort()
|
| short |
getShort()
|
| int |
getSignum()
|
| int |
getSignum()
|
| byte[] |
getSmall()
Get the byte array.
|
| byte[] |
getSmall()
Get the byte array.
Returns:
the byte array
|
| String |
getString()
Get the value as a string.
|
| String |
getString()
Get the value as a string.
Returns:
the string
|
| int |
getTableId()
Get the table (only for LOB object).
|
| int |
getTableId()
Get the table (only for LOB object).
Returns:
the table id
|
| Time |
getTime()
|
| Time |
getTime()
|
| Timestamp |
getTimestamp()
|
| Timestamp |
getTimestamp()
|
| String |
getTraceSQL()
Get a medium size SQL expression for debugging or tracing.
|
| String |
getTraceSQL()
Get a medium size SQL expression for debugging or tracing. If the
precision is too large, only a subset of the value is returned.
Returns:
the SQL expression
|
| int |
getType()
Get the value type.
|
| int |
getType()
Get the value type.
Returns:
the type
|
| int |
hashCode()
|
| int |
hashCode()
|
| boolean |
isLinkedToTable()
Check if this value is linked to a specific table.
|
| boolean |
isLinkedToTable()
Check if this value is linked to a specific table. For values that are
kept fully in memory, this method returns false.
Returns:
true if it is
|
| Value |
modulus(Value v)
Take the modulus with a value and return the result.
|
| Value |
modulus(Value v)
Take the modulus with a value and return the result.
Parameters:
v - the value to take the modulus with
Returns:
the result
|
| Value |
multiply(Value v)
Multiply with a value and return the result.
|
| Value |
multiply(Value v)
Multiply with a value and return the result.
Parameters:
v - the value to multiply with
Returns:
the result
|
| Value |
negate()
Return -value if this value support arithmetic operations.
|
| Value |
negate()
Return -value if this value support arithmetic operations.
Returns:
the negative
|
| void |
remove()
Remove the underlying resource, if any.
|
| void |
remove()
Remove the underlying resource, if any. For values that are kept fully in
memory this method has no effect.
|
| void |
set(PreparedStatement prep, int parameterIndex)
Set the value as a parameter in a prepared statement.
|
| void |
set(PreparedStatement prep, int parameterIndex) throws SQLException
Set the value as a parameter in a prepared statement.
Parameters:
prep - the prepared statement
parameterIndex - the parameter index
|
| Value |
subtract(Value v)
Subtract a value and return the result.
|
| Value |
subtract(Value v)
Subtract a value and return the result.
Parameters:
v - the value to subtract
Returns:
the result
|
| DbException |
throwUnsupportedExceptionForType(String op)
Throw the exception that the feature is not support for the given data
type.
|
| DbException |
throwUnsupportedExceptionForType(String op)
Throw the exception that the feature is not support for the given data
type.
Parameters:
op - the operation
Returns:
never returns normally
Throws:
DbException - the exception
|
| String |
toString()
|
| String |
toString()
|
The data type is unknown at this time.
The value type for NULL.
The value type for BOOLEAN values.
The value type for DATE values.
The value type for TIMESTAMP values.
The value type for BYTES values.
The value type for STRING values.
The value type for case insensitive STRING values.
The value type for BLOB values.
The value type for CLOB values.
The value type for ARRAY values.
The value type for RESULT_SET values.
The value type for JAVA_OBJECT values.
The value type for BYTE values.
The value type for UUID values.
The value type for string values with a fixed size.
The value type for string values with a fixed size.
The value type for TIMESTAMP WITH TIME ZONE values.
The value type for ENUM values.
The number of value types.
The value type for SHORT values.
The value type for INT values.
The value type for LONG values.
The value type for DECIMAL values.
The value type for DOUBLE values.
The value type for FLOAT values.
The value type for TIME values.