Package org.h2.mvstore.db
Class ValueDataType
- java.lang.Object
-
- org.h2.mvstore.type.BasicDataType<Value>
-
- org.h2.mvstore.db.ValueDataType
-
- All Implemented Interfaces:
java.util.Comparator<Value>
,DataType<Value>
,StatefulDataType<Database>
public final class ValueDataType extends BasicDataType<Value> implements StatefulDataType<Database>
A row type.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ValueDataType.Factory
-
Field Summary
Fields Modifier and Type Field Description private static byte
ARRAY
private static byte
BIGINT
private static byte
BIGINT_0_7
private static byte
BIGINT_NEG
private static int
BINARY
private static byte
BLOB
private static byte
BOOLEAN_FALSE
private static byte
BOOLEAN_TRUE
private static byte
CHAR
private static byte
CLOB
(package private) CompareMode
compareMode
private static byte
DATE
private static int
DECFLOAT
private static byte
DOUBLE
private static byte
DOUBLE_0_1
private static byte
ENUM
private static ValueDataType.Factory
FACTORY
private static byte
GEOMETRY
(package private) DataHandler
handler
private static byte
INT_0_15
private static byte
INT_NEG
private static byte
INTEGER
private static byte
INTERVAL
private static byte
JAVA_OBJECT
private static int
JSON
private static byte
NULL
private static byte
NUMERIC
private static byte
NUMERIC_0_1
private static byte
NUMERIC_SMALL
private static byte
NUMERIC_SMALL_0
(package private) CastDataProvider
provider
private static byte
REAL
private static byte
REAL_0_1
private static byte
ROW
private RowFactory
rowFactory
private static byte
SMALLINT
(package private) int[]
sortTypes
private static byte
TIME
private static int
TIME_TZ
private static byte
TIMESTAMP
private static int
TIMESTAMP_TZ
private static byte
TIMESTAMP_TZ_OLD
private static byte
TINYINT
private static byte
UUID
private static byte
VARBINARY
private static int
VARBINARY_0_31
private static byte
VARCHAR
private static byte
VARCHAR_0_31
private static byte
VARCHAR_IGNORECASE
-
Constructor Summary
Constructors Constructor Description ValueDataType()
ValueDataType(CastDataProvider provider, CompareMode compareMode, DataHandler handler, int[] sortTypes)
ValueDataType(Database database, int[] sortTypes)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private int
compare(SearchRow a, SearchRow b)
int
compare(Value a, Value b)
Compare two keys.int
compareValues(Value a, Value b, int sortType)
Compares the specified values.Value[]
createStorage(int size)
Create storage object of array type to hold valuesboolean
equals(java.lang.Object obj)
ValueDataType.Factory
getFactory()
int
getMemory(Value v)
Calculates the amount of used memory in bytes.RowFactory
getRowFactory()
int
hashCode()
Value
read(java.nio.ByteBuffer buff)
Read an object.private Value[]
readArrayElements(java.nio.ByteBuffer buff, TypeInfo elementType)
private LobDataDatabase
readLobDataDatabase(java.nio.ByteBuffer buff)
private static long
readTimestampTime(java.nio.ByteBuffer buff)
private static int
readTimeZone(java.nio.ByteBuffer buff)
(package private) Value
readValue(java.nio.ByteBuffer buff, TypeInfo columnType)
Read a value.private static byte[]
readVarBytes(java.nio.ByteBuffer buff)
void
save(WriteBuffer buff, MetaType<Database> metaType)
Save the state.void
setRowFactory(RowFactory rowFactory)
void
write(WriteBuffer buff, Value v)
Write an object.private static void
writeBinary(byte type, WriteBuffer buff, Value v)
private static void
writeIntArray(WriteBuffer buff, int[] array)
static void
writeLong(WriteBuffer buff, long x)
Writes a long.private static void
writeString(WriteBuffer buff, java.lang.String s)
private static void
writeTimestampTime(WriteBuffer buff, long nanos)
private static void
writeTimeZone(WriteBuffer buff, int timeZoneOffset)
-
Methods inherited from class org.h2.mvstore.type.BasicDataType
binarySearch, cast, isMemoryEstimationAllowed, read, write
-
-
-
-
Field Detail
-
NULL
private static final byte NULL
- See Also:
- Constant Field Values
-
TINYINT
private static final byte TINYINT
- See Also:
- Constant Field Values
-
SMALLINT
private static final byte SMALLINT
- See Also:
- Constant Field Values
-
INTEGER
private static final byte INTEGER
- See Also:
- Constant Field Values
-
BIGINT
private static final byte BIGINT
- See Also:
- Constant Field Values
-
NUMERIC
private static final byte NUMERIC
- See Also:
- Constant Field Values
-
DOUBLE
private static final byte DOUBLE
- See Also:
- Constant Field Values
-
REAL
private static final byte REAL
- See Also:
- Constant Field Values
-
TIME
private static final byte TIME
- See Also:
- Constant Field Values
-
DATE
private static final byte DATE
- See Also:
- Constant Field Values
-
TIMESTAMP
private static final byte TIMESTAMP
- See Also:
- Constant Field Values
-
VARBINARY
private static final byte VARBINARY
- See Also:
- Constant Field Values
-
VARCHAR
private static final byte VARCHAR
- See Also:
- Constant Field Values
-
VARCHAR_IGNORECASE
private static final byte VARCHAR_IGNORECASE
- See Also:
- Constant Field Values
-
BLOB
private static final byte BLOB
- See Also:
- Constant Field Values
-
CLOB
private static final byte CLOB
- See Also:
- Constant Field Values
-
ARRAY
private static final byte ARRAY
- See Also:
- Constant Field Values
-
JAVA_OBJECT
private static final byte JAVA_OBJECT
- See Also:
- Constant Field Values
-
UUID
private static final byte UUID
- See Also:
- Constant Field Values
-
CHAR
private static final byte CHAR
- See Also:
- Constant Field Values
-
GEOMETRY
private static final byte GEOMETRY
- See Also:
- Constant Field Values
-
TIMESTAMP_TZ_OLD
private static final byte TIMESTAMP_TZ_OLD
- See Also:
- Constant Field Values
-
ENUM
private static final byte ENUM
- See Also:
- Constant Field Values
-
INTERVAL
private static final byte INTERVAL
- See Also:
- Constant Field Values
-
ROW
private static final byte ROW
- See Also:
- Constant Field Values
-
INT_0_15
private static final byte INT_0_15
- See Also:
- Constant Field Values
-
BIGINT_0_7
private static final byte BIGINT_0_7
- See Also:
- Constant Field Values
-
NUMERIC_0_1
private static final byte NUMERIC_0_1
- See Also:
- Constant Field Values
-
NUMERIC_SMALL_0
private static final byte NUMERIC_SMALL_0
- See Also:
- Constant Field Values
-
NUMERIC_SMALL
private static final byte NUMERIC_SMALL
- See Also:
- Constant Field Values
-
DOUBLE_0_1
private static final byte DOUBLE_0_1
- See Also:
- Constant Field Values
-
REAL_0_1
private static final byte REAL_0_1
- See Also:
- Constant Field Values
-
BOOLEAN_FALSE
private static final byte BOOLEAN_FALSE
- See Also:
- Constant Field Values
-
BOOLEAN_TRUE
private static final byte BOOLEAN_TRUE
- See Also:
- Constant Field Values
-
INT_NEG
private static final byte INT_NEG
- See Also:
- Constant Field Values
-
BIGINT_NEG
private static final byte BIGINT_NEG
- See Also:
- Constant Field Values
-
VARCHAR_0_31
private static final byte VARCHAR_0_31
- See Also:
- Constant Field Values
-
VARBINARY_0_31
private static final int VARBINARY_0_31
- See Also:
- Constant Field Values
-
JSON
private static final int JSON
- See Also:
- Constant Field Values
-
TIMESTAMP_TZ
private static final int TIMESTAMP_TZ
- See Also:
- Constant Field Values
-
TIME_TZ
private static final int TIME_TZ
- See Also:
- Constant Field Values
-
BINARY
private static final int BINARY
- See Also:
- Constant Field Values
-
DECFLOAT
private static final int DECFLOAT
- See Also:
- Constant Field Values
-
handler
final DataHandler handler
-
provider
final CastDataProvider provider
-
compareMode
final CompareMode compareMode
-
sortTypes
final int[] sortTypes
-
rowFactory
private RowFactory rowFactory
-
FACTORY
private static final ValueDataType.Factory FACTORY
-
-
Constructor Detail
-
ValueDataType
public ValueDataType()
-
ValueDataType
public ValueDataType(Database database, int[] sortTypes)
-
ValueDataType
public ValueDataType(CastDataProvider provider, CompareMode compareMode, DataHandler handler, int[] sortTypes)
-
-
Method Detail
-
getRowFactory
public RowFactory getRowFactory()
-
setRowFactory
public void setRowFactory(RowFactory rowFactory)
-
createStorage
public Value[] createStorage(int size)
Description copied from interface:DataType
Create storage object of array type to hold values- Specified by:
createStorage
in interfaceDataType<Value>
- Parameters:
size
- number of values to hold- Returns:
- storage object
-
compare
public int compare(Value a, Value b)
Description copied from interface:DataType
Compare two keys.
-
compareValues
public int compareValues(Value a, Value b, int sortType)
Compares the specified values.- Parameters:
a
- the first valueb
- the second valuesortType
- the sorting type- Returns:
- 0 if equal, -1 if first value is smaller for ascending or larger for descending sort type, 1 otherwise
-
getMemory
public int getMemory(Value v)
Description copied from interface:DataType
Calculates the amount of used memory in bytes.
-
read
public Value read(java.nio.ByteBuffer buff)
Description copied from interface:DataType
Read an object.
-
write
public void write(WriteBuffer buff, Value v)
Description copied from interface:DataType
Write an object.
-
writeBinary
private static void writeBinary(byte type, WriteBuffer buff, Value v)
-
writeLong
public static void writeLong(WriteBuffer buff, long x)
Writes a long.- Parameters:
buff
- the target bufferx
- the long value
-
writeString
private static void writeString(WriteBuffer buff, java.lang.String s)
-
writeTimestampTime
private static void writeTimestampTime(WriteBuffer buff, long nanos)
-
writeTimeZone
private static void writeTimeZone(WriteBuffer buff, int timeZoneOffset)
-
readValue
Value readValue(java.nio.ByteBuffer buff, TypeInfo columnType)
Read a value.- Parameters:
buff
- the source buffercolumnType
- the data type of value, ornull
- Returns:
- the value
-
readLobDataDatabase
private LobDataDatabase readLobDataDatabase(java.nio.ByteBuffer buff)
-
readArrayElements
private Value[] readArrayElements(java.nio.ByteBuffer buff, TypeInfo elementType)
-
readVarBytes
private static byte[] readVarBytes(java.nio.ByteBuffer buff)
-
readTimestampTime
private static long readTimestampTime(java.nio.ByteBuffer buff)
-
readTimeZone
private static int readTimeZone(java.nio.ByteBuffer buff)
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equals
in interfacejava.util.Comparator<Value>
- Overrides:
equals
in classBasicDataType<Value>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classBasicDataType<Value>
-
save
public void save(WriteBuffer buff, MetaType<Database> metaType)
Description copied from interface:StatefulDataType
Save the state.- Specified by:
save
in interfaceStatefulDataType<Database>
- Parameters:
buff
- the target buffermetaType
- the meta type
-
writeIntArray
private static void writeIntArray(WriteBuffer buff, int[] array)
-
getFactory
public ValueDataType.Factory getFactory()
- Specified by:
getFactory
in interfaceStatefulDataType<Database>
-
-