public abstract class Value extends VersionedValue
| Modifier and Type | Field and Description |
|---|---|
static int |
ARRAY
The value type for ARRAY values.
|
static int |
BLOB
The value type for BLOB values.
|
static int |
BOOLEAN
The value type for BOOLEAN values.
|
static int |
BYTE
The value type for BYTE values.
|
static int |
BYTES
The value type for BYTES values.
|
static int |
CLOB
The value type for CLOB values.
|
static int |
DATE
The value type for DATE values.
|
static int |
DECIMAL
The value type for DECIMAL values.
|
static int |
DOUBLE
The value type for DOUBLE values.
|
static int |
ENUM
The value type for ENUM values.
|
static int |
FLOAT
The value type for FLOAT values.
|
static int |
GEOMETRY
The value type for string values with a fixed size.
|
static int |
INT
The value type for INT values.
|
static int |
INTERVAL_DAY
The value type for
INTERVAL DAY values. |
static int |
INTERVAL_DAY_TO_HOUR
The value type for
INTERVAL DAY TO HOUR values. |
static int |
INTERVAL_DAY_TO_MINUTE
The value type for
INTERVAL DAY TO MINUTE values. |
static int |
INTERVAL_DAY_TO_SECOND
The value type for
INTERVAL DAY TO SECOND values. |
static int |
INTERVAL_HOUR
The value type for
INTERVAL HOUR values. |
static int |
INTERVAL_HOUR_TO_MINUTE
The value type for
INTERVAL HOUR TO MINUTE values. |
static int |
INTERVAL_HOUR_TO_SECOND
The value type for
INTERVAL HOUR TO SECOND values. |
static int |
INTERVAL_MINUTE
The value type for
INTERVAL MINUTE values. |
static int |
INTERVAL_MINUTE_TO_SECOND
The value type for
INTERVAL MINUTE TO SECOND values. |
static int |
INTERVAL_MONTH
The value type for
INTERVAL MONTH values. |
static int |
INTERVAL_SECOND
The value type for
INTERVAL SECOND values. |
static int |
INTERVAL_YEAR
The value type for
INTERVAL YEAR values. |
static int |
INTERVAL_YEAR_TO_MONTH
The value type for
INTERVAL YEAR TO MONTH values. |
static int |
JAVA_OBJECT
The value type for JAVA_OBJECT values.
|
static int |
JSON
The value type for JSON values.
|
static int |
LONG
The value type for LONG values.
|
static java.math.BigDecimal |
MIN_LONG_DECIMAL
The smallest Long value, as a BigDecimal.
|
static int |
NULL
The value type for NULL.
|
static int |
RESULT_SET
The value type for RESULT_SET values.
|
static int |
ROW
The value type for ROW values.
|
static int |
SHORT
The value type for SHORT values.
|
static int |
STRING
The value type for STRING values.
|
static int |
STRING_FIXED
The value type for string values with a fixed size.
|
static int |
STRING_IGNORECASE
The value type for case insensitive STRING values.
|
static int |
TIME
The value type for TIME values.
|
static int |
TIME_TZ
The value type for TIME WITH TIME ZONE values.
|
static int |
TIMESTAMP
The value type for TIMESTAMP values.
|
static int |
TIMESTAMP_TZ
The value type for TIMESTAMP WITH TIME ZONE values.
|
static int |
TYPE_COUNT
The number of value types.
|
static int |
UNKNOWN
The data type is unknown at this time.
|
static int |
UUID
The value type for UUID values.
|
DUMMY| Constructor and Description |
|---|
Value() |
| Modifier and Type | Method and Description |
|---|---|
Value |
add(Value v)
Add a value and return the result.
|
boolean |
checkPrecision(long precision)
Check if the precision is smaller or equal than the given precision.
|
static void |
clearCache()
Clear the value cache.
|
int |
compareTo(Value v,
CastDataProvider provider,
CompareMode compareMode)
Compare this value against another value using the specified compare
mode.
|
abstract int |
compareTypeSafe(Value v,
CompareMode mode,
CastDataProvider provider)
Compare this value against another value given that the values are of the
same data type.
|
int |
compareWithNull(Value v,
boolean forEquality,
CastDataProvider provider,
CompareMode compareMode)
Compare this value against another value using the specified compare
mode.
|
boolean |
containsNull()
Returns true if this value is NULL or contains NULL value.
|
Value |
convertPrecision(long precision)
Convert the precision to the requested value.
|
Value |
convertScale(boolean onlyToSmallerScale,
int targetScale)
Convert the scale.
|
Value |
convertTo(int targetType)
Compare a value to the specified type.
|
Value |
convertTo(int targetType,
CastDataProvider provider,
boolean forComparison)
Convert a value to the specified type.
|
protected Value |
convertTo(int targetType,
ExtTypeInfo extTypeInfo,
CastDataProvider provider,
boolean forComparison,
java.lang.Object column)
Convert a value to the specified type.
|
Value |
convertTo(TypeInfo targetType,
CastDataProvider provider,
boolean forComparison,
java.lang.Object column)
Convert a value to the specified type.
|
static int |
convertToInt(long x,
java.lang.Object column)
Convert to integer, throwing exception if out of range.
|
Value |
copy(DataHandler handler,
int tableId)
Copy a large value, to be used in the given table.
|
Value |
copyToResult()
Create an independent copy of this value if needed, that will be bound to
a result.
|
Value |
copyToTemp()
Copy this value to a temporary file if necessary.
|
Value |
divide(Value v)
Divide by a value and return the result.
|
abstract boolean |
equals(java.lang.Object other)
Check if the two values have the same hash code.
|
java.math.BigDecimal |
getBigDecimal() |
boolean |
getBoolean() |
byte |
getByte() |
byte[] |
getBytes() |
byte[] |
getBytesNoCopy() |
protected DataHandler |
getDataHandler()
Return the data handler for the values that support it
(actually only Java objects).
|
java.sql.Date |
getDate(java.util.TimeZone timeZone)
Get the date value converted to the specified timezone.
|
double |
getDouble() |
float |
getFloat() |
static int |
getHigherOrder(int t1,
int t2)
Get the higher value order type of two value types.
|
static TypeInfo |
getHigherType(TypeInfo type1,
TypeInfo type2)
Get the higher data type of two data types.
|
java.io.InputStream |
getInputStream() |
java.io.InputStream |
getInputStream(long oneBasedOffset,
long length)
Get the input stream
|
int |
getInt() |
long |
getLong() |
int |
getMemory()
Get the memory used by this object.
|
abstract java.lang.Object |
getObject()
Get the value as an object.
|
java.io.Reader |
getReader() |
java.io.Reader |
getReader(long oneBasedOffset,
long length)
Get the reader
|
ResultInterface |
getResult()
Returns result for result set value, or single-row result with this value
in column X for other values.
|
short |
getShort() |
int |
getSignum() |
byte[] |
getSmall()
Get the byte array.
|
java.lang.String |
getSQL()
Get the SQL expression for this value.
|
abstract java.lang.StringBuilder |
getSQL(java.lang.StringBuilder builder)
Appends the SQL expression for this value to the specified builder.
|
abstract java.lang.String |
getString()
Get the value as a string.
|
int |
getTableId()
Get the table (only for LOB object).
|
java.sql.Time |
getTime(java.util.TimeZone timeZone)
Get the time value converted to the specified timezone.
|
java.sql.Timestamp |
getTimestamp(java.util.TimeZone timeZone)
Get the timezone value converted to the specified timezone.
|
java.lang.String |
getTraceSQL()
Get a medium size SQL expression for debugging or tracing.
|
abstract TypeInfo |
getType()
Returns the data type.
|
protected DbException |
getUnsupportedExceptionForOperation(java.lang.String op)
Create an exception meaning the specified operation is not supported for
this data type.
|
abstract int |
getValueType()
Get the value type.
|
abstract int |
hashCode() |
boolean |
isLinkedToTable()
Check if this value is linked to a specific table.
|
Value |
modulus(Value v)
Take the modulus with a value and return the result.
|
Value |
multiply(Value v)
Multiply with a value and return the result.
|
Value |
negate()
Return -value if this value support arithmetic operations.
|
void |
remove()
Remove the underlying resource, if any.
|
abstract void |
set(java.sql.PreparedStatement prep,
int parameterIndex)
Set the value as a parameter in a prepared statement.
|
Value |
subtract(Value v)
Subtract a value and return the result.
|
java.lang.String |
toString() |
getCommittedValue, getCurrentValue, getOperationId, isCommittedpublic static final int UNKNOWN
public static final int NULL
public static final int BOOLEAN
public static final int BYTE
public static final int SHORT
public static final int INT
public static final int LONG
public static final int DECIMAL
public static final int DOUBLE
public static final int FLOAT
public static final int TIME
public static final int DATE
public static final int TIMESTAMP
public static final int BYTES
public static final int STRING
public static final int STRING_IGNORECASE
public static final int BLOB
public static final int CLOB
public static final int ARRAY
public static final int RESULT_SET
public static final int JAVA_OBJECT
public static final int UUID
public static final int STRING_FIXED
public static final int GEOMETRY
public static final int TIMESTAMP_TZ
public static final int ENUM
public static final int INTERVAL_YEAR
INTERVAL YEAR values.public static final int INTERVAL_MONTH
INTERVAL MONTH values.public static final int INTERVAL_DAY
INTERVAL DAY values.public static final int INTERVAL_HOUR
INTERVAL HOUR values.public static final int INTERVAL_MINUTE
INTERVAL MINUTE values.public static final int INTERVAL_SECOND
INTERVAL SECOND values.public static final int INTERVAL_YEAR_TO_MONTH
INTERVAL YEAR TO MONTH values.public static final int INTERVAL_DAY_TO_HOUR
INTERVAL DAY TO HOUR values.public static final int INTERVAL_DAY_TO_MINUTE
INTERVAL DAY TO MINUTE values.public static final int INTERVAL_DAY_TO_SECOND
INTERVAL DAY TO SECOND values.public static final int INTERVAL_HOUR_TO_MINUTE
INTERVAL HOUR TO MINUTE values.public static final int INTERVAL_HOUR_TO_SECOND
INTERVAL HOUR TO SECOND values.public static final int INTERVAL_MINUTE_TO_SECOND
INTERVAL MINUTE TO SECOND values.public static final int ROW
public static final int JSON
public static final int TIME_TZ
public static final int TYPE_COUNT
public static final java.math.BigDecimal MIN_LONG_DECIMAL
public java.lang.String getSQL()
public abstract java.lang.StringBuilder getSQL(java.lang.StringBuilder builder)
builder - string builderpublic abstract TypeInfo getType()
public abstract int getValueType()
public int getMemory()
public abstract java.lang.String getString()
public abstract java.lang.Object getObject()
public abstract void set(java.sql.PreparedStatement prep,
int parameterIndex)
throws java.sql.SQLException
prep - the prepared statementparameterIndex - the parameter indexjava.sql.SQLExceptionpublic abstract int hashCode()
hashCode in class java.lang.Objectpublic abstract boolean equals(java.lang.Object other)
equals in class java.lang.Objectother - the other valuepublic static int getHigherOrder(int t1,
int t2)
t1 - the first value typet2 - the second value typepublic static TypeInfo getHigherType(TypeInfo type1, TypeInfo type2)
type1 - the first data typetype2 - the second data typepublic static void clearCache()
public boolean getBoolean()
public java.sql.Date getDate(java.util.TimeZone timeZone)
timeZone - the target timezonepublic java.sql.Time getTime(java.util.TimeZone timeZone)
timeZone - the target timezonepublic java.sql.Timestamp getTimestamp(java.util.TimeZone timeZone)
timeZone - the target timezonepublic byte[] getBytes()
public byte[] getBytesNoCopy()
public byte getByte()
public short getShort()
public java.math.BigDecimal getBigDecimal()
public double getDouble()
public float getFloat()
public int getInt()
public long getLong()
public java.io.InputStream getInputStream()
public java.io.InputStream getInputStream(long oneBasedOffset,
long length)
oneBasedOffset - the offset (1 means no offset)length - the requested lengthpublic java.io.Reader getReader()
public java.io.Reader getReader(long oneBasedOffset,
long length)
oneBasedOffset - the offset (1 means no offset)length - the requested lengthpublic Value add(Value v)
v - the value to addpublic int getSignum()
public Value negate()
public Value subtract(Value v)
v - the value to subtractpublic Value divide(Value v)
v - the value to divide bypublic Value multiply(Value v)
v - the value to multiply withpublic Value modulus(Value v)
v - the value to take the modulus withpublic final Value convertTo(int targetType)
targetType - the type of the returned valuepublic final Value convertTo(int targetType, CastDataProvider provider, boolean forComparison)
targetType - the type of the returned valueprovider - the cast information providerforComparison - if true, perform cast for comparison operationpublic final Value convertTo(TypeInfo targetType, CastDataProvider provider, boolean forComparison, java.lang.Object column)
targetType - the type of the returned valueprovider - the cast information providerforComparison - if true, perform cast for comparison operationcolumn - the column (if any), used for to improve the error message if conversion failsprotected Value convertTo(int targetType, ExtTypeInfo extTypeInfo, CastDataProvider provider, boolean forComparison, java.lang.Object column)
targetType - the type of the returned valueextTypeInfo - the extended data type information, or nullprovider - the cast information providerforComparison - if true, perform cast for comparison operationcolumn - the column (if any), used for to improve the error message if conversion failspublic abstract int compareTypeSafe(Value v, CompareMode mode, CastDataProvider provider)
v - the other valuemode - the compare modeprovider - the cast information providerpublic final int compareTo(Value v, CastDataProvider provider, CompareMode compareMode)
v - the other valueprovider - the cast information providercompareMode - the compare modepublic int compareWithNull(Value v, boolean forEquality, CastDataProvider provider, CompareMode compareMode)
v - the other valueforEquality - perform only check for equalityprovider - the cast information providercompareMode - the compare modeInteger.MIN_VALUE if order is
not defined due to NULL comparisonpublic boolean containsNull()
public Value convertScale(boolean onlyToSmallerScale, int targetScale)
onlyToSmallerScale - if the scale should not reducedtargetScale - the requested scalepublic Value convertPrecision(long precision)
precision - the new precisionpublic static int convertToInt(long x,
java.lang.Object column)
x - integer value.column - Column info.public Value copy(DataHandler handler, int tableId)
handler - the data handlertableId - the table where this object is usedpublic boolean isLinkedToTable()
public void remove()
public boolean checkPrecision(long precision)
precision - the maximum precisionpublic java.lang.String getTraceSQL()
public java.lang.String toString()
toString in class java.lang.Objectprotected final DbException getUnsupportedExceptionForOperation(java.lang.String op)
op - the operationpublic int getTableId()
public byte[] getSmall()
public Value copyToTemp()
public Value copyToResult()
public ResultInterface getResult()
protected DataHandler getDataHandler()