public abstract class Value extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
Value.ValueBlob
A "character large object".
|
static interface |
Value.ValueClob
A "binary large object".
|
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 |
FLOAT
The value type for FLOAT values.
|
static int |
INT
The value type for INT values.
|
static int |
JAVA_OBJECT
The value type for JAVA_OBJECT values.
|
static int |
LONG
The value type for LONG values.
|
static int |
NULL
The value type for NULL.
|
static int |
RESULT_SET
The value type for RESULT_SET 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 INT values.
|
static int |
TIMESTAMP
The value type for TIMESTAMP 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.
|
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.
|
void |
close()
Close the underlying resource, if any.
|
protected abstract int |
compareSecure(Value v,
CompareMode mode)
Compare the value with another value of the same type.
|
int |
compareTo(Value v,
CompareMode mode)
Compare this value against another value using the specified compare
mode.
|
int |
compareTypeSave(Value v,
CompareMode mode)
Compare this value against another value given that the values are of the
same data type.
|
Value |
convertPrecision(long precision,
boolean force)
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 |
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(Object other)
Check if the two values have the same hash code.
|
BigDecimal |
getBigDecimal() |
Boolean |
getBoolean() |
byte |
getByte() |
byte[] |
getBytes() |
byte[] |
getBytesNoCopy() |
Date |
getDate() |
abstract int |
getDisplaySize()
Get the display size in characters.
|
double |
getDouble() |
float |
getFloat() |
static int |
getHigherOrder(int t1,
int t2)
Get the higher value order type of two value types.
|
InputStream |
getInputStream() |
int |
getInt() |
long |
getLong() |
int |
getMemory()
Get the memory used by this object.
|
abstract Object |
getObject()
Get the value as an object.
|
abstract long |
getPrecision()
Get the precision.
|
Reader |
getReader() |
ResultSet |
getResultSet() |
int |
getScale() |
short |
getShort() |
int |
getSignum() |
byte[] |
getSmall()
Get the byte array.
|
abstract String |
getSQL()
Get the SQL expression for this value.
|
abstract String |
getString()
Get the value as a string.
|
int |
getTableId()
Get the table (only for LOB object).
|
Time |
getTime() |
Timestamp |
getTimestamp() |
String |
getTraceSQL()
Get a medium size SQL expression for debugging or tracing.
|
abstract int |
getType()
Get the value type.
|
abstract int |
hashCode() |
boolean |
isFileBased()
Check if this value is stored in it's own file.
|
boolean |
isLinked()
Check if this value is linked to a specific table.
|
Value |
link(DataHandler handler,
int tableId)
Link a large value to a given 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.
|
abstract void |
set(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.
|
protected DbException |
throwUnsupportedExceptionForType(String op)
Throw the exception that the feature is not support for the given data type.
|
String |
toString() |
void |
unlink()
Mark any underlying resource as 'not linked to any table'.
|
public 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 TYPE_COUNT
public abstract String getSQL()
public abstract int getType()
public abstract long getPrecision()
public abstract int getDisplaySize()
public int getMemory()
public abstract String getString()
public abstract Object getObject()
public abstract void set(PreparedStatement prep, int parameterIndex) throws SQLException
prep
- the prepared statementparameterIndex
- the parameter indexSQLException
protected abstract int compareSecure(Value v, CompareMode mode)
v
- the other valuemode
- the compare modepublic abstract boolean equals(Object other)
public static int getHigherOrder(int t1, int t2)
t1
- the first value typet2
- the second value typepublic static void clearCache()
public Boolean getBoolean()
public Date getDate()
public Time getTime()
public Timestamp getTimestamp()
public byte[] getBytes()
public byte[] getBytesNoCopy()
public byte getByte()
public short getShort()
public BigDecimal getBigDecimal()
public double getDouble()
public float getFloat()
public int getInt()
public long getLong()
public InputStream getInputStream()
public Reader getReader()
public 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 Value convertTo(int targetType)
targetType
- the type of the returned valuepublic final int compareTypeSave(Value v, CompareMode mode)
v
- the other valuemode
- the compare modepublic final int compareTo(Value v, CompareMode mode)
v
- the other valuemode
- the compare modepublic int getScale()
public Value convertScale(boolean onlyToSmallerScale, int targetScale)
onlyToSmallerScale
- if the scale should not reducedtargetScale
- the requested scalepublic Value convertPrecision(long precision, boolean force)
precision
- the new precisionforce
- true if losing numeric precision is allowedpublic Value link(DataHandler handler, int tableId)
handler
- the data handlertableId
- the table to link topublic boolean isLinked()
public void unlink()
public boolean isFileBased()
public void close()
public boolean checkPrecision(long precision)
precision
- the maximum precisionpublic String getTraceSQL()
protected DbException throwUnsupportedExceptionForType(String op)
op
- the operationDbException
- the exceptionpublic int getTableId()
public byte[] getSmall()
public Value copyToTemp()
public ResultSet getResultSet()
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.