Package org.h2.value
Class TypeInfo
java.lang.Object
org.h2.value.ExtTypeInfo
org.h2.value.TypeInfo
Data type with parameters.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TypeInfoARRAY type with unknown parameters.static final TypeInfoBIGINT type with parameters.static final TypeInfoBINARY type with default parameters.static final TypeInfoBINARY LARGE OBJECT type with maximum parameters.static final TypeInfoBOOLEAN type with parameters.static final TypeInfoCHAR type with default parameters.static final TypeInfoCHARACTER LARGE OBJECT type with maximum parameters.static final TypeInfoDATE type with parameters.static final TypeInfoDECFLOAT type with maximum parameters.static final TypeInfoDECFLOAT type with parameters enough to hold a BIGINT value.static final TypeInfoDOUBLE PRECISION type with parameters.static final TypeInfoENUM type with undefined parameters.static final TypeInfoGEOMETRY type with default parameters.static final TypeInfoINTEGER type with parameters.static final TypeInfoINTERVAL DAY type with maximum parameters.static final TypeInfoINTERVAL DAY TO SECOND type with maximum parameters.static final TypeInfoINTERVAL HOUR TO SECOND type with maximum parameters.static final TypeInfoINTERVAL YEAR TO MONTH type with maximum parameters.static final TypeInfoJAVA_OBJECT type with maximum parameters.static final TypeInfoJSON type.static final TypeInfoNULL type with parameters.static final TypeInfoNUMERIC type with parameters enough to hold a BIGINT value.static final TypeInfoNUMERIC type that can hold values with floating point.static final TypeInfoNUMERIC type with maximum precision and scale 0.static final TypeInfoREAL type with parameters.static final TypeInfoROW (row value) type without fields.static final TypeInfoSMALLINT type with parameters.static final TypeInfoTIME type with maximum parameters.static final TypeInfoTIME WITH TIME ZONE type with maximum parameters.static final TypeInfoTIMESTAMP type with maximum parameters.static final TypeInfoTIMESTAMP WITH TIME ZONE type with maximum parameters.static final TypeInfoTINYINT type with parameters.static final TypeInfoUNKNOWN type with parameters.static final TypeInfoUUID type with parameters.static final TypeInfoBINARY VARYING type with maximum parameters.static final TypeInfoCHARACTER VARYING type with maximum parameters.static final TypeInfoVARCHAR_IGNORECASE type with maximum parameters.Fields inherited from interface org.h2.util.HasSQL
ADD_PLAN_INFORMATION, DEFAULT_SQL_FLAGS, NO_CASTS, QUOTE_ONLY_WHEN_REQUIRED, REPLACE_LOBS_FOR_TRACE, TRACE_SQL_FLAGS -
Constructor Summary
ConstructorsConstructorDescriptionTypeInfo(int valueType, long precision, int scale, ExtTypeInfo extTypeInfo) Creates new instance of data type with parameters. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanareSameTypes(TypeInfo t1, TypeInfo t2) Determines whether two specified types are the same data types without taking precision or scale into account.static voidcheckComparable(TypeInfo t1, TypeInfo t2) Checks whether two specified types are comparable and throws an exception otherwise.booleanlongReturns approximate precision in decimal digits for binary numeric data types and precision for all other types.longReturns the precision, or-1Lif not specified in data type definition.intReturns the scale, or-1if not specified in data type definition.Returns the declared name of this data type with precision, scale, length, cardinality etc.intReturns the display size in characters.Returns the extended type information, or null.static TypeInfogetHigherType(Typed[] values) Get the higher data type of all values.static TypeInfogetHigherType(TypeInfo type1, TypeInfo type2) Get the higher data type of two data types.longReturns the precision.intgetScale()Returns the scale.getSQL(StringBuilder builder, int sqlFlags) Appends the SQL statement of this object to the specified builder.getType()Returns this type information.static TypeInfogetTypeInfo(int type) Get the data type with parameters object for the given value type and maximum parameters.static TypeInfogetTypeInfo(int type, long precision, int scale, ExtTypeInfo extTypeInfo) Get the data type with parameters object for the given value type and the specified parameters.intReturns the value type.inthashCode()static booleanhaveSameOrdering(TypeInfo t1, TypeInfo t2) Determines whether two specified types have the same ordering rules.Convert this type information to compatible DECFLOAT type information.Convert this type information to compatible NUMERIC type information.Returns unwrapped data type if this data type is a row type with degree 1 or this type otherwise.Methods inherited from class org.h2.value.ExtTypeInfo
toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.h2.util.HasSQL
getSQL, getTraceSQL
-
Field Details
-
TYPE_UNKNOWN
UNKNOWN type with parameters. -
TYPE_NULL
NULL type with parameters. -
TYPE_CHAR
CHAR type with default parameters. -
TYPE_VARCHAR
CHARACTER VARYING type with maximum parameters. -
TYPE_VARCHAR_IGNORECASE
VARCHAR_IGNORECASE type with maximum parameters. -
TYPE_CLOB
CHARACTER LARGE OBJECT type with maximum parameters. -
TYPE_BINARY
BINARY type with default parameters. -
TYPE_VARBINARY
BINARY VARYING type with maximum parameters. -
TYPE_BLOB
BINARY LARGE OBJECT type with maximum parameters. -
TYPE_BOOLEAN
BOOLEAN type with parameters. -
TYPE_TINYINT
TINYINT type with parameters. -
TYPE_SMALLINT
SMALLINT type with parameters. -
TYPE_INTEGER
INTEGER type with parameters. -
TYPE_BIGINT
BIGINT type with parameters. -
TYPE_NUMERIC_SCALE_0
NUMERIC type with maximum precision and scale 0. -
TYPE_NUMERIC_BIGINT
NUMERIC type with parameters enough to hold a BIGINT value. -
TYPE_NUMERIC_FLOATING_POINT
NUMERIC type that can hold values with floating point. -
TYPE_REAL
REAL type with parameters. -
TYPE_DOUBLE
DOUBLE PRECISION type with parameters. -
TYPE_DECFLOAT
DECFLOAT type with maximum parameters. -
TYPE_DECFLOAT_BIGINT
DECFLOAT type with parameters enough to hold a BIGINT value. -
TYPE_DATE
DATE type with parameters. -
TYPE_TIME
TIME type with maximum parameters. -
TYPE_TIME_TZ
TIME WITH TIME ZONE type with maximum parameters. -
TYPE_TIMESTAMP
TIMESTAMP type with maximum parameters. -
TYPE_TIMESTAMP_TZ
TIMESTAMP WITH TIME ZONE type with maximum parameters. -
TYPE_INTERVAL_DAY
INTERVAL DAY type with maximum parameters. -
TYPE_INTERVAL_YEAR_TO_MONTH
INTERVAL YEAR TO MONTH type with maximum parameters. -
TYPE_INTERVAL_DAY_TO_SECOND
INTERVAL DAY TO SECOND type with maximum parameters. -
TYPE_INTERVAL_HOUR_TO_SECOND
INTERVAL HOUR TO SECOND type with maximum parameters. -
TYPE_JAVA_OBJECT
JAVA_OBJECT type with maximum parameters. -
TYPE_ENUM_UNDEFINED
ENUM type with undefined parameters. -
TYPE_GEOMETRY
GEOMETRY type with default parameters. -
TYPE_JSON
JSON type. -
TYPE_UUID
UUID type with parameters. -
TYPE_ARRAY_UNKNOWN
ARRAY type with unknown parameters. -
TYPE_ROW_EMPTY
ROW (row value) type without fields.
-
-
Constructor Details
-
TypeInfo
Creates new instance of data type with parameters.- Parameters:
valueType- the value typeprecision- the precisionscale- the scaleextTypeInfo- the extended type information, or null
-
-
Method Details
-
getTypeInfo
Get the data type with parameters object for the given value type and maximum parameters.- Parameters:
type- the value type- Returns:
- the data type with parameters object
-
getTypeInfo
Get the data type with parameters object for the given value type and the specified parameters.- Parameters:
type- the value typeprecision- the precision or-1Lfor defaultscale- the scale or-1for defaultextTypeInfo- the extended type information or null- Returns:
- the data type with parameters object
-
getHigherType
Get the higher data type of all values.- Parameters:
values- the values- Returns:
- the higher data type
-
getHigherType
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- the first data typetype2- the second data type- Returns:
- the higher data type of the two
-
areSameTypes
Determines whether two specified types are the same data types without taking precision or scale into account.- Parameters:
t1- first data typet2- second data type- Returns:
- whether types are the same
-
checkComparable
Checks whether two specified types are comparable and throws an exception otherwise.- Parameters:
t1- first data typet2- second data type- Throws:
DbException- if types aren't comparable
-
haveSameOrdering
Determines whether two specified types have the same ordering rules.- Parameters:
t1- first data typet2- second data type- Returns:
- whether types are comparable
-
getType
Returns this type information. -
getValueType
public int getValueType()Returns the value type.- Returns:
- the value type
-
getPrecision
public long getPrecision()Returns the precision.- Returns:
- the precision
-
getDeclaredPrecision
public long getDeclaredPrecision()Returns the precision, or-1Lif not specified in data type definition.- Returns:
- the precision, or
-1Lif not specified in data type definition
-
getScale
public int getScale()Returns the scale.- Returns:
- the scale
-
getDeclaredScale
public int getDeclaredScale()Returns the scale, or-1if not specified in data type definition.- Returns:
- the scale, or
-1if not specified in data type definition
-
getDisplaySize
public int getDisplaySize()Returns the display size in characters.- Returns:
- the display size
-
getExtTypeInfo
Returns the extended type information, or null.- Returns:
- the extended type information, or null
-
getSQL
Description copied from interface:HasSQLAppends the SQL statement of this object to the specified builder. -
hashCode
public int hashCode() -
equals
-
toNumericType
Convert this type information to compatible NUMERIC type information.- Returns:
- NUMERIC type information
-
toDecfloatType
Convert this type information to compatible DECFLOAT type information.- Returns:
- DECFLOAT type information
-
unwrapRow
Returns unwrapped data type if this data type is a row type with degree 1 or this type otherwise.- Returns:
- unwrapped data type if this data type is a row type with degree 1 or this type otherwise
-
getDecimalPrecision
public long getDecimalPrecision()Returns approximate precision in decimal digits for binary numeric data types and precision for all other types.- Returns:
- precision in decimal digits
-
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:
- the declared name
-