org.eigenbase.sql.type
Class IntervalSqlType

java.lang.Object
  extended by org.eigenbase.reltype.RelDataTypeImpl
      extended by org.eigenbase.sql.type.AbstractSqlType
          extended by org.eigenbase.sql.type.IntervalSqlType
All Implemented Interfaces:
Serializable, Cloneable, RelDataType, RelDataTypeFamily

public class IntervalSqlType
extends AbstractSqlType

IntervalSqlType represents a standard SQL datetime interval type.

Version:
$Id: //open/dev/farrago/src/org/eigenbase/sql/type/IntervalSqlType.java#16 $
Author:
wael
See Also:
Serialized Form

Field Summary
private  SqlIntervalQualifier intervalQualifier
           
 
Fields inherited from class org.eigenbase.sql.type.AbstractSqlType
isNullable, typeName
 
Fields inherited from class org.eigenbase.reltype.RelDataTypeImpl
digest, fieldList, fields
 
Constructor Summary
IntervalSqlType(SqlIntervalQualifier intervalQualifier, boolean isNullable)
          Constructs an IntervalSqlType.
 
Method Summary
 IntervalSqlType combine(RelDataTypeFactoryImpl typeFactory, IntervalSqlType that)
          Combines two IntervalTypes and returns the result.
protected  void generateTypeString(StringBuilder sb, boolean withDetail)
          Generates a string representation of this type.
 SqlIntervalQualifier getIntervalQualifier()
          Gets this type's interval qualifier, or null if this is not an interval type.
 int getPrecision()
          Gets the JDBC-defined precision for values of this type.
 
Methods inherited from class org.eigenbase.sql.type.AbstractSqlType
getFamily, getPrecedenceList, getSqlTypeName, isNullable
 
Methods inherited from class org.eigenbase.reltype.RelDataTypeImpl
computeDigest, equals, getCharset, getCollation, getComparability, getComponentType, getField, getFieldCount, getFieldList, getFieldOrdinal, getFields, getFullTypeString, getScale, getSqlIdentifier, hashCode, isStruct, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

intervalQualifier

private SqlIntervalQualifier intervalQualifier
Constructor Detail

IntervalSqlType

public IntervalSqlType(SqlIntervalQualifier intervalQualifier,
                       boolean isNullable)
Constructs an IntervalSqlType. This should only be called from a factory method.

Method Detail

generateTypeString

protected void generateTypeString(StringBuilder sb,
                                  boolean withDetail)
Description copied from class: RelDataTypeImpl
Generates a string representation of this type.

Specified by:
generateTypeString in class RelDataTypeImpl
Parameters:
sb - StringBuffer into which to generate the string
withDetail - when true, all detail information needed to compute a unique digest (and return from getFullTypeString) should be included;

getIntervalQualifier

public SqlIntervalQualifier getIntervalQualifier()
Description copied from interface: RelDataType
Gets this type's interval qualifier, or null if this is not an interval type.

Specified by:
getIntervalQualifier in interface RelDataType
Overrides:
getIntervalQualifier in class RelDataTypeImpl
Returns:
interval qualifier

combine

public IntervalSqlType combine(RelDataTypeFactoryImpl typeFactory,
                               IntervalSqlType that)
Combines two IntervalTypes and returns the result. E.g. the result of combining
INTERVAL DAY TO HOUR
with
INTERVAL SECOND is
INTERVAL DAY TO SECOND


getPrecision

public int getPrecision()
Description copied from interface: RelDataType
Gets the JDBC-defined precision for values of this type. Note that this is not always the same as the user-specified precision. For example, the type INTEGER has no user-specified precision, but this method returns 10 for an INTEGER type.

Specified by:
getPrecision in interface RelDataType
Overrides:
getPrecision in class RelDataTypeImpl
Returns:
number of decimal digits for exact numeric types; number of decimal digits in mantissa for approximate numeric types; number of decimal digits for fractional seconds of datetime types; length in characters for character types; length in bytes for binary types; length in bits for bit types; 1 for BOOLEAN