use of com.developmentontheedge.sql.format.Formatter in project be5 by DevelopmentOnTheEdge.
the class OrderByFilterTest method testOrderByFilter.
@Test
public void testOrderByFilter() {
AstStart start = SqlQuery.parse("SELECT t.a, t.b, t.c AS foo FROM myTable t WHERE t.b > 2");
Map<String, String> columns = new HashMap<String, String>();
columns.put("t.a", "ASC");
columns.put("foo", "DESC");
new OrderByFilter().apply(start, columns);
assertEquals("SELECT t.a, t.b, t.c AS foo FROM myTable t WHERE t.b > 2 ORDER BY 1 ASC, 3 DESC", new Formatter().format(start, new Context(Dbms.MYSQL), new DefaultParserContext()));
}
Aggregations