org.hsqldb.types
Class Type
- java.lang.Object
-
- org.hsqldb.types.Type
-
- All Implemented Interfaces:
- java.lang.Cloneable, SchemaObject
- Direct Known Subclasses:
- ArrayType, BinaryType, BooleanType, CharacterType, DTIType, NullType, NumberType, OtherType, RowType
public abstract class Type extends java.lang.Object implements SchemaObject, java.lang.Cloneable
Base class for type objects.- Since:
- 1.9.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classType.TypedComparator-
Nested classes/interfaces inherited from interface org.hsqldb.SchemaObject
SchemaObject.ConstraintTypes, SchemaObject.Deferable, SchemaObject.Nullability, SchemaObject.ParameterModes, SchemaObject.ReferentialAction, SchemaObject.ViewCheckModes
-
-
Field Summary
-
Fields inherited from interface org.hsqldb.SchemaObject
ASSERTION, CATALOG, CHARSET, COLLATION, COLUMN, CONSTRAINT, CURSOR, DOMAIN, FUNCTION, GRANTEE, INDEX, LABEL, PARAMETER, PROCEDURE, ROUTINE, SCHEMA, SEARCH, SEQUENCE, SERVER, SPECIFIC_ROUTINE, SUBQUERY, TABLE, TRANSITION, TRIGGER, TYPE, VARIABLE, VIEW, WRAPPER
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description java.lang.Objectabsolute(java.lang.Object a)All arithmetic ops are called on the pre-determined Type object of the resultbooleanacceptsFractionalPrecision()booleanacceptsPrecision()booleanacceptsScale()java.lang.Objectadd(Session session, java.lang.Object a, java.lang.Object b, Type otherType)intarrayLimitCardinality()booleancanBeAssignedFrom(Type otherType)abstract booleancanConvertFrom(Type otherType)intcanMoveFrom(Type otherType)Can convert without changing the objectintcardinality(Session session, java.lang.Object a)java.lang.ObjectcastToType(SessionInterface session, java.lang.Object a, Type type)Explicit casts are handled by this method.TypecollectionBaseType()abstract intcompare(Session session, java.lang.Object a, java.lang.Object b)intcompare(Session session, java.lang.Object a, java.lang.Object b, int opType)intcompare(Session session, java.lang.Object a, java.lang.Object b, SortAndSlice sort)intcompareToTypeRange(java.lang.Object o)voidcompile(Session session, SchemaObject parentObject)java.lang.Objectconcat(Session session, java.lang.Object a, java.lang.Object b)java.lang.ObjectconvertJavaToSQL(SessionInterface session, java.lang.Object a)java.lang.ObjectconvertSQLToJava(SessionInterface session, java.lang.Object a)abstract java.lang.ObjectconvertToDefaultType(SessionInterface sessionInterface, java.lang.Object o)Converts the object to the given type without limit checks.abstract java.lang.StringconvertToSQLString(java.lang.Object a)abstract java.lang.StringconvertToString(java.lang.Object a)abstract java.lang.ObjectconvertToType(SessionInterface session, java.lang.Object a, Type type)Same as castToType except for CHARACTER values.java.lang.ObjectconvertToTypeJDBC(SessionInterface session, java.lang.Object a, Type otherType)Convert type for JDBC reads.abstract java.lang.ObjectconvertToTypeLimits(SessionInterface session, java.lang.Object a)abstract intdisplaySize()java.lang.Objectdivide(Session session, java.lang.Object a, java.lang.Object b)Typeduplicate()booleanequals(java.lang.Object other)abstract TypegetAggregateType(Type other)Common type used in comparison opertions.static TypegetAggregateType(Type add, Type existing)HsqlNameManager.HsqlNamegetCatalogName()longgetChangeTimestamp()CharsetgetCharacterSet()CollationgetCollation()abstract TypegetCombinedType(Session session, Type other, int operation)Result type of combining values of two types in different opertions.OrderedHashSetgetComponents()static ArrayTypegetDefaultArrayType(int type)static TypegetDefaultType(int type)static TypegetDefaultTypeWithSize(int type)abstract java.lang.StringgetDefinition()Returns the full definition of the type, including parametersjava.lang.StringgetFullNameString()Returns the name of the typestatic intgetHSQLDBTypeCode(int jdbcTypeNumber)abstract java.lang.ClassgetJDBCClass()abstract java.lang.StringgetJDBCClassName()Returns the JDBC class name of type, if it exists, otherwise the HSQLDB class name.intgetJDBCPrecision()intgetJDBCScale()abstract intgetJDBCTypeCode()Returns the JDBC type number of type, if it exists, otherwise the HSQLDB / SQL type.static intgetJDBCTypeCode(int type)translate an internal type number to JDBC type number if a type is not supported internally, it is returned without translationlonggetMaxPrecision()intgetMaxScale()HsqlNameManager.HsqlNamegetName()abstract java.lang.StringgetNameString()Returns the name of the typeGranteegetOwner()intgetPrecisionRadix()OrderedHashSetgetReferences()HsqlNameManager.HsqlNamegetSchemaName()java.lang.StringgetSQL()Retrieves the SQL character sequence required to (re)create the trigger, as a StringBufferintgetSQLGenericTypeCode()Returns the generic SQL CLI type number of type, if it exists, otherwise the HSQLDB type.intgetType()static TypegetType(int type, Charset charset, Collation collation, long precision, int scale)Enforces precision and scale limits on typestatic TypegetType(Type type, Collation collation)java.lang.StringgetTypeDefinition()static TypegetTypeForJDBCConvertToken(int name)static intgetTypeNr(java.lang.String name)inthashCode()booleanisArrayType()booleanisBinaryType()booleanisBitType()booleanisBooleanType()booleanisCharacterType()booleanisDateOrTimestampType()booleanisDateTimeType()booleanisDateTimeTypeWithZone()booleanisDecimalType()booleanisDistinctType()booleanisDomainType()booleanisExactNumberType()booleanisIntegralType()booleanisIntervalType()booleanisLobType()booleanisMultisetType()booleanisNumberType()booleanisObjectType()booleanisRowType()booleanisStructuredType()static booleanisSupportedSQLType(int typeNumber)static booleanmatches(Type[] one, Type[] other)java.lang.Objectmultiply(java.lang.Object a, java.lang.Object b)java.lang.Objectnegate(java.lang.Object a)static Type.TypedComparatornewComparator(Session session)intprecedenceDegree(Type other)booleanrequiresPrecision()java.lang.Objectsubtract(Session session, java.lang.Object a, java.lang.Object b, Type otherType)
-
-
-
Field Detail
-
emptyArray
public static final Type[] emptyArray
-
typeComparisonGroup
public final int typeComparisonGroup
-
typeDataGroup
public final int typeDataGroup
-
typeCode
public final int typeCode
-
precision
public final long precision
-
scale
public final int scale
-
userTypeModifier
public UserTypeModifier userTypeModifier
-
SQL_ALL_TYPES
public static final Type SQL_ALL_TYPES
-
SQL_CHAR
public static final CharacterType SQL_CHAR
-
SQL_CHAR_16
public static final CharacterType SQL_CHAR_16
-
SQL_CHAR_DEFAULT
public static final CharacterType SQL_CHAR_DEFAULT
-
SQL_VARCHAR
public static final CharacterType SQL_VARCHAR
-
SQL_VARCHAR_DEFAULT
public static final CharacterType SQL_VARCHAR_DEFAULT
-
SQL_CLOB
public static final ClobType SQL_CLOB
-
SQL_BIT
public static final BitType SQL_BIT
-
SQL_BIT_VARYING
public static final BitType SQL_BIT_VARYING
-
SQL_BIT_VARYING_MAX_LENGTH
public static final BitType SQL_BIT_VARYING_MAX_LENGTH
-
SQL_BINARY
public static final BinaryType SQL_BINARY
-
SQL_BINARY_16
public static final BinaryType SQL_BINARY_16
-
SQL_BINARY_DEFAULT
public static final BinaryType SQL_BINARY_DEFAULT
-
SQL_VARBINARY
public static final BinaryType SQL_VARBINARY
-
SQL_VARBINARY_DEFAULT
public static final BinaryType SQL_VARBINARY_DEFAULT
-
SQL_BLOB
public static final BlobType SQL_BLOB
-
OTHER
public static final OtherType OTHER
-
SQL_BOOLEAN
public static final BooleanType SQL_BOOLEAN
-
SQL_NUMERIC
public static final NumberType SQL_NUMERIC
-
SQL_DECIMAL
public static final NumberType SQL_DECIMAL
-
SQL_DECIMAL_DEFAULT
public static final NumberType SQL_DECIMAL_DEFAULT
-
SQL_DECIMAL_BIGINT_SQR
public static final NumberType SQL_DECIMAL_BIGINT_SQR
-
SQL_DOUBLE
public static final NumberType SQL_DOUBLE
-
TINYINT
public static final NumberType TINYINT
-
SQL_SMALLINT
public static final NumberType SQL_SMALLINT
-
SQL_INTEGER
public static final NumberType SQL_INTEGER
-
SQL_BIGINT
public static final NumberType SQL_BIGINT
-
SQL_DATE
public static final DateTimeType SQL_DATE
-
SQL_TIME
public static final DateTimeType SQL_TIME
-
SQL_TIME_WITH_TIME_ZONE
public static final DateTimeType SQL_TIME_WITH_TIME_ZONE
-
SQL_TIMESTAMP
public static final DateTimeType SQL_TIMESTAMP
-
SQL_TIMESTAMP_WITH_TIME_ZONE
public static final DateTimeType SQL_TIMESTAMP_WITH_TIME_ZONE
-
SQL_TIMESTAMP_NO_FRACTION
public static final DateTimeType SQL_TIMESTAMP_NO_FRACTION
-
SQL_INTERVAL_YEAR
public static final IntervalType SQL_INTERVAL_YEAR
-
SQL_INTERVAL_MONTH
public static final IntervalType SQL_INTERVAL_MONTH
-
SQL_INTERVAL_DAY
public static final IntervalType SQL_INTERVAL_DAY
-
SQL_INTERVAL_HOUR
public static final IntervalType SQL_INTERVAL_HOUR
-
SQL_INTERVAL_MINUTE
public static final IntervalType SQL_INTERVAL_MINUTE
-
SQL_INTERVAL_SECOND
public static final IntervalType SQL_INTERVAL_SECOND
-
SQL_INTERVAL_SECOND_MAX_FRACTION
public static final IntervalType SQL_INTERVAL_SECOND_MAX_FRACTION
-
SQL_INTERVAL_YEAR_TO_MONTH
public static final IntervalType SQL_INTERVAL_YEAR_TO_MONTH
-
SQL_INTERVAL_DAY_TO_HOUR
public static final IntervalType SQL_INTERVAL_DAY_TO_HOUR
-
SQL_INTERVAL_DAY_TO_MINUTE
public static final IntervalType SQL_INTERVAL_DAY_TO_MINUTE
-
SQL_INTERVAL_DAY_TO_SECOND
public static final IntervalType SQL_INTERVAL_DAY_TO_SECOND
-
SQL_INTERVAL_HOUR_TO_MINUTE
public static final IntervalType SQL_INTERVAL_HOUR_TO_MINUTE
-
SQL_INTERVAL_HOUR_TO_SECOND
public static final IntervalType SQL_INTERVAL_HOUR_TO_SECOND
-
SQL_INTERVAL_MINUTE_TO_SECOND
public static final IntervalType SQL_INTERVAL_MINUTE_TO_SECOND
-
SQL_INTERVAL_YEAR_MAX_PRECISION
public static final IntervalType SQL_INTERVAL_YEAR_MAX_PRECISION
-
SQL_INTERVAL_MONTH_MAX_PRECISION
public static final IntervalType SQL_INTERVAL_MONTH_MAX_PRECISION
-
SQL_INTERVAL_DAY_MAX_PRECISION
public static final IntervalType SQL_INTERVAL_DAY_MAX_PRECISION
-
SQL_INTERVAL_HOUR_MAX_PRECISION
public static final IntervalType SQL_INTERVAL_HOUR_MAX_PRECISION
-
SQL_INTERVAL_MINUTE_MAX_PRECISION
public static final IntervalType SQL_INTERVAL_MINUTE_MAX_PRECISION
-
SQL_INTERVAL_SECOND_MAX_PRECISION
public static final IntervalType SQL_INTERVAL_SECOND_MAX_PRECISION
-
SQL_INTERVAL_SECOND_MAX_FRACTION_MAX_PRECISION
public static final IntervalType SQL_INTERVAL_SECOND_MAX_FRACTION_MAX_PRECISION
-
SQL_INTERVAL_YEAR_TO_MONTH_MAX_PRECISION
public static final IntervalType SQL_INTERVAL_YEAR_TO_MONTH_MAX_PRECISION
-
SQL_INTERVAL_DAY_TO_SECOND_MAX_PRECISION
public static final IntervalType SQL_INTERVAL_DAY_TO_SECOND_MAX_PRECISION
-
SQL_ARRAY_ALL_TYPES
public static final ArrayType SQL_ARRAY_ALL_TYPES
-
typeAliases
public static final IntValueHashMap typeAliases
-
typeNames
public static final IntValueHashMap typeNames
-
jdbcConvertTypes
public static final IntKeyHashMap jdbcConvertTypes
-
-
Method Detail
-
getType
public final int getType()
- Specified by:
getTypein interfaceSchemaObject
-
getName
public final HsqlNameManager.HsqlName getName()
- Specified by:
getNamein interfaceSchemaObject
-
getCatalogName
public final HsqlNameManager.HsqlName getCatalogName()
- Specified by:
getCatalogNamein interfaceSchemaObject
-
getSchemaName
public final HsqlNameManager.HsqlName getSchemaName()
- Specified by:
getSchemaNamein interfaceSchemaObject
-
getOwner
public final Grantee getOwner()
- Specified by:
getOwnerin interfaceSchemaObject
-
getReferences
public final OrderedHashSet getReferences()
- Specified by:
getReferencesin interfaceSchemaObject
-
getComponents
public final OrderedHashSet getComponents()
- Specified by:
getComponentsin interfaceSchemaObject
-
compile
public final void compile(Session session, SchemaObject parentObject)
- Specified by:
compilein interfaceSchemaObject
-
getSQL
public java.lang.String getSQL()
Retrieves the SQL character sequence required to (re)create the trigger, as a StringBuffer- Specified by:
getSQLin interfaceSchemaObject- Returns:
- the SQL character sequence required to (re)create the trigger
-
getChangeTimestamp
public long getChangeTimestamp()
- Specified by:
getChangeTimestampin interfaceSchemaObject
-
duplicate
public Type duplicate()
-
displaySize
public abstract int displaySize()
-
getJDBCTypeCode
public abstract int getJDBCTypeCode()
Returns the JDBC type number of type, if it exists, otherwise the HSQLDB / SQL type.
-
getJDBCClassName
public abstract java.lang.String getJDBCClassName()
Returns the JDBC class name of type, if it exists, otherwise the HSQLDB class name.
-
getJDBCClass
public abstract java.lang.Class getJDBCClass()
-
getJDBCScale
public int getJDBCScale()
-
getJDBCPrecision
public int getJDBCPrecision()
-
getSQLGenericTypeCode
public int getSQLGenericTypeCode()
Returns the generic SQL CLI type number of type, if it exists, otherwise the HSQLDB type. The generic type is returned for DATETIME and INTERVAL types.
-
getNameString
public abstract java.lang.String getNameString()
Returns the name of the type
-
getFullNameString
public java.lang.String getFullNameString()
Returns the name of the type
-
getDefinition
public abstract java.lang.String getDefinition()
Returns the full definition of the type, including parameters
-
getCollation
public Collation getCollation()
-
getCharacterSet
public Charset getCharacterSet()
-
getTypeDefinition
public final java.lang.String getTypeDefinition()
-
compare
public abstract int compare(Session session, java.lang.Object a, java.lang.Object b)
-
compare
public int compare(Session session, java.lang.Object a, java.lang.Object b, int opType)
-
compare
public int compare(Session session, java.lang.Object a, java.lang.Object b, SortAndSlice sort)
-
convertToTypeLimits
public abstract java.lang.Object convertToTypeLimits(SessionInterface session, java.lang.Object a)
-
castToType
public java.lang.Object castToType(SessionInterface session, java.lang.Object a, Type type)
Explicit casts are handled by this method. SQL standard 6.12 rules for enforcement of size, precision and scale are implemented. For CHARACTER values, it performs truncation in all cases of long strings.
-
convertToType
public abstract java.lang.Object convertToType(SessionInterface session, java.lang.Object a, Type type)
Same as castToType except for CHARACTER values. Perform string truncation of trailing spaces only. For other long strings, it raises an exception.
-
convertToTypeJDBC
public java.lang.Object convertToTypeJDBC(SessionInterface session, java.lang.Object a, Type otherType)
Convert type for JDBC reads. Same as convertToType, but supports non-standard SQL conversions supported by JDBC
-
convertJavaToSQL
public java.lang.Object convertJavaToSQL(SessionInterface session, java.lang.Object a)
-
convertSQLToJava
public java.lang.Object convertSQLToJava(SessionInterface session, java.lang.Object a)
-
convertToDefaultType
public abstract java.lang.Object convertToDefaultType(SessionInterface sessionInterface, java.lang.Object o)
Converts the object to the given type without limit checks. Used for JDBC writes.
-
convertToString
public abstract java.lang.String convertToString(java.lang.Object a)
-
convertToSQLString
public abstract java.lang.String convertToSQLString(java.lang.Object a)
-
canConvertFrom
public abstract boolean canConvertFrom(Type otherType)
-
canMoveFrom
public int canMoveFrom(Type otherType)
Can convert without changing the object- Returns:
- 0 always, 1 range check required, -1 never
-
canBeAssignedFrom
public boolean canBeAssignedFrom(Type otherType)
-
arrayLimitCardinality
public int arrayLimitCardinality()
-
collectionBaseType
public Type collectionBaseType()
-
isArrayType
public boolean isArrayType()
-
isMultisetType
public boolean isMultisetType()
-
isRowType
public boolean isRowType()
-
isStructuredType
public boolean isStructuredType()
-
isCharacterType
public boolean isCharacterType()
-
isNumberType
public boolean isNumberType()
-
isIntegralType
public boolean isIntegralType()
-
isExactNumberType
public boolean isExactNumberType()
-
isDecimalType
public boolean isDecimalType()
-
isDateTimeType
public boolean isDateTimeType()
-
isDateTimeTypeWithZone
public boolean isDateTimeTypeWithZone()
-
isDateOrTimestampType
public boolean isDateOrTimestampType()
-
isIntervalType
public boolean isIntervalType()
-
isBinaryType
public boolean isBinaryType()
-
isBooleanType
public boolean isBooleanType()
-
isLobType
public boolean isLobType()
-
isBitType
public boolean isBitType()
-
isObjectType
public boolean isObjectType()
-
isDistinctType
public boolean isDistinctType()
-
isDomainType
public boolean isDomainType()
-
acceptsPrecision
public boolean acceptsPrecision()
-
requiresPrecision
public boolean requiresPrecision()
-
getMaxPrecision
public long getMaxPrecision()
-
getMaxScale
public int getMaxScale()
-
getPrecisionRadix
public int getPrecisionRadix()
-
acceptsFractionalPrecision
public boolean acceptsFractionalPrecision()
-
acceptsScale
public boolean acceptsScale()
-
precedenceDegree
public int precedenceDegree(Type other)
-
getAggregateType
public abstract Type getAggregateType(Type other)
Common type used in comparison opertions. other must be comparable with this.
-
getCombinedType
public abstract Type getCombinedType(Session session, Type other, int operation)
Result type of combining values of two types in different opertions. other type is not allways comparable with this, but a operation should be valid without any explicit CAST
-
compareToTypeRange
public int compareToTypeRange(java.lang.Object o)
-
absolute
public java.lang.Object absolute(java.lang.Object a)
All arithmetic ops are called on the pre-determined Type object of the result
-
negate
public java.lang.Object negate(java.lang.Object a)
-
add
public java.lang.Object add(Session session, java.lang.Object a, java.lang.Object b, Type otherType)
-
subtract
public java.lang.Object subtract(Session session, java.lang.Object a, java.lang.Object b, Type otherType)
-
multiply
public java.lang.Object multiply(java.lang.Object a, java.lang.Object b)
-
divide
public java.lang.Object divide(Session session, java.lang.Object a, java.lang.Object b)
-
concat
public java.lang.Object concat(Session session, java.lang.Object a, java.lang.Object b)
-
cardinality
public int cardinality(Session session, java.lang.Object a)
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
newComparator
public static Type.TypedComparator newComparator(Session session)
-
getDefaultArrayType
public static ArrayType getDefaultArrayType(int type)
-
getDefaultType
public static Type getDefaultType(int type)
-
getDefaultTypeWithSize
public static Type getDefaultTypeWithSize(int type)
-
getHSQLDBTypeCode
public static int getHSQLDBTypeCode(int jdbcTypeNumber)
-
getJDBCTypeCode
public static int getJDBCTypeCode(int type)
translate an internal type number to JDBC type number if a type is not supported internally, it is returned without translation- Parameters:
type- int- Returns:
- int
-
getType
public static Type getType(int type, Charset charset, Collation collation, long precision, int scale)
Enforces precision and scale limits on type
-
getTypeNr
public static int getTypeNr(java.lang.String name)
-
getTypeForJDBCConvertToken
public static Type getTypeForJDBCConvertToken(int name)
-
isSupportedSQLType
public static boolean isSupportedSQLType(int typeNumber)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG