|
||||||||||
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.
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. |
void |
close()
Close the underlying resource, if any. |
boolean |
compareEqual(Value v)
Compare two values and return true if they contain the same data. |
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 type)
Compare a value to the specified type. |
Value |
divide(Value v)
Divide by a value and return the result. |
abstract boolean |
equals(java.lang.Object other)
Check if the two values are equal. |
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()
|
abstract java.lang.String |
getSQL()
Get the SQL expression for this value. |
abstract java.lang.String |
getString()
Get the value as a string. |
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 java.sql.SQLException |
throwUnsupportedExceptionForType()
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) throws java.sql.SQLException
v
- the other valuemode
- the compare mode
java.sql.SQLException
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) throws java.sql.SQLException
t1
- the first value typet2
- the second value type
java.sql.SQLException
public java.lang.Boolean getBoolean() throws java.sql.SQLException
java.sql.SQLException
public java.sql.Date getDate() throws java.sql.SQLException
java.sql.SQLException
public java.sql.Date getDateNoCopy() throws java.sql.SQLException
java.sql.SQLException
public java.sql.Time getTime() throws java.sql.SQLException
java.sql.SQLException
public java.sql.Time getTimeNoCopy() throws java.sql.SQLException
java.sql.SQLException
public java.sql.Timestamp getTimestamp() throws java.sql.SQLException
java.sql.SQLException
public java.sql.Timestamp getTimestampNoCopy() throws java.sql.SQLException
java.sql.SQLException
public byte[] getBytes() throws java.sql.SQLException
java.sql.SQLException
public byte[] getBytesNoCopy() throws java.sql.SQLException
java.sql.SQLException
public byte getByte() throws java.sql.SQLException
java.sql.SQLException
public short getShort() throws java.sql.SQLException
java.sql.SQLException
public java.math.BigDecimal getBigDecimal() throws java.sql.SQLException
java.sql.SQLException
public double getDouble() throws java.sql.SQLException
java.sql.SQLException
public float getFloat() throws java.sql.SQLException
java.sql.SQLException
public int getInt() throws java.sql.SQLException
java.sql.SQLException
public long getLong() throws java.sql.SQLException
java.sql.SQLException
public java.io.InputStream getInputStream() throws java.sql.SQLException
java.sql.SQLException
public java.io.Reader getReader()
public Value add(Value v) throws java.sql.SQLException
v
- the value to add
java.sql.SQLException
public int getSignum() throws java.sql.SQLException
java.sql.SQLException
public Value negate() throws java.sql.SQLException
java.sql.SQLException
public Value subtract(Value v) throws java.sql.SQLException
v
- the value to subtract
java.sql.SQLException
public Value divide(Value v) throws java.sql.SQLException
v
- the value to divide by
java.sql.SQLException
public Value multiply(Value v) throws java.sql.SQLException
v
- the value to multiply with
java.sql.SQLException
public Value convertTo(int type) throws java.sql.SQLException
type
- the value type
java.sql.SQLException
public final int compareTypeSave(Value v, CompareMode mode) throws java.sql.SQLException
v
- the other valuemode
- the compare mode
java.sql.SQLException
public final boolean compareEqual(Value v) throws java.sql.SQLException
v
- the value to compare against
java.sql.SQLException
public final int compareTo(Value v, CompareMode mode) throws java.sql.SQLException
v
- the other valuemode
- the compare mode
java.sql.SQLException
public int getScale()
public Value convertScale(boolean onlyToSmallerScale, int targetScale) throws java.sql.SQLException
onlyToSmallerScale
- if the scale should not reducedtargetScale
- the requested scale
java.sql.SQLException
public Value convertPrecision(long precision) throws java.sql.SQLException
precision
- the new precision
java.sql.SQLException
public Value link(DataHandler handler, int tableId) throws java.sql.SQLException
handler
- the data handlertableId
- the table to link to
java.sql.SQLException
public boolean isLinked()
public void unlink() throws java.sql.SQLException
java.sql.SQLException
public boolean isFileBased()
public void close() throws java.sql.SQLException
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 java.sql.SQLException throwUnsupportedExceptionForType() throws java.sql.SQLException
java.sql.SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |