org.hsqldb.types
Class DateTimeType
- java.lang.Object
-
- org.hsqldb.types.Type
-
- org.hsqldb.types.DTIType
-
- org.hsqldb.types.DateTimeType
-
- All Implemented Interfaces:
- java.lang.Cloneable, SchemaObject
public final class DateTimeType extends DTIType
Type subclass for DATE, TIME and TIMESTAMP.- Since:
- 1.9.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.hsqldb.types.Type
Type.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 Modifier and Type Field and Description static longepochSecondsstatic TimestampDataepochTimestampbooleanwithTimeZone-
Fields inherited from class org.hsqldb.types.DTIType
DAY_NAME, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_YEAR, defaultIntervalFractionPrecision, defaultIntervalPrecision, defaultTimeFractionPrecision, defaultTimestampFractionPrecision, endIntervalType, endPartIndex, INTERVAL_FRACTION_PART_INDEX, INTERVAL_MONTH_INDEX, INTERVAL_SECOND_INDEX, ISO_YEAR, limitNanoseconds, maxFractionPrecision, maxIntervalPrecision, maxIntervalSecondPrecision, MONTH_NAME, nanoScaleFactors, precisionFactors, precisionLimits, QUARTER, SECONDS_MIDNIGHT, startIntervalType, startPartIndex, TIMEZONE_HOUR, TIMEZONE_MINUTE, timezoneSecondsLimit, WEEK_OF_YEAR, yearToSecondFactors, yearToSecondLimits, yearToSecondSeparators
-
Fields inherited from class org.hsqldb.types.Type
emptyArray, jdbcConvertTypes, OTHER, precision, scale, SQL_ALL_TYPES, SQL_ARRAY_ALL_TYPES, SQL_BIGINT, SQL_BINARY, SQL_BINARY_16, SQL_BINARY_DEFAULT, SQL_BIT, SQL_BIT_VARYING, SQL_BIT_VARYING_MAX_LENGTH, SQL_BLOB, SQL_BOOLEAN, SQL_CHAR, SQL_CHAR_16, SQL_CHAR_DEFAULT, SQL_CLOB, SQL_DATE, SQL_DECIMAL, SQL_DECIMAL_BIGINT_SQR, SQL_DECIMAL_DEFAULT, SQL_DOUBLE, SQL_INTEGER, SQL_INTERVAL_DAY, SQL_INTERVAL_DAY_MAX_PRECISION, SQL_INTERVAL_DAY_TO_HOUR, SQL_INTERVAL_DAY_TO_MINUTE, SQL_INTERVAL_DAY_TO_SECOND, SQL_INTERVAL_DAY_TO_SECOND_MAX_PRECISION, SQL_INTERVAL_HOUR, SQL_INTERVAL_HOUR_MAX_PRECISION, SQL_INTERVAL_HOUR_TO_MINUTE, SQL_INTERVAL_HOUR_TO_SECOND, SQL_INTERVAL_MINUTE, SQL_INTERVAL_MINUTE_MAX_PRECISION, SQL_INTERVAL_MINUTE_TO_SECOND, SQL_INTERVAL_MONTH, SQL_INTERVAL_MONTH_MAX_PRECISION, SQL_INTERVAL_SECOND, SQL_INTERVAL_SECOND_MAX_FRACTION, SQL_INTERVAL_SECOND_MAX_FRACTION_MAX_PRECISION, SQL_INTERVAL_SECOND_MAX_PRECISION, SQL_INTERVAL_YEAR, SQL_INTERVAL_YEAR_MAX_PRECISION, SQL_INTERVAL_YEAR_TO_MONTH, SQL_INTERVAL_YEAR_TO_MONTH_MAX_PRECISION, SQL_NUMERIC, SQL_SMALLINT, SQL_TIME, SQL_TIME_WITH_TIME_ZONE, SQL_TIMESTAMP, SQL_TIMESTAMP_NO_FRACTION, SQL_TIMESTAMP_WITH_TIME_ZONE, SQL_VARBINARY, SQL_VARBINARY_DEFAULT, SQL_VARCHAR, SQL_VARCHAR_DEFAULT, TINYINT, typeAliases, typeCode, typeComparisonGroup, typeDataGroup, typeNames, userTypeModifier
-
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
-
-
Constructor Summary
Constructors Constructor and Description DateTimeType(int typeGroup, int type, int scale)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanacceptsFractionalPrecision()java.lang.Objectadd(Session session, java.lang.Object a, java.lang.Object b, Type otherType)static TimestampDataaddMonths(Session session, TimestampData source, int months)java.lang.ObjectaddMonthsSpecial(Session session, java.lang.Object dateTime, int months)static TimeDataaddSeconds(TimeData source, long seconds, int nanos)static TimestampDataaddSeconds(TimestampData source, long seconds, int nanos)booleancanAdd(IntervalType other)booleancanConvertFrom(Type otherType)intcanMoveFrom(Type otherType)Can convert without changing the objectjava.lang.ObjectchangeZone(java.lang.Object a, Type otherType, int targetZone, int localZone)intcompare(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)java.lang.ObjectconvertSQLToJavaGMT(SessionInterface session, java.lang.Object a)static TimestampDataconvertToDatetimeSpecial(SessionInterface session, java.lang.String s, DateTimeType type)java.lang.ObjectconvertToDefaultType(SessionInterface session, java.lang.Object a)Converts the object to the given type without limit checks.java.lang.StringconvertToSQLString(java.lang.Object a)java.lang.StringconvertToString(java.lang.Object a)java.lang.ObjectconvertToType(SessionInterface session, java.lang.Object a, Type otherType)Same as castToType except for CHARACTER values.java.lang.ObjectconvertToTypeLimits(SessionInterface session, java.lang.Object a)intdisplaySize()booleanequals(java.lang.Object other)TypegetAggregateType(Type other)Common type used in comparison opertions.TypegetCombinedType(Session session, Type other, int operation)Result type of combining values of two types in different opertions.static DateTimeTypegetDateTimeType(int type, int scale)DateTimeTypegetDateTimeTypeWithoutZone()java.lang.StringgetDefinition()Returns the full definition of the type, including parametersjava.lang.ClassgetJDBCClass()java.lang.StringgetJDBCClassName()Returns the JDBC class name of type, if it exists, otherwise the HSQLDB class name.intgetJDBCPrecision()intgetJDBCTypeCode()Returns the JDBC type number of type, if it exists, otherwise the HSQLDB / SQL type.java.lang.ObjectgetLastDayOfMonth(Session session, java.lang.Object dateTime)java.lang.StringgetNameString()Returns the name of the typeintgetPart(Session session, java.lang.Object dateTime, int part)java.lang.StringgetPartString(Session session, java.lang.Object dateTime, int part)java.math.BigDecimalgetSecondPart(java.lang.Object dateTime)intgetSqlDateTimeSub()intgetSQLGenericTypeCode()Returns the generic SQL CLI type number of type, if it exists, otherwise the HSQLDB type.java.lang.ObjectgetValue(long seconds, int nanos, int zoneSeconds)booleanisDateOrTimestampType()booleanisDateTimeType()booleanisDateTimeTypeWithZone()static intnormaliseTime(int seconds)static java.lang.Booleanoverlaps(Session session, java.lang.Object[] a, Type[] ta, java.lang.Object[] b, Type[] tb)java.lang.Objectround(java.lang.Object a, int part)java.lang.Objectsubtract(Session session, java.lang.Object a, java.lang.Object b, Type otherType)static intsubtractMonths(TimestampData a, TimestampData b, boolean isYear)static java.math.BigDecimalsubtractMonthsSpecial(Session session, TimestampData a, TimestampData b)java.lang.Objecttruncate(java.lang.Object a, int part)-
Methods inherited from class org.hsqldb.types.DTIType
getEndIntervalType, getExtractType, getFieldNameTokenForType, getFieldNameTypeForToken, getStartIntervalType, isValidDatetimeRange, normaliseFraction
-
Methods inherited from class org.hsqldb.types.Type
absolute, acceptsPrecision, acceptsScale, arrayLimitCardinality, canBeAssignedFrom, cardinality, castToType, collectionBaseType, compare, compare, compareToTypeRange, compile, concat, convertToTypeJDBC, divide, duplicate, getAggregateType, getCatalogName, getChangeTimestamp, getCharacterSet, getCollation, getComponents, getDefaultArrayType, getDefaultType, getDefaultTypeWithSize, getFullNameString, getHSQLDBTypeCode, getJDBCScale, getJDBCTypeCode, getMaxPrecision, getMaxScale, getName, getOwner, getPrecisionRadix, getReferences, getSchemaName, getSQL, getType, getType, getType, getTypeDefinition, getTypeForJDBCConvertToken, getTypeNr, hashCode, isArrayType, isBinaryType, isBitType, isBooleanType, isCharacterType, isDecimalType, isDistinctType, isDomainType, isExactNumberType, isIntegralType, isIntervalType, isLobType, isMultisetType, isNumberType, isObjectType, isRowType, isStructuredType, isSupportedSQLType, matches, multiply, negate, newComparator, precedenceDegree, requiresPrecision
-
-
-
-
Field Detail
-
withTimeZone
public final boolean withTimeZone
-
epochSeconds
public static final long epochSeconds
-
epochTimestamp
public static final TimestampData epochTimestamp
-
-
Method Detail
-
displaySize
public int displaySize()
- Specified by:
displaySizein classType
-
getJDBCTypeCode
public int getJDBCTypeCode()
Description copied from class:TypeReturns the JDBC type number of type, if it exists, otherwise the HSQLDB / SQL type.- Specified by:
getJDBCTypeCodein classType
-
getJDBCClass
public java.lang.Class getJDBCClass()
- Specified by:
getJDBCClassin classType
-
getJDBCClassName
public java.lang.String getJDBCClassName()
Description copied from class:TypeReturns the JDBC class name of type, if it exists, otherwise the HSQLDB class name.- Specified by:
getJDBCClassNamein classType
-
getJDBCPrecision
public int getJDBCPrecision()
- Overrides:
getJDBCPrecisionin classType
-
getSQLGenericTypeCode
public int getSQLGenericTypeCode()
Description copied from class:TypeReturns 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.- Overrides:
getSQLGenericTypeCodein classType
-
getNameString
public java.lang.String getNameString()
Description copied from class:TypeReturns the name of the type- Specified by:
getNameStringin classType
-
getDefinition
public java.lang.String getDefinition()
Description copied from class:TypeReturns the full definition of the type, including parameters- Specified by:
getDefinitionin classType
-
isDateTimeType
public boolean isDateTimeType()
- Overrides:
isDateTimeTypein classType
-
isDateOrTimestampType
public boolean isDateOrTimestampType()
- Overrides:
isDateOrTimestampTypein classType
-
isDateTimeTypeWithZone
public boolean isDateTimeTypeWithZone()
- Overrides:
isDateTimeTypeWithZonein classType
-
acceptsFractionalPrecision
public boolean acceptsFractionalPrecision()
- Overrides:
acceptsFractionalPrecisionin classType
-
getAggregateType
public Type getAggregateType(Type other)
Description copied from class:TypeCommon type used in comparison opertions. other must be comparable with this.- Specified by:
getAggregateTypein classType
-
getCombinedType
public Type getCombinedType(Session session, Type other, int operation)
Description copied from class:TypeResult 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- Specified by:
getCombinedTypein classType
-
compare
public int compare(Session session, java.lang.Object a, java.lang.Object b)
-
convertToTypeLimits
public java.lang.Object convertToTypeLimits(SessionInterface session, java.lang.Object a)
- Specified by:
convertToTypeLimitsin classType
-
convertToType
public java.lang.Object convertToType(SessionInterface session, java.lang.Object a, Type otherType)
Description copied from class:TypeSame as castToType except for CHARACTER values. Perform string truncation of trailing spaces only. For other long strings, it raises an exception.- Specified by:
convertToTypein classType
-
convertToDefaultType
public java.lang.Object convertToDefaultType(SessionInterface session, java.lang.Object a)
Description copied from class:TypeConverts the object to the given type without limit checks. Used for JDBC writes.- Specified by:
convertToDefaultTypein classType
-
convertJavaToSQL
public java.lang.Object convertJavaToSQL(SessionInterface session, java.lang.Object a)
- Overrides:
convertJavaToSQLin classType
-
convertSQLToJavaGMT
public java.lang.Object convertSQLToJavaGMT(SessionInterface session, java.lang.Object a)
-
convertSQLToJava
public java.lang.Object convertSQLToJava(SessionInterface session, java.lang.Object a)
- Overrides:
convertSQLToJavain classType
-
normaliseTime
public static int normaliseTime(int seconds)
-
convertToString
public java.lang.String convertToString(java.lang.Object a)
- Specified by:
convertToStringin classType
-
convertToSQLString
public java.lang.String convertToSQLString(java.lang.Object a)
- Specified by:
convertToSQLStringin classType
-
canConvertFrom
public boolean canConvertFrom(Type otherType)
- Specified by:
canConvertFromin classType
-
canMoveFrom
public int canMoveFrom(Type otherType)
Description copied from class:TypeCan convert without changing the object- Overrides:
canMoveFromin classType- Returns:
- 0 always, 1 range check required, -1 never
-
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)
-
truncate
public java.lang.Object truncate(java.lang.Object a, int part)
-
round
public java.lang.Object round(java.lang.Object a, int part)
-
getPart
public int getPart(Session session, java.lang.Object dateTime, int part)
-
addMonthsSpecial
public java.lang.Object addMonthsSpecial(Session session, java.lang.Object dateTime, int months)
-
getLastDayOfMonth
public java.lang.Object getLastDayOfMonth(Session session, java.lang.Object dateTime)
-
getSecondPart
public java.math.BigDecimal getSecondPart(java.lang.Object dateTime)
- Specified by:
getSecondPartin classDTIType
-
getPartString
public java.lang.String getPartString(Session session, java.lang.Object dateTime, int part)
-
getValue
public java.lang.Object getValue(long seconds, int nanos, int zoneSeconds)
-
getDateTimeTypeWithoutZone
public DateTimeType getDateTimeTypeWithoutZone()
-
getDateTimeType
public static DateTimeType getDateTimeType(int type, int scale)
-
changeZone
public java.lang.Object changeZone(java.lang.Object a, Type otherType, int targetZone, int localZone)
-
canAdd
public boolean canAdd(IntervalType other)
-
getSqlDateTimeSub
public int getSqlDateTimeSub()
-
overlaps
public static java.lang.Boolean overlaps(Session session, java.lang.Object[] a, Type[] ta, java.lang.Object[] b, Type[] tb)
-
subtractMonthsSpecial
public static java.math.BigDecimal subtractMonthsSpecial(Session session, TimestampData a, TimestampData b)
-
subtractMonths
public static int subtractMonths(TimestampData a, TimestampData b, boolean isYear)
-
addMonths
public static TimestampData addMonths(Session session, TimestampData source, int months)
-
addSeconds
public static TimestampData addSeconds(TimestampData source, long seconds, int nanos)
-
convertToDatetimeSpecial
public static TimestampData convertToDatetimeSpecial(SessionInterface session, java.lang.String s, DateTimeType type)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG