use of org.teiid.cdk.CommandBuilder in project teiid by teiid.
the class TestSqlServerConversionVisitor method testWith.
@Test
public void testWith() throws Exception {
// $NON-NLS-1$
String input = "with x as /*+ no_inline */ (select intkey from bqt1.smalla) select intkey from x limit 100";
// $NON-NLS-1$
String output = "WITH x (IntKey) AS (SELECT g_0.IntKey FROM SmallA g_0) SELECT TOP 100 g_1.intkey AS c_0 FROM x g_1";
CommandBuilder commandBuilder = new CommandBuilder(RealMetadataFactory.exampleBQTCached());
Command obj = commandBuilder.getCommand(input, true, true);
TranslationHelper.helpTestVisitor(output, trans, obj);
}
use of org.teiid.cdk.CommandBuilder in project teiid by teiid.
the class TestSqlServerConversionVisitor method testUnicodeLiteral.
@Test
public void testUnicodeLiteral() throws Exception {
// $NON-NLS-1$
String input = "select N'\u0FFF'";
// $NON-NLS-1$
String output = "SELECT N'\u0FFF'";
CommandBuilder commandBuilder = new CommandBuilder(RealMetadataFactory.exampleBQTCached());
Command obj = commandBuilder.getCommand(input, true, true);
TranslationHelper.helpTestVisitor(output, trans, obj);
}
use of org.teiid.cdk.CommandBuilder in project teiid by teiid.
the class TestSqlServerConversionVisitor method testRowLimitWithInlineViewOrderBy.
@Test
public void testRowLimitWithInlineViewOrderBy() throws Exception {
// $NON-NLS-1$
String input = "select intkey from (select intkey from bqt1.smalla) as x order by intkey limit 100";
// $NON-NLS-1$
String output = "SELECT TOP 100 v_0.c_0 FROM (SELECT g_0.IntKey AS c_0 FROM SmallA g_0) v_0 ORDER BY v_0.c_0";
CommandBuilder commandBuilder = new CommandBuilder(RealMetadataFactory.exampleBQTCached());
Command obj = commandBuilder.getCommand(input, true, true);
TranslationHelper.helpTestVisitor(output, trans, obj);
}
use of org.teiid.cdk.CommandBuilder in project teiid by teiid.
the class TestSqlServerConversionVisitor method testWithInsert.
@Test
public void testWithInsert() throws Exception {
// $NON-NLS-1$
String input = "insert into bqt1.smalla (intkey) with a (x) as /*+ no_inline */ (select intnum from bqt1.smallb) select x from a";
// $NON-NLS-1$
String output = "WITH a (x) AS (SELECT SmallB.IntNum FROM SmallB) INSERT INTO SmallA (IntKey) SELECT a.x FROM a";
CommandBuilder commandBuilder = new CommandBuilder(RealMetadataFactory.exampleBQTCached());
Command obj = commandBuilder.getCommand(input, true, true);
TranslationHelper.helpTestVisitor(output, trans, obj);
}
use of org.teiid.cdk.CommandBuilder in project teiid by teiid.
the class TestSqlServerConversionVisitor method testLocate.
@Test
public void testLocate() throws Exception {
// $NON-NLS-1$
String input = "select locate('a', stringkey, 2) from bqt1.smalla";
// $NON-NLS-1$
String output = "SELECT CHARINDEX('a', g_0.StringKey, 2) FROM SmallA g_0";
CommandBuilder commandBuilder = new CommandBuilder(RealMetadataFactory.exampleBQTCached());
Command obj = commandBuilder.getCommand(input, true, true);
TranslationHelper.helpTestVisitor(output, trans, obj);
}
Aggregations