Skip to content

Commit

Permalink
TEIID-4134 updating the rcte support version
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins committed Apr 15, 2016
1 parent 024e2dd commit 2bf0372
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Expand Up @@ -69,7 +69,7 @@ public class OracleExecutionFactory extends JDBCExecutionFactory {

public static final Version NINE_0 = Version.getVersion("9.0"); //$NON-NLS-1$
public static final Version NINE_2 = Version.getVersion("9.2"); //$NON-NLS-1$
public static final Version ELEVEN_2 = Version.getVersion("11.2"); //$NON-NLS-1$
public static final Version ELEVEN_2_0_4 = Version.getVersion("11.2.0.4"); //$NON-NLS-1$

private static final String TIME_FORMAT = "HH24:MI:SS"; //$NON-NLS-1$
private static final String DATE_FORMAT = "YYYY-MM-DD"; //$NON-NLS-1$
Expand Down Expand Up @@ -747,12 +747,13 @@ public void visit(WithItem obj) {
if (obj.getColumns() != null) {
List<ColumnReference> cols = obj.getColumns();
if(!obj.isRecusive()) {
//oracle 10 does not support recursion nor a column list
obj.setColumns(null);
}
Select select = obj.getSubquery().getProjectedQuery();
List<DerivedColumn> selectClause = select.getDerivedColumns();
for (int i = 0; i < cols.size(); i++) {
selectClause.get(i).setAlias(cols.get(i).getName());
Select select = obj.getSubquery().getProjectedQuery();
List<DerivedColumn> selectClause = select.getDerivedColumns();
for (int i = 0; i < cols.size(); i++) {
selectClause.get(i).setAlias(cols.get(i).getName());
}
}
}
super.visit(obj);
Expand Down Expand Up @@ -984,7 +985,7 @@ public boolean supportsCommonTableExpressions() {

@Override
public boolean supportsRecursiveCommonTableExpressions() {
return getVersion().compareTo(ELEVEN_2) >= 0;
return getVersion().compareTo(ELEVEN_2_0_4) >= 0;
}

@Override
Expand Down
Expand Up @@ -1091,7 +1091,7 @@ public void helpTestVisitor(String vdb, String input, String expectedOutput) thr

@Test public void testRecursiveCte() throws Exception {
String input = "with a (intkey, lvl) as (select intkey, 0 as lvl from bqt1.smallb where intkey = 1 UNION ALL select n.intkey, rcte.lvl + 1 as lvl from bqt1.smallb n inner join a rcte on rcte.intkey = n.intkey + 1) select * from a"; //$NON-NLS-1$
String output = "WITH a (intkey, lvl) AS (SELECT SmallB.IntKey AS intkey, 0 AS lvl FROM SmallB WHERE SmallB.IntKey = 1 UNION ALL SELECT n.IntKey, (rcte.lvl + 1) AS lvl FROM SmallB n INNER JOIN a rcte ON rcte.intkey = (n.IntKey + 1)) SELECT a.intkey, a.lvl FROM a"; //$NON-NLS-1$
String output = "WITH a (intkey, lvl) AS (SELECT SmallB.IntKey, 0 AS lvl FROM SmallB WHERE SmallB.IntKey = 1 UNION ALL SELECT n.IntKey, (rcte.lvl + 1) AS lvl FROM SmallB n INNER JOIN a rcte ON rcte.intkey = (n.IntKey + 1)) SELECT a.intkey, a.lvl FROM a"; //$NON-NLS-1$

TranslationHelper.helpTestVisitor(TranslationHelper.BQT_VDB, null,
input, output,
Expand Down

0 comments on commit 2bf0372

Please sign in to comment.