Top Description Inners Fields Constructors Methods
org.h2.mvstore.db

public final Class ValueDataType

extends BasicDataType<Value>
implements StatefulDataType<Database>
Class Inheritance
All Implemented Interfaces
org.h2.mvstore.type.StatefulDataType
Static Imports
org.h2.mvstore.DataUtils.readString, .DataUtils.readVarInt, .DataUtils.readVarLong

A row type.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private static final byte
private static final byte
private static final byte
private static final byte
private static final int
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
pack-priv final CompareMode
private static final byte
private static final int
private static final byte
private static final byte
private static final byte
private static final ValueDataType.Factory
private static final byte
pack-priv final DataHandler
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final int
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
pack-priv final CastDataProvider
private static final byte
private static final byte
private static final byte
private RowFactory
private static final byte
pack-priv final int[]
private static final byte
private static final int
private static final byte
private static final int
private static final byte
private static final byte
private static final byte
private static final byte
private static final int
private static final byte
private static final byte
private static final byte

Constructor Summary

AccessConstructor and Description
public
public
ValueDataType(Database database, int[] sortTypes)

public
ValueDataType(CastDataProvider provider, CompareMode compareMode, DataHandler handler, int[] sortTypes)

Method Summary

Modifier and TypeMethod and Description
public int
compare(Value
the first key
a
,
Value
the second key
b
)

Overrides org.h2.mvstore.type.BasicDataType.compare.

Implements org.h2.mvstore.type.DataType.compare.

Compare two keys.

private int
compare(SearchRow
the first key
a
,
SearchRow
the second key
b
)

Overrides org.h2.mvstore.type.BasicDataType.compare.

Implements org.h2.mvstore.type.DataType.compare.

Compare two keys.

public int

Returns:

0 if equal, -1 if first value is smaller for ascending or larger for descending sort type, 1 otherwise
compareValues
(Value
the first value
a
,
Value
the second value
b
,
int
the sorting type
sortType
)

Compares the specified values.

public Value[]
createStorage(int
number of values to hold
size
)

Implements org.h2.mvstore.type.DataType.createStorage.

Create storage object of array type to hold values

public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides org.h2.mvstore.type.BasicDataType.equals.

Implements java.util.Comparator.equals.

Indicates whether some other object is "equal to" this comparator.

public ValueDataType.Factory
public int
getMemory(Value
the object
v
)

Implements abstract org.h2.mvstore.type.BasicDataType.getMemory.

Implements org.h2.mvstore.type.DataType.getMemory.

Calculates the amount of used memory in bytes.

public RowFactory
public int
hashCode()

Overrides org.h2.mvstore.type.BasicDataType.hashCode.

Returns a hash code value for this object.

public Value
read(ByteBuffer
the source buffer
buff
)

Implements abstract org.h2.mvstore.type.BasicDataType.read.

Implements org.h2.mvstore.type.DataType.read.

Read an object.

private Value[]
private LobDataDatabase
private static long
private static int
pack-priv Value

Returns:

the value
readValue
(ByteBuffer
the source buffer
buff
,
TypeInfo
the data type of value, or null
columnType
)

Read a value.

private static byte[]
public void
save(WriteBuffer
the target buffer
buff
,
MetaType<Database>
the meta type
metaType
)

Implements org.h2.mvstore.type.StatefulDataType.save.

Save the state.

public void
public void
write(WriteBuffer
the target buffer
buff
,
Value
the value
v
)

Implements abstract org.h2.mvstore.type.BasicDataType.write.

Implements org.h2.mvstore.type.DataType.write.

Write an object.

private static void
writeBinary(byte type, WriteBuffer buff, Value v)

private static void
writeIntArray(WriteBuffer buff, int[] array)

public static void
writeLong(WriteBuffer
the target buffer
buff
,
long
the long value
x
)

Writes a long.

private static void
private static void
writeTimestampTime(WriteBuffer buff, long nanos)

private static void
writeTimeZone(WriteBuffer buff, int timeZoneOffset)

Inherited from org.h2.mvstore.type.BasicDataType:
binarySearchcastisMemoryEstimationAllowedreadwrite

Field Detail

ARRAYback to summary
private static final byte ARRAY
BIGINTback to summary
private static final byte BIGINT
BIGINT_0_7back to summary
private static final byte BIGINT_0_7
BIGINT_NEGback to summary
private static final byte BIGINT_NEG
BINARYback to summary
private static final int BINARY
BLOBback to summary
private static final byte BLOB
BOOLEAN_FALSEback to summary
private static final byte BOOLEAN_FALSE
BOOLEAN_TRUEback to summary
private static final byte BOOLEAN_TRUE
CHARback to summary
private static final byte CHAR
CLOBback to summary
private static final byte CLOB
compareModeback to summary
pack-priv final CompareMode compareMode
DATEback to summary
private static final byte DATE
DECFLOATback to summary
private static final int DECFLOAT
DOUBLEback to summary
private static final byte DOUBLE
DOUBLE_0_1back to summary
private static final byte DOUBLE_0_1
ENUMback to summary
private static final byte ENUM
FACTORYback to summary
private static final ValueDataType.Factory FACTORY
GEOMETRYback to summary
private static final byte GEOMETRY
handlerback to summary
pack-priv final DataHandler handler
INT_0_15back to summary
private static final byte INT_0_15
INT_NEGback to summary
private static final byte INT_NEG
INTEGERback to summary
private static final byte INTEGER
INTERVALback to summary
private static final byte INTERVAL
JAVA_OBJECTback to summary
private static final byte JAVA_OBJECT
JSONback to summary
private static final int JSON
NULLback to summary
private static final byte NULL
NUMERICback to summary
private static final byte NUMERIC
NUMERIC_0_1back to summary
private static final byte NUMERIC_0_1
NUMERIC_SMALLback to summary
private static final byte NUMERIC_SMALL
NUMERIC_SMALL_0back to summary
private static final byte NUMERIC_SMALL_0
providerback to summary
pack-priv final CastDataProvider provider
REALback to summary
private static final byte REAL
REAL_0_1back to summary
private static final byte REAL_0_1
ROWback to summary
private static final byte ROW
rowFactoryback to summary
private RowFactory rowFactory
SMALLINTback to summary
private static final byte SMALLINT
sortTypesback to summary
pack-priv final int[] sortTypes
TIMEback to summary
private static final byte TIME
TIME_TZback to summary
private static final int TIME_TZ
TIMESTAMPback to summary
private static final byte TIMESTAMP
TIMESTAMP_TZback to summary
private static final int TIMESTAMP_TZ
TIMESTAMP_TZ_OLDback to summary
private static final byte TIMESTAMP_TZ_OLD
TINYINTback to summary
private static final byte TINYINT
UUIDback to summary
private static final byte UUID
VARBINARYback to summary
private static final byte VARBINARY
VARBINARY_0_31back to summary
private static final int VARBINARY_0_31
VARCHARback to summary
private static final byte VARCHAR
VARCHAR_0_31back to summary
private static final byte VARCHAR_0_31
VARCHAR_IGNORECASEback to summary
private static final byte VARCHAR_IGNORECASE

Constructor Detail

ValueDataTypeback to summary
public ValueDataType()
ValueDataTypeback to summary
public ValueDataType(Database database, int[] sortTypes)
ValueDataTypeback to summary
public ValueDataType(CastDataProvider provider, CompareMode compareMode, DataHandler handler, int[] sortTypes)

Method Detail

compareback to summary
public int compare(Value a, Value b)

Overrides org.h2.mvstore.type.BasicDataType.compare.

Implements org.h2.mvstore.type.DataType.compare.

Doc from org.h2.mvstore.type.DataType.compare.

Compare two keys.

Parameters
a:Value

the first key

b:Value

the second key

Returns:int

-1 if the first key is smaller, 1 if larger, and 0 if equal

Annotations
@Override
compareback to summary
private int compare(SearchRow a, SearchRow b)

Overrides org.h2.mvstore.type.BasicDataType.compare.

Implements org.h2.mvstore.type.DataType.compare.

Doc from org.h2.mvstore.type.DataType.compare.

Compare two keys.

Parameters
a:SearchRow

the first key

b:SearchRow

the second key

Returns:int

-1 if the first key is smaller, 1 if larger, and 0 if equal

compareValuesback to summary
public int compareValues(Value a, Value b, int sortType)

Compares the specified values.

Parameters
a:Value

the first value

b:Value

the second value

sortType:int

the sorting type

Returns:int

0 if equal, -1 if first value is smaller for ascending or larger for descending sort type, 1 otherwise

createStorageback to summary
public Value[] createStorage(int size)

Implements org.h2.mvstore.type.DataType.createStorage.

Doc from org.h2.mvstore.type.DataType.createStorage.

Create storage object of array type to hold values

Parameters
size:int

number of values to hold

Returns:Value[]

storage object

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides org.h2.mvstore.type.BasicDataType.equals.

Implements java.util.Comparator.equals.

Doc from java.util.Comparator.equals.

Indicates whether some other object is "equal to" this comparator. This method must obey the general contract of Object#equals(Object). Additionally, this method can return true only if the specified object is also a comparator and it imposes the same ordering as this comparator. Thus, comp1.equals(comp2) implies that signum(comp1.compare(o1, o2))==signum(comp2.compare(o1, o2)) for every object reference o1 and o2.

Note that it is always safe not to override Object.equals(Object). However, overriding this method may, in some cases, improve performance by allowing programs to determine that two distinct comparators impose the same order.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true only if the specified object is also a comparator and it imposes the same ordering as this comparator.

Annotations
@Override
getFactoryback to summary
public ValueDataType.Factory getFactory()

Implements org.h2.mvstore.type.StatefulDataType.getFactory.

Annotations
@Override
getMemoryback to summary
public int getMemory(Value v)

Implements abstract org.h2.mvstore.type.BasicDataType.getMemory.

Implements org.h2.mvstore.type.DataType.getMemory.

Doc from org.h2.mvstore.type.DataType.getMemory.

Calculates the amount of used memory in bytes.

Parameters
v:Value

the object

Returns:int

the used memory

Annotations
@Override
getRowFactoryback to summary
public RowFactory getRowFactory()
hashCodeback to summary
public int hashCode()

Overrides org.h2.mvstore.type.BasicDataType.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
readback to summary
public Value read(ByteBuffer buff)

Implements abstract org.h2.mvstore.type.BasicDataType.read.

Implements org.h2.mvstore.type.DataType.read.

Doc from org.h2.mvstore.type.DataType.read.

Read an object.

Parameters
buff:ByteBuffer

the source buffer

Returns:Value

the object

Annotations
@Override
readArrayElementsback to summary
private Value[] readArrayElements(ByteBuffer buff, TypeInfo elementType)
readLobDataDatabaseback to summary
private LobDataDatabase readLobDataDatabase(ByteBuffer buff)
readTimestampTimeback to summary
private static long readTimestampTime(ByteBuffer buff)
readTimeZoneback to summary
private static int readTimeZone(ByteBuffer buff)
readValueback to summary
pack-priv Value readValue(ByteBuffer buff, TypeInfo columnType)

Read a value.

Parameters
buff:ByteBuffer

the source buffer

columnType:TypeInfo

the data type of value, or null

Returns:Value

the value

readVarBytesback to summary
private static byte[] readVarBytes(ByteBuffer buff)
saveback to summary
public void save(WriteBuffer buff, MetaType<Database> metaType)

Implements org.h2.mvstore.type.StatefulDataType.save.

Doc from org.h2.mvstore.type.StatefulDataType.save.

Save the state.

Parameters
buff:WriteBuffer

the target buffer

metaType:MetaType<Database>

the meta type

Annotations
@Override
setRowFactoryback to summary
public void setRowFactory(RowFactory rowFactory)
writeback to summary
public void write(WriteBuffer buff, Value v)

Implements abstract org.h2.mvstore.type.BasicDataType.write.

Implements org.h2.mvstore.type.DataType.write.

Doc from org.h2.mvstore.type.DataType.write.

Write an object.

Parameters
buff:WriteBuffer

the target buffer

v:Value

the value

Annotations
@Override
writeBinaryback to summary
private static void writeBinary(byte type, WriteBuffer buff, Value v)
writeIntArrayback to summary
private static void writeIntArray(WriteBuffer buff, int[] array)
writeLongback to summary
public static void writeLong(WriteBuffer buff, long x)

Writes a long.

Parameters
buff:WriteBuffer

the target buffer

x:long

the long value

writeStringback to summary
private static void writeString(WriteBuffer buff, String s)
writeTimestampTimeback to summary
private static void writeTimestampTime(WriteBuffer buff, long nanos)
writeTimeZoneback to summary
private static void writeTimeZone(WriteBuffer buff, int timeZoneOffset)
org.h2.mvstore.db back to summary

public final Class ValueDataType.Factory

extends Object
implements StatefulDataType.Factory<Database>
Class Inheritance
All Implemented Interfaces
org.h2.mvstore.type.StatefulDataType.Factory

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public DataType<?>
create(ByteBuffer
the buffer the source buffer
buff
,
MetaType<Database>
the type
metaType
,
Database
the database
database
)

Implements org.h2.mvstore.type.StatefulDataType.Factory.create.

Reads the data type.

private static int[]
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Factoryback to summary
public Factory()

Method Detail

createback to summary
public DataType<?> create(ByteBuffer buff, MetaType<Database> metaType, Database database)

Implements org.h2.mvstore.type.StatefulDataType.Factory.create.

Doc from org.h2.mvstore.type.StatefulDataType.Factory.create.

Reads the data type.

Parameters
buff:ByteBuffer

the buffer the source buffer

metaType:MetaType<Database>

the type

database:Database

the database

Returns:DataType<?>

the data type

Annotations
@Override
readIntArrayback to summary
private static int[] readIntArray(ByteBuffer buff)