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 classValueDataType.Factory
-
Field Summary
Fields Modifier and Type Field Description private static byteARRAYprivate static byteBIGINTprivate static byteBIGINT_0_7private static byteBIGINT_NEGprivate static intBINARYprivate static byteBLOBprivate static byteBOOLEAN_FALSEprivate static byteBOOLEAN_TRUEprivate static byteCHARprivate static byteCLOB(package private) CompareModecompareModeprivate static byteDATEprivate static intDECFLOATprivate static byteDOUBLEprivate static byteDOUBLE_0_1private static byteENUMprivate static ValueDataType.FactoryFACTORYprivate static byteGEOMETRY(package private) DataHandlerhandlerprivate static byteINT_0_15private static byteINT_NEGprivate static byteINTEGERprivate static byteINTERVALprivate static byteJAVA_OBJECTprivate static intJSONprivate static byteNULLprivate static byteNUMERICprivate static byteNUMERIC_0_1private static byteNUMERIC_SMALLprivate static byteNUMERIC_SMALL_0(package private) CastDataProviderproviderprivate static byteREALprivate static byteREAL_0_1private static byteROWprivate RowFactoryrowFactoryprivate static byteSMALLINT(package private) int[]sortTypesprivate static byteTIMEprivate static intTIME_TZprivate static byteTIMESTAMPprivate static intTIMESTAMP_TZprivate static byteTIMESTAMP_TZ_OLDprivate static byteTINYINTprivate static byteUUIDprivate static byteVARBINARYprivate static intVARBINARY_0_31private static byteVARCHARprivate static byteVARCHAR_0_31private static byteVARCHAR_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 intcompare(SearchRow a, SearchRow b)intcompare(Value a, Value b)Compare two keys.intcompareValues(Value a, Value b, int sortType)Compares the specified values.Value[]createStorage(int size)Create storage object of array type to hold valuesbooleanequals(java.lang.Object obj)ValueDataType.FactorygetFactory()intgetMemory(Value v)Calculates the amount of used memory in bytes.RowFactorygetRowFactory()inthashCode()Valueread(java.nio.ByteBuffer buff)Read an object.private Value[]readArrayElements(java.nio.ByteBuffer buff, TypeInfo elementType)private LobDataDatabasereadLobDataDatabase(java.nio.ByteBuffer buff)private static longreadTimestampTime(java.nio.ByteBuffer buff)private static intreadTimeZone(java.nio.ByteBuffer buff)(package private) ValuereadValue(java.nio.ByteBuffer buff, TypeInfo columnType)Read a value.private static byte[]readVarBytes(java.nio.ByteBuffer buff)voidsave(WriteBuffer buff, MetaType<Database> metaType)Save the state.voidsetRowFactory(RowFactory rowFactory)voidwrite(WriteBuffer buff, Value v)Write an object.private static voidwriteBinary(byte type, WriteBuffer buff, Value v)private static voidwriteIntArray(WriteBuffer buff, int[] array)static voidwriteLong(WriteBuffer buff, long x)Writes a long.private static voidwriteString(WriteBuffer buff, java.lang.String s)private static voidwriteTimestampTime(WriteBuffer buff, long nanos)private static voidwriteTimeZone(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:DataTypeCreate storage object of array type to hold values- Specified by:
createStoragein interfaceDataType<Value>- Parameters:
size- number of values to hold- Returns:
- storage object
-
compare
public int compare(Value a, Value b)
Description copied from interface:DataTypeCompare 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:DataTypeCalculates the amount of used memory in bytes.
-
read
public Value read(java.nio.ByteBuffer buff)
Description copied from interface:DataTypeRead an object.
-
write
public void write(WriteBuffer buff, Value v)
Description copied from interface:DataTypeWrite 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:
equalsin interfacejava.util.Comparator<Value>- Overrides:
equalsin classBasicDataType<Value>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classBasicDataType<Value>
-
save
public void save(WriteBuffer buff, MetaType<Database> metaType)
Description copied from interface:StatefulDataTypeSave the state.- Specified by:
savein 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:
getFactoryin interfaceStatefulDataType<Database>
-
-