Search in sources :

Example 6 with SQLConversionVisitor

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

the class TestSQLConversionVisitor method helpTest.

private void helpTest(String sql, String expected) throws TranslatorException {
    Command command = translationUtility.parseCommand(sql);
    PhoenixExecutionFactory ef = new PhoenixExecutionFactory();
    ef.start();
    SQLConversionVisitor vistor = ef.getSQLConversionVisitor();
    vistor.append(command);
    assertEquals(expected, vistor.toString());
}
Also used : SQLConversionVisitor(org.teiid.translator.jdbc.SQLConversionVisitor) Command(org.teiid.language.Command) PhoenixExecutionFactory(org.teiid.translator.phoenix.PhoenixExecutionFactory)

Example 7 with SQLConversionVisitor

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

the class TestSQLConversionVisitor method helpTest.

private void helpTest(String sql, String expected) throws TranslatorException {
    Command command = translationUtility.parseCommand(sql);
    SQLConversionVisitor vistor = TRANSLATOR.getSQLConversionVisitor();
    vistor.append(command);
    // System.out.println(vistor.toString());
    assertEquals(expected, vistor.toString());
}
Also used : SQLConversionVisitor(org.teiid.translator.jdbc.SQLConversionVisitor) Command(org.teiid.language.Command)

Example 8 with SQLConversionVisitor

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

the class TestSQLConversionVisitor method helpTestMod.

private void helpTestMod(Literal c, String format, String expectedStr) throws Exception {
    Function func = LANG_FACTORY.createFunction(format, Arrays.asList(c), String.class);
    PrestoDBExecutionFactory ef = new PrestoDBExecutionFactory();
    ef.start();
    SQLConversionVisitor sqlVisitor = ef.getSQLConversionVisitor();
    sqlVisitor.append(func);
    assertEquals(expectedStr, sqlVisitor.toString());
}
Also used : Function(org.teiid.language.Function) SQLConversionVisitor(org.teiid.translator.jdbc.SQLConversionVisitor)

Example 9 with SQLConversionVisitor

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

the class TestLeftOrRightFunctionModifier method helpTestMod.

public void helpTestMod(Literal c, Literal d, String target, String expectedStr) throws Exception {
    Function func = LANG_FACTORY.createFunction(target, Arrays.asList(c, d), String.class);
    OracleExecutionFactory trans = new OracleExecutionFactory();
    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 10 with SQLConversionVisitor

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

the class TestMonthOrDayNameFunctionModifier method helpTestMod.

public void helpTestMod(Literal c, String format, String expectedStr) throws Exception {
    Function func = // "monthname" //$NON-NLS-1$
    LANG_FACTORY.createFunction(// "monthname" //$NON-NLS-1$
    format.toLowerCase() + "name", Arrays.asList(c), String.class);
    OracleExecutionFactory trans = new OracleExecutionFactory();
    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)

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