Top Description Fields Constructors Methods
org.h2.value

public Class TypeInfo

extends ExtTypeInfo
implements Typed
Class Inheritance
All Implemented Interfaces
org.h2.value.Typed
Imports
java.util.Iterator, .LinkedHashMap, .Map, .Map.Entry, .Objects, .Set, org.h2.api.ErrorCode, .IntervalQualifier, org.h2.engine.Constants, org.h2.message.DbException

Data type with parameters.

Field Summary

Modifier and TypeField and Description
private final ExtTypeInfo
private final long
private final int
public static final TypeInfo
TYPE_ARRAY_UNKNOWN

ARRAY type with unknown parameters.

public static final TypeInfo
TYPE_BIGINT

BIGINT type with parameters.

public static final TypeInfo
TYPE_BINARY

BINARY type with default parameters.

public static final TypeInfo
TYPE_BLOB

BINARY LARGE OBJECT type with maximum parameters.

public static final TypeInfo
TYPE_BOOLEAN

BOOLEAN type with parameters.

public static final TypeInfo
TYPE_CHAR

CHAR type with default parameters.

public static final TypeInfo
TYPE_CLOB

CHARACTER LARGE OBJECT type with maximum parameters.

public static final TypeInfo
TYPE_DATE

DATE type with parameters.

public static final TypeInfo
TYPE_DECFLOAT

DECFLOAT type with maximum parameters.

public static final TypeInfo
TYPE_DECFLOAT_BIGINT

DECFLOAT type with parameters enough to hold a BIGINT value.

public static final TypeInfo
TYPE_DOUBLE

DOUBLE PRECISION type with parameters.

public static final TypeInfo
TYPE_ENUM_UNDEFINED

ENUM type with undefined parameters.

public static final TypeInfo
TYPE_GEOMETRY

GEOMETRY type with default parameters.

private static final TypeInfo[]
public static final TypeInfo
TYPE_INTEGER

INTEGER type with parameters.

public static final TypeInfo
TYPE_INTERVAL_DAY

INTERVAL DAY type with maximum parameters.

public static final TypeInfo
TYPE_INTERVAL_DAY_TO_SECOND

INTERVAL DAY TO SECOND type with maximum parameters.

public static final TypeInfo
TYPE_INTERVAL_HOUR_TO_SECOND

INTERVAL HOUR TO SECOND type with maximum parameters.

public static final TypeInfo
TYPE_INTERVAL_YEAR_TO_MONTH

INTERVAL YEAR TO MONTH type with maximum parameters.

public static final TypeInfo
TYPE_JAVA_OBJECT

JAVA_OBJECT type with maximum parameters.

public static final TypeInfo
TYPE_JSON

JSON type.

public static final TypeInfo
TYPE_NULL

NULL type with parameters.

public static final TypeInfo
TYPE_NUMERIC_BIGINT

NUMERIC type with parameters enough to hold a BIGINT value.

public static final TypeInfo
TYPE_NUMERIC_FLOATING_POINT

NUMERIC type that can hold values with floating point.

public static final TypeInfo
TYPE_NUMERIC_SCALE_0

NUMERIC type with maximum precision and scale 0.

public static final TypeInfo
TYPE_REAL

REAL type with parameters.

public static final TypeInfo
TYPE_ROW_EMPTY

ROW (row value) type without fields.

public static final TypeInfo
TYPE_SMALLINT

SMALLINT type with parameters.

public static final TypeInfo
TYPE_TIME

TIME type with maximum parameters.

public static final TypeInfo
TYPE_TIME_TZ

TIME WITH TIME ZONE type with maximum parameters.

public static final TypeInfo
TYPE_TIMESTAMP

TIMESTAMP type with maximum parameters.

public static final TypeInfo
TYPE_TIMESTAMP_TZ

TIMESTAMP WITH TIME ZONE type with maximum parameters.

public static final TypeInfo
TYPE_TINYINT

TINYINT type with parameters.

public static final TypeInfo
TYPE_UNKNOWN

UNKNOWN type with parameters.

public static final TypeInfo
TYPE_UUID

UUID type with parameters.

public static final TypeInfo
TYPE_VARBINARY

BINARY VARYING type with maximum parameters.

public static final TypeInfo
TYPE_VARCHAR

CHARACTER VARYING type with maximum parameters.

public static final TypeInfo
TYPE_VARCHAR_IGNORECASE

VARCHAR_IGNORECASE type with maximum parameters.

private final int

Constructor Summary

AccessConstructor and Description
private
TypeInfo(int valueType)

private
TypeInfo(int valueType, long precision)

private
TypeInfo(int valueType, int scale)

public
TypeInfo(int
the value type
valueType
,
long
the precision
precision
,
int
the scale
scale
,
ExtTypeInfo
the extended type information, or null
extTypeInfo
)

Creates new instance of data type with parameters.

Method Summary

Modifier and TypeMethod and Description
private static boolean

Returns:

whether types are comparable
areComparable
(TypeInfo
first data type
t1
,
TypeInfo
second data type
t2
)

Determines whether two specified types are comparable.

public static boolean

Returns:

whether types are the same
areSameTypes
(TypeInfo
first data type
t1
,
TypeInfo
second data type
t2
)

Determines whether two specified types are the same data types without taking precision or scale into account.

public static void
checkComparable(TypeInfo
first data type
t1
,
TypeInfo
second data type
t2
)

Checks whether two specified types are comparable and throws an exception otherwise.

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

Overrides java.lang.Object.equals.

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

public long

Returns:

precision in decimal digits
getDecimalPrecision
()

Returns approximate precision in decimal digits for binary numeric data types and precision for all other types.

public long

Returns:

the precision, or -1L if not specified in data type definition
getDeclaredPrecision
()

Returns the precision, or -1L if not specified in data type definition.

public int

Returns:

the scale, or -1 if not specified in data type definition
getDeclaredScale
()

Returns the scale, or -1 if not specified in data type definition.

public String

Returns:

the declared name
getDeclaredTypeName
()

Returns the declared name of this data type with precision, scale, length, cardinality etc. parameters removed, excluding parameters of ENUM data type, GEOMETRY data type, ARRAY elements, and ROW fields.

public int

Returns:

the display size
getDisplaySize
()

Returns the display size in characters.

public ExtTypeInfo

Returns:

the extended type information, or null
getExtTypeInfo
()

Returns the extended type information, or null.

private static TypeInfo
getHigherArray(TypeInfo type1, TypeInfo type2, int d1, int d2)

private static TypeInfo
private static TypeInfo
public static TypeInfo

Returns:

the higher data type
getHigherType
(Typed[]
the values
values
)

Get the higher data type of all values.

public static TypeInfo

Returns:

the higher data type of the two
getHigherType
(TypeInfo
the first data type
type1
,
TypeInfo
the second data type
type2
)

Get the higher data type of two data types.

public long

Returns:

the precision
getPrecision
()

Returns the precision.

public int

Returns:

the scale
getScale
()

Returns the scale.

public StringBuilder
getSQL(StringBuilder
string builder
builder
,
int
formatting flags
sqlFlags
)

Implements org.h2.util.HasSQL.getSQL.

Appends the SQL statement of this object to the specified builder.

public TypeInfo

Returns:

this
getType
()

Implements org.h2.value.Typed.getType.

Returns this type information.

public static TypeInfo

Returns:

the data type with parameters object
getTypeInfo
(int
the value type
type
)

Get the data type with parameters object for the given value type and maximum parameters.

public static TypeInfo

Returns:

the data type with parameters object
getTypeInfo
(int
the value type
type
,
long
the precision or -1L for default
precision
,
int
the scale or -1 for default
scale
,
ExtTypeInfo
the extended type information or null
extTypeInfo
)

Get the data type with parameters object for the given value type and the specified parameters.

public int

Returns:

the value type
getValueType
()

Returns the value type.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public static boolean

Returns:

whether types are comparable
haveSameOrdering
(TypeInfo
first data type
t1
,
TypeInfo
second data type
t2
)

Determines whether two specified types have the same ordering rules.

public TypeInfo

Returns:

DECFLOAT type information
toDecfloatType
()

Convert this type information to compatible DECFLOAT type information.

public TypeInfo

Returns:

NUMERIC type information
toNumericType
()

Convert this type information to compatible NUMERIC type information.

private static TypeInfo
public TypeInfo

Returns:

unwrapped data type if this data type is a row type with degree 1 or this type otherwise
unwrapRow
()

Returns unwrapped data type if this data type is a row type with degree 1 or this type otherwise.

Inherited from org.h2.value.ExtTypeInfo:
toString

Field Detail

extTypeInfoback to summary
private final ExtTypeInfo extTypeInfo
precisionback to summary
private final long precision
scaleback to summary
private final int scale
TYPE_ARRAY_UNKNOWNback to summary
public static final TypeInfo TYPE_ARRAY_UNKNOWN

ARRAY type with unknown parameters.

TYPE_BIGINTback to summary
public static final TypeInfo TYPE_BIGINT

BIGINT type with parameters.

TYPE_BINARYback to summary
public static final TypeInfo TYPE_BINARY

BINARY type with default parameters.

TYPE_BLOBback to summary
public static final TypeInfo TYPE_BLOB

BINARY LARGE OBJECT type with maximum parameters.

TYPE_BOOLEANback to summary
public static final TypeInfo TYPE_BOOLEAN

BOOLEAN type with parameters.

TYPE_CHARback to summary
public static final TypeInfo TYPE_CHAR

CHAR type with default parameters.

TYPE_CLOBback to summary
public static final TypeInfo TYPE_CLOB

CHARACTER LARGE OBJECT type with maximum parameters.

TYPE_DATEback to summary
public static final TypeInfo TYPE_DATE

DATE type with parameters.

TYPE_DECFLOATback to summary
public static final TypeInfo TYPE_DECFLOAT

DECFLOAT type with maximum parameters.

TYPE_DECFLOAT_BIGINTback to summary
public static final TypeInfo TYPE_DECFLOAT_BIGINT

DECFLOAT type with parameters enough to hold a BIGINT value.

TYPE_DOUBLEback to summary
public static final TypeInfo TYPE_DOUBLE

DOUBLE PRECISION type with parameters.

TYPE_ENUM_UNDEFINEDback to summary
public static final TypeInfo TYPE_ENUM_UNDEFINED

ENUM type with undefined parameters.

TYPE_GEOMETRYback to summary
public static final TypeInfo TYPE_GEOMETRY

GEOMETRY type with default parameters.

TYPE_INFOS_BY_VALUE_TYPEback to summary
private static final TypeInfo[] TYPE_INFOS_BY_VALUE_TYPE
TYPE_INTEGERback to summary
public static final TypeInfo TYPE_INTEGER

INTEGER type with parameters.

TYPE_INTERVAL_DAYback to summary
public static final TypeInfo TYPE_INTERVAL_DAY

INTERVAL DAY type with maximum parameters.

TYPE_INTERVAL_DAY_TO_SECONDback to summary
public static final TypeInfo TYPE_INTERVAL_DAY_TO_SECOND

INTERVAL DAY TO SECOND type with maximum parameters.

TYPE_INTERVAL_HOUR_TO_SECONDback to summary
public static final TypeInfo TYPE_INTERVAL_HOUR_TO_SECOND

INTERVAL HOUR TO SECOND type with maximum parameters.

TYPE_INTERVAL_YEAR_TO_MONTHback to summary
public static final TypeInfo TYPE_INTERVAL_YEAR_TO_MONTH

INTERVAL YEAR TO MONTH type with maximum parameters.

TYPE_JAVA_OBJECTback to summary
public static final TypeInfo TYPE_JAVA_OBJECT

JAVA_OBJECT type with maximum parameters.

TYPE_JSONback to summary
public static final TypeInfo TYPE_JSON

JSON type.

TYPE_NULLback to summary
public static final TypeInfo TYPE_NULL

NULL type with parameters.

TYPE_NUMERIC_BIGINTback to summary
public static final TypeInfo TYPE_NUMERIC_BIGINT

NUMERIC type with parameters enough to hold a BIGINT value.

TYPE_NUMERIC_FLOATING_POINTback to summary
public static final TypeInfo TYPE_NUMERIC_FLOATING_POINT

NUMERIC type that can hold values with floating point.

TYPE_NUMERIC_SCALE_0back to summary
public static final TypeInfo TYPE_NUMERIC_SCALE_0

NUMERIC type with maximum precision and scale 0.

TYPE_REALback to summary
public static final TypeInfo TYPE_REAL

REAL type with parameters.

TYPE_ROW_EMPTYback to summary
public static final TypeInfo TYPE_ROW_EMPTY

ROW (row value) type without fields.

TYPE_SMALLINTback to summary
public static final TypeInfo TYPE_SMALLINT

SMALLINT type with parameters.

TYPE_TIMEback to summary
public static final TypeInfo TYPE_TIME

TIME type with maximum parameters.

TYPE_TIME_TZback to summary
public static final TypeInfo TYPE_TIME_TZ

TIME WITH TIME ZONE type with maximum parameters.

TYPE_TIMESTAMPback to summary
public static final TypeInfo TYPE_TIMESTAMP

TIMESTAMP type with maximum parameters.

TYPE_TIMESTAMP_TZback to summary
public static final TypeInfo TYPE_TIMESTAMP_TZ

TIMESTAMP WITH TIME ZONE type with maximum parameters.

TYPE_TINYINTback to summary
public static final TypeInfo TYPE_TINYINT

TINYINT type with parameters.

TYPE_UNKNOWNback to summary
public static final TypeInfo TYPE_UNKNOWN

UNKNOWN type with parameters.

TYPE_UUIDback to summary
public static final TypeInfo TYPE_UUID

UUID type with parameters.

TYPE_VARBINARYback to summary
public static final TypeInfo TYPE_VARBINARY

BINARY VARYING type with maximum parameters.

TYPE_VARCHARback to summary
public static final TypeInfo TYPE_VARCHAR

CHARACTER VARYING type with maximum parameters.

TYPE_VARCHAR_IGNORECASEback to summary
public static final TypeInfo TYPE_VARCHAR_IGNORECASE

VARCHAR_IGNORECASE type with maximum parameters.

valueTypeback to summary
private final int valueType

Constructor Detail

TypeInfoback to summary
private TypeInfo(int valueType)
TypeInfoback to summary
private TypeInfo(int valueType, long precision)
TypeInfoback to summary
private TypeInfo(int valueType, int scale)
TypeInfoback to summary
public TypeInfo(int valueType, long precision, int scale, ExtTypeInfo extTypeInfo)

Creates new instance of data type with parameters.

Parameters
valueType:int

the value type

precision:long

the precision

scale:int

the scale

extTypeInfo:ExtTypeInfo

the extended type information, or null

Method Detail

areComparableback to summary
private static boolean areComparable(TypeInfo t1, TypeInfo t2)

Determines whether two specified types are comparable.

Parameters
t1:TypeInfo

first data type

t2:TypeInfo

second data type

Returns:boolean

whether types are comparable

areSameTypesback to summary
public static boolean areSameTypes(TypeInfo t1, TypeInfo t2)

Determines whether two specified types are the same data types without taking precision or scale into account.

Parameters
t1:TypeInfo

first data type

t2:TypeInfo

second data type

Returns:boolean

whether types are the same

checkComparableback to summary
public static void checkComparable(TypeInfo t1, TypeInfo t2)

Checks whether two specified types are comparable and throws an exception otherwise.

Parameters
t1:TypeInfo

first data type

t2:TypeInfo

second data type

Exceptions
DbException:
if types aren't comparable
dimensionsback to summary
private static int dimensions(TypeInfo type)
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

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

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getDecimalPrecisionback to summary
public long getDecimalPrecision()

Returns approximate precision in decimal digits for binary numeric data types and precision for all other types.

Returns:long

precision in decimal digits

getDeclaredPrecisionback to summary
public long getDeclaredPrecision()

Returns the precision, or -1L if not specified in data type definition.

Returns:long

the precision, or -1L if not specified in data type definition

getDeclaredScaleback to summary
public int getDeclaredScale()

Returns the scale, or -1 if not specified in data type definition.

Returns:int

the scale, or -1 if not specified in data type definition

getDeclaredTypeNameback to summary
public String getDeclaredTypeName()

Returns the declared name of this data type with precision, scale, length, cardinality etc. parameters removed, excluding parameters of ENUM data type, GEOMETRY data type, ARRAY elements, and ROW fields.

Returns:String

the declared name

getDisplaySizeback to summary
public int getDisplaySize()

Returns the display size in characters.

Returns:int

the display size

getExtTypeInfoback to summary
public ExtTypeInfo getExtTypeInfo()

Returns the extended type information, or null.

Returns:ExtTypeInfo

the extended type information, or null

getHigherArrayback to summary
private static TypeInfo getHigherArray(TypeInfo type1, TypeInfo type2, int d1, int d2)
getHigherGeometryback to summary
private static TypeInfo getHigherGeometry(TypeInfo type1, TypeInfo type2)
getHigherRowback to summary
private static TypeInfo getHigherRow(TypeInfo type1, TypeInfo type2)
getHigherTypeback to summary
public static TypeInfo getHigherType(Typed[] values)

Get the higher data type of all values.

Parameters
values:Typed[]

the values

Returns:TypeInfo

the higher data type

getHigherTypeback to summary
public static TypeInfo getHigherType(TypeInfo type1, TypeInfo type2)

Get the higher data type of two data types. If values need to be converted to match the other operands data type, the value with the lower order is converted to the value with the higher order.

Parameters
type1:TypeInfo

the first data type

type2:TypeInfo

the second data type

Returns:TypeInfo

the higher data type of the two

getPrecisionback to summary
public long getPrecision()

Returns the precision.

Returns:long

the precision

getScaleback to summary
public int getScale()

Returns the scale.

Returns:int

the scale

getSQLback to summary
public StringBuilder getSQL(StringBuilder builder, int sqlFlags)

Implements org.h2.util.HasSQL.getSQL.

Doc from org.h2.util.HasSQL.getSQL.

Appends the SQL statement of this object to the specified builder.

Parameters
builder:StringBuilder

string builder

sqlFlags:int

formatting flags

Returns:StringBuilder

the specified string builder

Annotations
@Override
getTypeback to summary
public TypeInfo getType()

Implements org.h2.value.Typed.getType.

Returns this type information.

Returns:TypeInfo

this

Annotations
@Override
getTypeInfoback to summary
public static TypeInfo getTypeInfo(int type)

Get the data type with parameters object for the given value type and maximum parameters.

Parameters
type:int

the value type

Returns:TypeInfo

the data type with parameters object

getTypeInfoback to summary
public static TypeInfo getTypeInfo(int type, long precision, int scale, ExtTypeInfo extTypeInfo)

Get the data type with parameters object for the given value type and the specified parameters.

Parameters
type:int

the value type

precision:long

the precision or -1L for default

scale:int

the scale or -1 for default

extTypeInfo:ExtTypeInfo

the extended type information or null

Returns:TypeInfo

the data type with parameters object

getValueTypeback to summary
public int getValueType()

Returns the value type.

Returns:int

the value type

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.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
haveSameOrderingback to summary
public static boolean haveSameOrdering(TypeInfo t1, TypeInfo t2)

Determines whether two specified types have the same ordering rules.

Parameters
t1:TypeInfo

first data type

t2:TypeInfo

second data type

Returns:boolean

whether types are comparable

toDecfloatTypeback to summary
public TypeInfo toDecfloatType()

Convert this type information to compatible DECFLOAT type information.

Returns:TypeInfo

DECFLOAT type information

toNumericTypeback to summary
public TypeInfo toNumericType()

Convert this type information to compatible NUMERIC type information.

Returns:TypeInfo

NUMERIC type information

typeToRowback to summary
private static TypeInfo typeToRow(TypeInfo type)
unwrapRowback to summary
public TypeInfo unwrapRow()

Returns unwrapped data type if this data type is a row type with degree 1 or this type otherwise.

Returns:TypeInfo

unwrapped data type if this data type is a row type with degree 1 or this type otherwise