Top Description Fields Constructors Methods
org.hsqldb.types

public final Class IntervalType

extends DTIType
Class Inheritance
Imports
java.math.BigDecimal, java.time.Duration, .Period, org.hsqldb.OpTypes, .Session, .SessionInterface, .Tokens, org.hsqldb.error.Error, .ErrorCode, org.hsqldb.lib.ArrayUtil

Type subclass for various types of INTERVAL.

Author
Fred Toussi (fredt@users dot sourceforge.net)
Since
1.9.0
Version
2.7.3

Field Summary

Modifier and TypeField and Description
public final boolean
public static final NumberType
public final boolean
Inherited from org.hsqldb.types.DTIType:
defaultIntervalFractionPrecisiondefaultIntervalPrecisiondefaultTimeFractionPrecisiondefaultTimestampFractionPrecisionendIntervalTypeendPartIndexINTERVAL_FRACTION_PART_INDEXINTERVAL_MONTH_INDEXINTERVAL_SECOND_INDEXintervalIndexMapintervalPartsintervalTypeslimitNanosecondsmaxFractionPrecisionmaxIntervalPrecisionmaxIntervalSecondPrecisionmillisInSecondnanoScaleFactorsnanosInMillinanosInSecondprecisionFactorsprecisionLimitssecondsInDaystartIntervalTypestartPartIndextimezoneSecondsLimityearToSecondFactorsyearToSecondLimitsyearToSecondSeparators

Constructor Summary

AccessConstructor and Description
private
IntervalType(int typeGroup, int type, long precision, int scale, int startIntervalType, int endIntervalType, boolean defaultPrecision)

Method Summary

Modifier and TypeMethod and Description
public Object
absolute(Object a)

Overrides org.hsqldb.types.Type.absolute.

All arithmetic ops are called on the pre-determined Type object of the result

public boolean
public boolean
public Object
add(Session session, Object a, Object b, Type otherType)

Overrides org.hsqldb.types.Type.add.

public boolean
public int
canMoveFrom(Type otherType)

Overrides org.hsqldb.types.Type.canMoveFrom.

When canConvertFrom() is true, can convert without changing the object

public int
compare(Session session, Object a, Object b)

Implements abstract org.hsqldb.types.Type.compare.

public int
public Object
convertFromDouble(double value)

pack-priv Object
public Object
public Object
public Object
convertToDefaultType(SessionInterface session, Object a)

Implements abstract org.hsqldb.types.Type.convertToDefaultType.

Converts the object to the given type without limit checks.

public static double
public double
public void
public long
public String
public String
public Object
convertToType(SessionInterface session, Object a, Type otherType)

Implements abstract org.hsqldb.types.Type.convertToType.

Same as castToType except for CHARACTER values.

public Object
public int
public Object
public Type
getAggregateType(Type other)

Implements abstract org.hsqldb.types.Type.getAggregateType.

Common type used in comparison operations.

public CharacterType
public static Type
public static int
getCombinedIntervalType(int startType, int endType)

public Type
getCombinedType(Session session, Type other, int operation)

Implements abstract org.hsqldb.types.Type.getCombinedType.

Result type of combining values of two types in different operations.

public String
getDefinition()

Implements abstract org.hsqldb.types.Type.getDefinition.

Returns the full definition of the type, including parameters

public static int
public static IntervalType
getIntervalType(IntervalType type, long precision, int fractionalPrecision)

public static IntervalType
getIntervalType(int type, long precision, int fractionPrecision)

public static IntervalType
getIntervalType(int startIndex, int endIndex, long precision, int fractionPrecision)

public static IntervalType
getIntervalType(int type, int startType, int endType, long precision, int fractionPrecision, boolean defaultPrecision)

public static int
pack-priv long
public Class<T>
public String
getJDBCClassName()

Implements abstract org.hsqldb.types.Type.getJDBCClassName.

Returns the JDBC class name of type, if it exists, otherwise the HSQLDB class name.

public int
public int
getJDBCTypeCode()

Implements abstract org.hsqldb.types.Type.getJDBCTypeCode.

Returns the JDBC type number of type, if it exists, otherwise the HSQLDB / SQL type.

public String
getNameString()

Implements abstract org.hsqldb.types.Type.getNameString.

Returns the name of the type

public int
getPart(Session session, Object interval, int part)

Implements abstract org.hsqldb.types.DTIType.getPart.

public static String
getQualifier(int type)

public BigDecimal
getSecondPart(Session session, Object interval)

Implements abstract org.hsqldb.types.DTIType.getSecondPart.

public long
getSeconds(Object interval)

public int
getSQLGenericTypeCode()

Overrides org.hsqldb.types.Type.getSQLGenericTypeCode.

Returns the generic SQL CLI type number of type, if it exists, otherwise the HSQLDB type.

public static int
public Object
getValue(long units, int nanos)

pack-priv String
pack-priv String
public boolean
public boolean
public boolean
public boolean
public Object
private Object
multiplyOrDivide(Object a, Object b, boolean divide)

public Object
public static IntervalType
newIntervalType(int type, long precision, int fractionPrecision)

public int
public Object
subtract(Session session, Object a, Object b, Type otherType)

Overrides org.hsqldb.types.Type.subtract.

private IntervalSecondData
subtract(Session session, long aSeconds, long bSeconds, long nanos)

Inherited from org.hsqldb.types.DTIType:
getEndIntervalTypegetExtractTypegetFieldNameTokenForTypegetFieldNameTypeForTokengetPrecisionExponentgetSecondPartgetStartIntervalTypeintervalSecondToStringisValidDatetimeRangenormaliseFractionnormaliseFraction

Field Detail

defaultPrecisionback to summary
public final boolean defaultPrecision
factorTypeback to summary
public static final NumberType factorType
isYearMonthback to summary
public final boolean isYearMonth

Constructor Detail

IntervalTypeback to summary
private IntervalType(int typeGroup, int type, long precision, int scale, int startIntervalType, int endIntervalType, boolean defaultPrecision)

Method Detail

absoluteback to summary
public Object absolute(Object a)

Overrides org.hsqldb.types.Type.absolute.

Doc from org.hsqldb.types.Type.absolute.

All arithmetic ops are called on the pre-determined Type object of the result

acceptsFractionalPrecisionback to summary
public boolean acceptsFractionalPrecision()

Overrides org.hsqldb.types.Type.acceptsFractionalPrecision.

acceptsPrecisionback to summary
public boolean acceptsPrecision()

Overrides org.hsqldb.types.Type.acceptsPrecision.

addback to summary
public Object add(Session session, Object a, Object b, Type otherType)

Overrides org.hsqldb.types.Type.add.

canConvertFromback to summary
public boolean canConvertFrom(Type otherType)

Implements abstract org.hsqldb.types.Type.canConvertFrom.

canMoveFromback to summary
public int canMoveFrom(Type otherType)

Overrides org.hsqldb.types.Type.canMoveFrom.

Doc from org.hsqldb.types.Type.canMoveFrom.

When canConvertFrom() is true, can convert without changing the object

compareback to summary
public int compare(Session session, Object a, Object b)

Implements abstract org.hsqldb.types.Type.compare.

compareToTypeRangeback to summary
public int compareToTypeRange(Object o)

Overrides org.hsqldb.types.Type.compareToTypeRange.

convertFromDoubleback to summary
public Object convertFromDouble(double value)
convertJavaTimeObjectback to summary
pack-priv Object convertJavaTimeObject(SessionInterface session, Object a)
convertJavaToSQLback to summary
public Object convertJavaToSQL(SessionInterface session, Object a)

Overrides org.hsqldb.types.Type.convertJavaToSQL.

convertSQLToJavaback to summary
public Object convertSQLToJava(SessionInterface session, Object a)

Overrides org.hsqldb.types.Type.convertSQLToJava.

convertToDefaultTypeback to summary
public Object convertToDefaultType(SessionInterface session, Object a)

Implements abstract org.hsqldb.types.Type.convertToDefaultType.

Doc from org.hsqldb.types.Type.convertToDefaultType.

Converts the object to the given type without limit checks. Used for JDBC writes.

convertToDoubleback to summary
public static double convertToDouble(Object interval)
convertToDoubleStartUnitsback to summary
public double convertToDoubleStartUnits(Object interval)
convertToJSONback to summary
public void convertToJSON(Object a, StringBuilder sb)

Overrides org.hsqldb.types.Type.convertToJSON.

convertToLongEndUnitsback to summary
public long convertToLongEndUnits(Object interval)
convertToSQLStringback to summary
public String convertToSQLString(Object a)

Implements abstract org.hsqldb.types.Type.convertToSQLString.

convertToStringback to summary
public String convertToString(Object a)

Implements abstract org.hsqldb.types.Type.convertToString.

convertToTypeback to summary
public Object convertToType(SessionInterface session, Object a, Type otherType)

Implements abstract org.hsqldb.types.Type.convertToType.

Doc from org.hsqldb.types.Type.convertToType.

Same as castToType except for CHARACTER values. Perform string truncation of trailing spaces only. For other long strings, it raises an exception.

convertToTypeLimitsback to summary
public Object convertToTypeLimits(SessionInterface session, Object a)

Implements abstract org.hsqldb.types.Type.convertToTypeLimits.

displaySizeback to summary
public int displaySize()

Implements abstract org.hsqldb.types.Type.displaySize.

divideback to summary
public Object divide(Session session, Object a, Object b)

Overrides org.hsqldb.types.Type.divide.

getAggregateTypeback to summary
public Type getAggregateType(Type other)

Implements abstract org.hsqldb.types.Type.getAggregateType.

Doc from org.hsqldb.types.Type.getAggregateType.

Common type used in comparison operations. other must be comparable with this.

getCharacterTypeback to summary
public CharacterType getCharacterType()
getCombinedIntervalTypeback to summary
public static Type getCombinedIntervalType(IntervalType type1, IntervalType type2)
getCombinedIntervalTypeback to summary
public static int getCombinedIntervalType(int startType, int endType)
getCombinedTypeback to summary
public Type getCombinedType(Session session, Type other, int operation)

Implements abstract org.hsqldb.types.Type.getCombinedType.

Doc from org.hsqldb.types.Type.getCombinedType.

Result type of combining values of two types in different operations. The other type is not always comparable with this, but an operation should be valid without any explicit CAST

getDefinitionback to summary
public String getDefinition()

Implements abstract org.hsqldb.types.Type.getDefinition.

Doc from org.hsqldb.types.Type.getDefinition.

Returns the full definition of the type, including parameters

getEndIntervalTypeback to summary
public static int getEndIntervalType(int type)
getIntervalTypeback to summary
public static IntervalType getIntervalType(IntervalType type, long precision, int fractionalPrecision)
getIntervalTypeback to summary
public static IntervalType getIntervalType(int type, long precision, int fractionPrecision)
getIntervalTypeback to summary
public static IntervalType getIntervalType(int startIndex, int endIndex, long precision, int fractionPrecision)
getIntervalTypeback to summary
public static IntervalType getIntervalType(int type, int startType, int endType, long precision, int fractionPrecision, boolean defaultPrecision)
getIntervalTypeback to summary
public static int getIntervalType(String part)
getIntervalValueLimitback to summary
pack-priv long getIntervalValueLimit()
getJDBCClassback to summary
public Class<T> getJDBCClass()

Implements abstract org.hsqldb.types.Type.getJDBCClass.

getJDBCClassNameback to summary
public String getJDBCClassName()

Implements abstract org.hsqldb.types.Type.getJDBCClassName.

Doc from org.hsqldb.types.Type.getJDBCClassName.

Returns the JDBC class name of type, if it exists, otherwise the HSQLDB class name.

getJDBCPrecisionback to summary
public int getJDBCPrecision()

Overrides org.hsqldb.types.Type.getJDBCPrecision.

getJDBCTypeCodeback to summary
public int getJDBCTypeCode()

Implements abstract org.hsqldb.types.Type.getJDBCTypeCode.

Doc from org.hsqldb.types.Type.getJDBCTypeCode.

Returns the JDBC type number of type, if it exists, otherwise the HSQLDB / SQL type.

getNameStringback to summary
public String getNameString()

Implements abstract org.hsqldb.types.Type.getNameString.

Doc from org.hsqldb.types.Type.getNameString.

Returns the name of the type

getPartback to summary
public int getPart(Session session, Object interval, int part)

Implements abstract org.hsqldb.types.DTIType.getPart.

getQualifierback to summary
public static String getQualifier(int type)
getSecondPartback to summary
public BigDecimal getSecondPart(Session session, Object interval)

Implements abstract org.hsqldb.types.DTIType.getSecondPart.

getSecondsback to summary
public long getSeconds(Object interval)
getSQLGenericTypeCodeback to summary
public int getSQLGenericTypeCode()

Overrides org.hsqldb.types.Type.getSQLGenericTypeCode.

Doc from org.hsqldb.types.Type.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.

getStartIntervalTypeback to summary
public static int getStartIntervalType(int type)
getValueback to summary
public Object getValue(long units, int nanos)
intervalMonthToStringback to summary
pack-priv String intervalMonthToString(Object a)
intervalSecondToStringback to summary
pack-priv String intervalSecondToString(Object a)
isIntervalDaySecondTypeback to summary
public boolean isIntervalDaySecondType()

Overrides org.hsqldb.types.Type.isIntervalDaySecondType.

isIntervalTypeback to summary
public boolean isIntervalType()

Overrides org.hsqldb.types.Type.isIntervalType.

isIntervalYearMonthTypeback to summary
public boolean isIntervalYearMonthType()

Overrides org.hsqldb.types.Type.isIntervalYearMonthType.

isNegativeback to summary
public boolean isNegative(Object a)

Overrides org.hsqldb.types.Type.isNegative.

multiplyback to summary
public Object multiply(Object a, Object b)

Overrides org.hsqldb.types.Type.multiply.

multiplyOrDivideback to summary
private Object multiplyOrDivide(Object a, Object b, boolean divide)
negateback to summary
public Object negate(Object a)

Overrides org.hsqldb.types.Type.negate.

newIntervalTypeback to summary
public static IntervalType newIntervalType(int type, long precision, int fractionPrecision)
precedenceDegreeback to summary
public int precedenceDegree(Type other)

Overrides org.hsqldb.types.Type.precedenceDegree.

subtractback to summary
public Object subtract(Session session, Object a, Object b, Type otherType)

Overrides org.hsqldb.types.Type.subtract.

subtractback to summary
private IntervalSecondData subtract(Session session, long aSeconds, long bSeconds, long nanos)