com.akiban.sql.compiler
Class CharTypeCompiler

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

public final class CharTypeCompiler
extends TypeCompiler

This class implements TypeCompiler for the SQL char datatypes.


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 CharTypeCompiler(TypeId typeId)
           
 
Method Summary
 boolean compatible(TypeId otherType)
          Tell whether this type (char) is compatible with the given type.
 boolean convertible(TypeId otherType, boolean forDataTypeFunction)
          Tell whether this type (char) can be converted to the given type.
 int getCastToCharWidth(DataTypeDescriptor dts)
          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.
 
Methods inherited from class com.akiban.sql.compiler.TypeCompiler
getStoredFormatIdFromTypeId, getTypeCompiler, getTypeId, numberConvertible, resolveArithmeticOperation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CharTypeCompiler

protected CharTypeCompiler(TypeId typeId)
Method Detail

convertible

public boolean convertible(TypeId otherType,
                           boolean forDataTypeFunction)
Tell whether this type (char) can be converted to the given 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
See Also:
TypeCompiler.convertible(com.akiban.sql.types.TypeId, boolean)

compatible

public boolean compatible(TypeId otherType)
Tell whether this type (char) 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 dts)
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:
dts - 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)


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