@Test public void testNumberedOrderBy1_2() throws Exception { Query resolvedQuery = (Query) getCommand("SELECT pm1.g1.e1, e2, concat(e3,'x'), concat(e2, 5) FROM pm1.g1 ORDER BY 3, 4, 1, 2"); //$NON-NLS-1$ helpCheckElements(resolvedQuery.getOrderBy(), new String[] { "pm1.g1.e3", "pm1.g1.e2", "pm1.g1.e1", "pm1.g1.e2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ new String[] { "pm1.g1.e3", "pm1.g1.e2", "pm1.g1.e1", "pm1.g1.e2" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ helpCheckExpressionsSymbols(resolvedQuery.getOrderBy(), new String[] {"concat(convert(e3, string), 'x')", "concat(convert(e2, string), '5')"}); //$NON-NLS-1$ //$NON-NLS-2$ }
@Test public void testOrderBy2() throws Exception { Query resolvedQuery = (Query) getCommand("SELECT * FROM pm1.g1 ORDER BY e1"); //$NON-NLS-1$ helpCheckElements(resolvedQuery.getOrderBy(), new String[] { "pm1.g1.e1" }, //$NON-NLS-1$ new String[] { "pm1.g1.e1" }); //$NON-NLS-1$ }
@Test public void testOrderBy4() throws Exception { Query resolvedQuery = (Query) getCommand("SELECT e1 FROM pm1.g1 ORDER BY pm1.g1.e1"); //$NON-NLS-1$ helpCheckElements(resolvedQuery.getOrderBy(), new String[] { "pm1.g1.e1" }, //$NON-NLS-1$ new String[] { "pm1.g1.e1" }); //$NON-NLS-1$ }
@Test public void testOrderBy6() throws Exception { Query resolvedQuery = (Query) getCommand("SELECT e1 FROM pm1.g1 AS x ORDER BY e1"); //$NON-NLS-1$ helpCheckElements(resolvedQuery.getOrderBy(), new String[] { "x.e1" }, //$NON-NLS-1$ new String[] { "pm1.g1.e1" }); //$NON-NLS-1$ }
@Test public void testOrderBy_J658a() { Query resolvedQuery = (Query) helpResolve("SELECT pm1.g1.e1, e2, e3 as x, (5+2) as y FROM pm1.g1 ORDER BY e3"); //$NON-NLS-1$ OrderBy orderBy = resolvedQuery.getOrderBy(); int[] expectedPositions = new int[] {2}; helpTestOrderBy(orderBy, expectedPositions); }
@Test public void testOrderBy7() throws Exception { Query resolvedQuery = (Query) getCommand("SELECT e1 FROM pm1.g1 AS x ORDER BY x.e1"); //$NON-NLS-1$ helpCheckElements(resolvedQuery.getOrderBy(), new String[] { "x.e1" }, //$NON-NLS-1$ new String[] { "pm1.g1.e1" }); //$NON-NLS-1$ }
@Test public void testOrderBy8() throws Exception { Query resolvedQuery = (Query) getCommand("SELECT x.e1 FROM pm1.g1 AS x ORDER BY e1"); //$NON-NLS-1$ helpCheckElements(resolvedQuery.getOrderBy(), new String[] { "x.e1" }, //$NON-NLS-1$ new String[] { "pm1.g1.e1" }); //$NON-NLS-1$ }
@Test public void testOrderBy10() throws Exception { Query resolvedQuery = (Query) getCommand("SELECT a.e1, b.e1 FROM pm1.g1 AS a, pm1.g1 AS b ORDER BY a.e1"); //$NON-NLS-1$ helpCheckElements(resolvedQuery.getOrderBy(), new String[] { "a.e1" }, //$NON-NLS-1$ new String[] { "pm1.g1.e1" }); //$NON-NLS-1$ }
@Test public void testOrderBy11() throws Exception { Query resolvedQuery = (Query) getCommand("SELECT a.e1, b.e1 FROM pm1.g1 AS a, pm1.g1 AS b ORDER BY b.e1"); //$NON-NLS-1$ helpCheckElements(resolvedQuery.getOrderBy(), new String[] { "b.e1" }, //$NON-NLS-1$ new String[] { "pm1.g1.e1" }); //$NON-NLS-1$ }
@Test public void testOrderBy13() throws Exception { Query resolvedQuery = (Query) getCommand("SELECT a.e1, pm1.g1.e1 FROM pm1.g1 AS a, pm1.g1 ORDER BY pm1.g1.e1"); //$NON-NLS-1$ helpCheckElements(resolvedQuery.getOrderBy(), new String[] { "pm1.g1.e1" }, //$NON-NLS-1$ new String[] { "pm1.g1.e1" }); //$NON-NLS-1$ }
/** * partially-qualified ORDER BY's with ambiguous short group names */ @Test public void testDefect10729() throws Exception { Query resolvedQuery = (Query) getCommand("SELECT pm1.g1.e1 FROM pm1.g1 ORDER BY g1.e1"); //$NON-NLS-1$ helpCheckElements(resolvedQuery.getOrderBy(), new String[] { "pm1.g1.e1" }, //$NON-NLS-1$ new String[] { "pm1.g1.e1" } ); //$NON-NLS-1$ }
@Test public void testNumberedOrderBy1_4() throws Exception { String sql = "select e1, (select e2 from pm4.g1) from pm4.g2 X order by 2"; //$NON-NLS-1$ Query resolvedQuery = (Query) getCommand(sql); helpCheckExpressionsSymbols(resolvedQuery.getOrderBy(), new String[] {"(SELECT e2 FROM pm4.g1 LIMIT 2)"}); //$NON-NLS-1$ }
@Test public void testOrderBy1() throws Exception { Query resolvedQuery = (Query) getCommand("SELECT pm1.g1.e1, e2, e3 as x, (5+2) as y FROM pm1.g1 ORDER BY x, y, pm1.g1.e1, e2"); //$NON-NLS-1$ helpCheckElements(resolvedQuery.getOrderBy(), new String[] { "pm1.g1.e3", "pm1.g1.e1", "pm1.g1.e2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ new String[] { "pm1.g1.e3", "pm1.g1.e1", "pm1.g1.e2" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ }
@Test public void testOrderBy5() throws Exception { Query resolvedQuery = (Query) getCommand("SELECT e1 FROM pm1.g1 ORDER BY e1"); //$NON-NLS-1$ helpCheckElements(resolvedQuery.getOrderBy(), new String[] { "pm1.g1.e1" }, //$NON-NLS-1$ new String[] { "pm1.g1.e1" }); //$NON-NLS-1$ }
@Test public void testOrderBy14() throws Exception { Query resolvedQuery = (Query) getCommand("SELECT a.e1 as x, pm1.g1.e1 as y FROM pm1.g1 AS a, pm1.g1 ORDER BY x"); //$NON-NLS-1$ helpCheckElements(resolvedQuery.getOrderBy(), new String[] { "a.e1" }, //$NON-NLS-1$ new String[] { "pm1.g1.e1" }); //$NON-NLS-1$ }
@Test public void testOrderBy15() throws Exception { Query resolvedQuery = (Query) getCommand("SELECT a.e1 as x, pm1.g1.e1 as y FROM pm1.g1 AS a, pm1.g1 ORDER BY y"); //$NON-NLS-1$ helpCheckElements(resolvedQuery.getOrderBy(), new String[] { "pm1.g1.e1" }, //$NON-NLS-1$ new String[] { "pm1.g1.e1" }); //$NON-NLS-1$ }
@Test public void testNumberedOrderBy4() throws Exception { Query resolvedQuery = (Query) getCommand("SELECT e1 FROM pm1.g1 ORDER BY 1"); //$NON-NLS-1$ helpCheckElements(resolvedQuery.getOrderBy(), new String[] { "pm1.g1.e1" }, //$NON-NLS-1$ new String[] { "pm1.g1.e1" }); //$NON-NLS-1$ }
@Test public void testNumberedOrderBy8() throws Exception { Query resolvedQuery = (Query) getCommand("SELECT a.e1 as x, pm1.g1.e1 as y FROM pm1.g1 AS a, pm1.g1 ORDER BY 1"); //$NON-NLS-1$ helpCheckElements(resolvedQuery.getOrderBy(), new String[] { "a.e1" }, //$NON-NLS-1$ new String[] { "pm1.g1.e1" }); //$NON-NLS-1$ }
/** * partially-qualified ORDER BY's with ambiguous short group names */ @Test public void testDefect10729a() throws Exception { Query resolvedQuery = (Query) getCommand("SELECT pm1.g1.e1 FROM pm1.g1 ORDER BY e1"); //$NON-NLS-1$ helpCheckElements(resolvedQuery.getOrderBy(), new String[] { "pm1.g1.e1" }, //$NON-NLS-1$ new String[] { "pm1.g1.e1" } ); //$NON-NLS-1$ }
@Test public void testOrderBy_J658b() { Query resolvedQuery = (Query) helpResolve("SELECT pm1.g1.e1, e2, e3 as x, (5+2) as y FROM pm1.g1 ORDER BY e2, e3 "); //$NON-NLS-1$ helpTestOrderBy(resolvedQuery.getOrderBy(), new int[] {1, 2}); } @Test public void testOrderBy_J658c() {