org.teiid.connector.jdbc.translator
Class ConvertModifier

java.lang.Object
  extended by org.teiid.connector.jdbc.translator.FunctionModifier
      extended by org.teiid.connector.jdbc.translator.ConvertModifier

public class ConvertModifier
extends FunctionModifier

Base class for handling the convert function.

Convert is by far the most complicated pushdown function since it actually represents a matrix of possible functions. Additionally not every source supports the same semantics as our conversions.

Each instance of this class makes a best effort at handling converts for for a given source - compensating for differing string representation, the lack a time type etc.

The choice of conversion logic is as follows:


Nested Class Summary
static class ConvertModifier.FormatModifier
           
 
Field Summary
 
Fields inherited from class org.teiid.connector.jdbc.translator.FunctionModifier
BIGDECIMAL, BIGINTEGER, BLOB, BOOLEAN, BYTE, CHAR, CLOB, DATE, DOUBLE, FLOAT, INTEGER, LONG, OBJECT, SHORT, STRING, TIME, TIMESTAMP, XML
 
Constructor Summary
ConvertModifier()
           
 
Method Summary
 void addConvert(int sourceType, int targetType, FunctionModifier convert)
           
 void addNumericBooleanConversions()
           
 void addSourceConversion(FunctionModifier convert, int... sourceType)
           
 void addTypeConversion(FunctionModifier convert, int... targetType)
           
 void addTypeMapping(java.lang.String nativeType, int... targetType)
           
static IFunction createConvertFunction(ILanguageFactory langFactory, IExpression expr, java.lang.String typeName)
           
 void setWideningNumericImplicit(boolean wideningNumericImplicit)
           
 java.util.List<?> translate(IFunction function)
          Return a List of translated parts (ILanguageObjects and Objects), or null if this FunctionModifier wishes to rely on the default translation of the conversion visitor.
 
Methods inherited from class org.teiid.connector.jdbc.translator.FunctionModifier
getCode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConvertModifier

public ConvertModifier()
Method Detail

addTypeConversion

public void addTypeConversion(FunctionModifier convert,
                              int... targetType)

addSourceConversion

public void addSourceConversion(FunctionModifier convert,
                                int... sourceType)

addTypeMapping

public void addTypeMapping(java.lang.String nativeType,
                           int... targetType)

setWideningNumericImplicit

public void setWideningNumericImplicit(boolean wideningNumericImplicit)

addConvert

public void addConvert(int sourceType,
                       int targetType,
                       FunctionModifier convert)

translate

public java.util.List<?> translate(IFunction function)
Description copied from class: FunctionModifier
Return a List of translated parts (ILanguageObjects and Objects), or null if this FunctionModifier wishes to rely on the default translation of the conversion visitor.

Specified by:
translate in class FunctionModifier
Parameters:
function - IFunction to be translated
Returns:
List of translated parts, or null

createConvertFunction

public static IFunction createConvertFunction(ILanguageFactory langFactory,
                                              IExpression expr,
                                              java.lang.String typeName)

addNumericBooleanConversions

public void addNumericBooleanConversions()


Copyright © 2009. All Rights Reserved.