[286703] Updated unit tests for ORDER BY ordering problem
diff --git a/tests/org.eclipse.datatools.sqltools.parsers.sql.query.test/src/org/eclipse/datatools/sqltools/parsers/sql/query/test/StatementCache.java b/tests/org.eclipse.datatools.sqltools.parsers.sql.query.test/src/org/eclipse/datatools/sqltools/parsers/sql/query/test/StatementCache.java
index a622d29..4c039a8 100644
--- a/tests/org.eclipse.datatools.sqltools.parsers.sql.query.test/src/org/eclipse/datatools/sqltools/parsers/sql/query/test/StatementCache.java
+++ b/tests/org.eclipse.datatools.sqltools.parsers.sql.query.test/src/org/eclipse/datatools/sqltools/parsers/sql/query/test/StatementCache.java
@@ -252,6 +252,25 @@
String sourceText = "";
String templateText = "";
+ /* SELECT statements */
+ catID = "SELECT";
+ groupID = "ORDER BY";
+
+ itemID = "Type mix 1";
+ sourceText = "select c1, c2 from table1 order by c2, 1";
+ templateText = sourceText;
+ addStatement(catID, groupID, itemID, sourceText, templateText);
+
+ itemID = "Type mix 2";
+ sourceText = "select c1, c2, c3 from table1 order by 1, c2, c4, 3, c1";
+ templateText = sourceText;
+ addStatement(catID, groupID, itemID, sourceText, templateText);
+
+ itemID = "Summary 1";
+ sourceText = "select c1, avg(c2) from table1 order by avg(c2), 1";
+ templateText = sourceText;
+ addStatement(catID, groupID, itemID, sourceText, templateText);
+
/* MERGE statements */
catID = "MERGE";
groupID = "BASIC";
diff --git a/tests/org.eclipse.datatools.sqltools.parsers.sql.query.test/src/org/eclipse/datatools/sqltools/parsers/sql/query/test/TestSQLQueryParserSelect.java b/tests/org.eclipse.datatools.sqltools.parsers.sql.query.test/src/org/eclipse/datatools/sqltools/parsers/sql/query/test/TestSQLQueryParserSelect.java
index f0d84d7..00b7d52 100644
--- a/tests/org.eclipse.datatools.sqltools.parsers.sql.query.test/src/org/eclipse/datatools/sqltools/parsers/sql/query/test/TestSQLQueryParserSelect.java
+++ b/tests/org.eclipse.datatools.sqltools.parsers.sql.query.test/src/org/eclipse/datatools/sqltools/parsers/sql/query/test/TestSQLQueryParserSelect.java
@@ -342,6 +342,13 @@
"(select deptno from department where deptno in (select workdept from employee order by workdept) order by deptno) intersect (select workdept from employee order by workdept) union (values ('E22') order by 1) order by 1" + NL +
"", false);
+ // Test mix of column expr and ordinal sor specs
+ StatementCache stmtCache = StatementCache.getInstance();
+
+ String sourceScript = stmtCache.getScript("SELECT", "ORDER BY");
+ String templateScript = stmtCache.getTemplateScript("SELECT", "ORDER BY");
+ parserVerifySuccess(sourceScript, templateScript);
+
// NULLS FIRST/LAST not supported by DB2
// parserVerifySuccess(
// "select col3 from table4 order by col2 desc, col1 asc NULLS FIRST;" + NL + //$NON-NLS-1$
@@ -400,7 +407,7 @@
"", false); //$NON-NLS-1$
}
- public void testSQLDmlParser004_tableCorrelationNameList() throws Exception {
+ public void testSqlDmlParser004_tableCorrelationNameList() throws Exception {
System.out.println("test 004_tableCorrelationNameList"); //$NON-NLS-1$
parserVerifySuccess(