|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.value.Value
public abstract class Value
This is the base class for all value classes. It provides conversion and comparison methods.
Nested Class Summary | |
---|---|
static interface |
Value.ValueBlob
A "character large object". |
static interface |
Value.ValueClob
A "binary large object". |
Field Summary | |
---|---|
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 Summary | |
---|---|
Value()
|
Method Summary | |
---|---|
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)
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(java.lang.Object other)
Check if the two values have the same hash code. |
java.math.BigDecimal |
getBigDecimal()
|
java.lang.Boolean |
getBoolean()
|
byte |
getByte()
|
byte[] |
getBytes()
|
byte[] |
getBytesNoCopy()
|
java.sql.Date |
getDate()
|
java.sql.Date |
getDateNoCopy()
|
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. |
java.io.InputStream |
getInputStream()
|
int |
getInt()
|
long |
getLong()
|
int |
getMemory()
Get the memory used by this object. |
abstract java.lang.Object |
getObject()
Get the value as an object. |
abstract long |
getPrecision()
Get the precision. |
java.io.Reader |
getReader()
|
int |
getScale()
|
short |
getShort()
|
int |
getSignum()
|
byte[] |
getSmall()
Get the byte array. |
abstract java.lang.String |
getSQL()
Get the SQL expression for this value. |
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.sql.Time |
getTimeNoCopy()
|
java.sql.Timestamp |
getTimestamp()
|
java.sql.Timestamp |
getTimestampNoCopy()
|
java.lang.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 |
multiply(Value v)
Multiply with a value and return the result. |
Value |
negate()
Return -value if this value support arithmetic operations. |
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. |
protected DbException |
throwUnsupportedExceptionForType(java.lang.String op)
Throw the exception that the feature is not support for the given data type. |
java.lang.String |
toString()
|
void |
unlink()
Mark any underlying resource as 'not linked to any table'. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public Value()
Method Detail |
---|
public abstract java.lang.String getSQL()
public abstract int getType()
public abstract long getPrecision()
public abstract int getDisplaySize()
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 index
java.sql.SQLException
protected abstract int compareSecure(Value v, CompareMode mode)
v
- the other valuemode
- the compare mode
public abstract int hashCode()
hashCode
in class java.lang.Object
public abstract boolean equals(java.lang.Object other)
equals
in class java.lang.Object
other
- the other value
public static int getHigherOrder(int t1, int t2)
t1
- the first value typet2
- the second value type
public static void clearCache()
public java.lang.Boolean getBoolean()
public java.sql.Date getDate()
public java.sql.Date getDateNoCopy()
public java.sql.Time getTime()
public java.sql.Time getTimeNoCopy()
public java.sql.Timestamp getTimestamp()
public java.sql.Timestamp getTimestampNoCopy()
public 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.Reader getReader()
public Value add(Value v)
v
- the value to add
public int getSignum()
public Value negate()
public Value subtract(Value v)
v
- the value to subtract
public Value divide(Value v)
v
- the value to divide by
public Value multiply(Value v)
v
- the value to multiply with
public Value convertTo(int targetType)
targetType
- the type of the returned value
public final int compareTypeSave(Value v, CompareMode mode)
v
- the other valuemode
- the compare mode
public final int compareTo(Value v, CompareMode mode)
v
- the other valuemode
- the compare mode
public int getScale()
public Value convertScale(boolean onlyToSmallerScale, int targetScale)
onlyToSmallerScale
- if the scale should not reducedtargetScale
- the requested scale
java.sql.SQLException
public Value convertPrecision(long precision)
precision
- the new precision
java.sql.SQLException
public Value link(DataHandler handler, int tableId)
handler
- the data handlertableId
- the table to link to
java.sql.SQLException
public boolean isLinked()
public void unlink()
java.sql.SQLException
public boolean isFileBased()
public void close()
java.sql.SQLException
public boolean checkPrecision(long precision)
precision
- the maximum precision
public java.lang.String getTraceSQL()
public java.lang.String toString()
toString
in class java.lang.Object
protected DbException throwUnsupportedExceptionForType(java.lang.String op)
the
- exceptionpublic int getTableId()
public byte[] getSmall()
public Value copyToTemp()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |