com.akiban.sql.compiler
Class IntervalTypeCompiler

java.lang.Object
  extended by com.akiban.sql.compiler.TypeCompiler
      extended by com.akiban.sql.compiler.IntervalTypeCompiler

public class IntervalTypeCompiler
extends TypeCompiler


Field Summary
 
Fields inherited from class com.akiban.sql.compiler.TypeCompiler
AVG_OP, BOOLEAN_MAXWIDTH_AS_CHAR, DIV_OP, DIVIDE_OP, DOUBLE_MAXWIDTH_AS_CHAR, INT_MAXWIDTH_AS_CHAR, LONGINT_MAXWIDTH_AS_CHAR, MINUS_OP, MOD_OP, PLUS_OP, REAL_MAXWIDTH_AS_CHAR, SMALLINT_MAXWIDTH_AS_CHAR, SUM_OP, TIMES_OP, TINYINT_MAXWIDTH_AS_CHAR
 
Constructor Summary
protected IntervalTypeCompiler(TypeId typeId)
           
 
Method Summary
 boolean compatible(TypeId otherType)
          Tell whether this type (interval) is compatible with the given type.
 boolean convertible(TypeId otherType, boolean forDataTypeFunction)
          Determine if this type (interval) can be converted to some other type.
 int getCastToCharWidth(DataTypeDescriptor dtd)
          Return the maximum width for this data type when cast to a char type.
 String getCorrespondingPrimitiveTypeName()
          Get the name of the corresponding Java type.
 String getPrimitiveMethodName()
          Get the method name for getting out the corresponding primitive Java type.
 DataTypeDescriptor resolveArithmeticOperation(DataTypeDescriptor leftType, DataTypeDescriptor rightType, String operator)
          Type resolution methods on binary operators
 
Methods inherited from class com.akiban.sql.compiler.TypeCompiler
getStoredFormatIdFromTypeId, getTypeCompiler, getTypeId, numberConvertible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntervalTypeCompiler

protected IntervalTypeCompiler(TypeId typeId)
Method Detail

convertible

public boolean convertible(TypeId otherType,
                           boolean forDataTypeFunction)
Determine if this type (interval) can be converted to some other type.

Specified by:
convertible in class TypeCompiler
Parameters:
otherType - The CompilationType of the other type to compare this type to
forDataTypeFunction - true if this is a type function that requires more liberal behavior (e.g DOUBLE can convert a char but you cannot cast a CHAR to double.
Returns:
true if the types can be converted, false if conversion is not allowed

compatible

public boolean compatible(TypeId otherType)
Tell whether this type (interval) is compatible with the given type.

Specified by:
compatible in class TypeCompiler
Parameters:
otherType - The TypeId of the other type.
Returns:
true if the types are compatible, false if not compatible

getCorrespondingPrimitiveTypeName

public String getCorrespondingPrimitiveTypeName()
Description copied from class: TypeCompiler
Get the name of the corresponding Java type. For numerics and booleans we will get the corresponding Java primitive type. e Each SQL type has a corresponding Java type. When a SQL value is passed to a Java method, it is translated to its corresponding Java type. For example, a SQL Integer will be mapped to a Java int, but a SQL date will be mapped to a java.sql.Date.

Specified by:
getCorrespondingPrimitiveTypeName in class TypeCompiler
Returns:
The name of the corresponding Java primitive type.
See Also:
TypeCompiler.getCorrespondingPrimitiveTypeName()

getPrimitiveMethodName

public String getPrimitiveMethodName()
Get the method name for getting out the corresponding primitive Java type.

Specified by:
getPrimitiveMethodName in class TypeCompiler
Returns:
String The method call name for getting the corresponding primitive Java type.

getCastToCharWidth

public int getCastToCharWidth(DataTypeDescriptor dtd)
Description copied from class: TypeCompiler
Return the maximum width for this data type when cast to a char type.

Specified by:
getCastToCharWidth in class TypeCompiler
Parameters:
dtd - The associated DataTypeDescriptor for this TypeId.
Returns:
int The maximum width for this data type when cast to a char type.
See Also:
TypeCompiler.getCastToCharWidth(com.akiban.sql.types.DataTypeDescriptor)

resolveArithmeticOperation

public DataTypeDescriptor resolveArithmeticOperation(DataTypeDescriptor leftType,
                                                     DataTypeDescriptor rightType,
                                                     String operator)
                                              throws StandardException
Description copied from class: TypeCompiler
Type resolution methods on binary operators

Overrides:
resolveArithmeticOperation in class TypeCompiler
Parameters:
leftType - The type of the left parameter
rightType - The type of the right parameter
operator - The name of the operator (e.g. "+").
Returns:
The type of the result
Throws:
StandardException - Thrown on error
See Also:
TypeCompiler.resolveArithmeticOperation(com.akiban.sql.types.DataTypeDescriptor, com.akiban.sql.types.DataTypeDescriptor, java.lang.String)


Copyright © 2013 Akiban Technologies, Inc. All rights reserved.