Пример #1
0
 @Test
 public void testStripAliases1() throws Exception {
   String sql = "select intkey as a, stringkey as b from BQT1.SmallA ORDER BY a, b"; // $NON-NLS-1$
   String expected =
       "SELECT BQT1.SmallA.IntKey, BQT1.SmallA.StringKey FROM BQT1.SmallA ORDER BY BQT1.SmallA.IntKey, BQT1.SmallA.StringKey"; //$NON-NLS-1$
   Command command = helpTest(sql, expected, false, true, RealMetadataFactory.exampleBQTCached());
   LanguageBridgeFactory lbf = new LanguageBridgeFactory(RealMetadataFactory.exampleBQTCached());
   org.teiid.language.Command c = lbf.translate(command);
   assertEquals(
       "SELECT SmallA.IntKey, SmallA.StringKey FROM SmallA ORDER BY SmallA.IntKey, SmallA.StringKey",
       c.toString());
 }
Пример #2
0
 @Test
 public void testInlineViewOrderBy() throws Exception {
   String sql =
       "select intnum from (select intnum from bqt1.smallb) b order by b.intnum"; //$NON-NLS-1$
   String expected =
       "SELECT v_0.c_0 FROM (SELECT g_0.IntNum AS c_0 FROM BQT1.SmallB AS g_0) AS v_0 ORDER BY c_0"; //$NON-NLS-1$
   Command command = helpTest(sql, expected, true, false, RealMetadataFactory.exampleBQTCached());
   LanguageBridgeFactory lbf = new LanguageBridgeFactory(RealMetadataFactory.exampleBQTCached());
   org.teiid.language.Command c = lbf.translate(command);
   assertEquals(
       "SELECT v_0.c_0 FROM (SELECT g_0.IntNum AS c_0 FROM SmallB AS g_0) AS v_0 ORDER BY v_0.c_0",
       c.toString());
 }