Search in sources :

Example 21 with SQLConversionVisitor

use of org.teiid.translator.jdbc.SQLConversionVisitor in project teiid by teiid.

the class TestSubstringFunctionModifier method helpTestMod.

public void helpTestMod(Expression[] args, String expectedStr) throws Exception {
    Function func = LANG_FACTORY.createFunction("substring", Arrays.asList(args), TypeFacility.RUNTIME_TYPES.STRING);
    NetezzaExecutionFactory trans = new NetezzaExecutionFactory();
    trans.start();
    SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor();
    sqlVisitor.append(func);
    assertEquals(expectedStr, sqlVisitor.toString());
}
Also used : Function(org.teiid.language.Function) SQLConversionVisitor(org.teiid.translator.jdbc.SQLConversionVisitor)

Example 22 with SQLConversionVisitor

use of org.teiid.translator.jdbc.SQLConversionVisitor in project teiid by teiid.

the class TestIngresConvertModifier method helpGetString.

public String helpGetString(Expression expr) throws Exception {
    IngresExecutionFactory trans = new IngresExecutionFactory();
    trans.start();
    SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor();
    sqlVisitor.append(expr);
    return sqlVisitor.toString();
}
Also used : SQLConversionVisitor(org.teiid.translator.jdbc.SQLConversionVisitor)

Example 23 with SQLConversionVisitor

use of org.teiid.translator.jdbc.SQLConversionVisitor in project teiid by teiid.

the class TestInterSystemsCacheTranslation method helpGetString.

public String helpGetString(Expression expr) throws Exception {
    SQLConversionVisitor sqlVisitor = TRANSLATOR.getSQLConversionVisitor();
    sqlVisitor.append(expr);
    return sqlVisitor.toString();
}
Also used : SQLConversionVisitor(org.teiid.translator.jdbc.SQLConversionVisitor)

Example 24 with SQLConversionVisitor

use of org.teiid.translator.jdbc.SQLConversionVisitor in project teiid by teiid.

the class TestTeradataTranslator method helpGetString.

public String helpGetString(Expression expr) throws Exception {
    SQLConversionVisitor sqlVisitor = TRANSLATOR.getSQLConversionVisitor();
    sqlVisitor.append(expr);
    return sqlVisitor.toString();
}
Also used : SQLConversionVisitor(org.teiid.translator.jdbc.SQLConversionVisitor)

Example 25 with SQLConversionVisitor

use of org.teiid.translator.jdbc.SQLConversionVisitor in project teiid by teiid.

the class TestHiveExecutionFactory method helpTest.

private void helpTest(Expression srcExpression, String tgtType, String expectedExpression) throws Exception {
    Function func = LANG_FACTORY.createFunction("convert", Arrays.asList(srcExpression, LANG_FACTORY.createLiteral(tgtType, String.class)), TypeFacility.getDataTypeClass(tgtType));
    SQLConversionVisitor sqlVisitor = hiveTranslator.getSQLConversionVisitor();
    sqlVisitor.append(func);
    assertEquals("Error converting from " + srcExpression.getType() + " to " + tgtType, expectedExpression, sqlVisitor.toString());
}
Also used : Function(org.teiid.language.Function) SQLConversionVisitor(org.teiid.translator.jdbc.SQLConversionVisitor)

Aggregations

SQLConversionVisitor (org.teiid.translator.jdbc.SQLConversionVisitor)31 Test (org.junit.Test)10 CommandBuilder (org.teiid.cdk.CommandBuilder)9 Command (org.teiid.language.Command)9 Function (org.teiid.language.Function)9 Select (org.teiid.language.Select)3 TranslatedCommand (org.teiid.translator.jdbc.TranslatedCommand)1 PhoenixExecutionFactory (org.teiid.translator.phoenix.PhoenixExecutionFactory)1