Author: shawkins
Date: 2012-01-20 20:54:31 -0500 (Fri, 20 Jan 2012)
New Revision: 3810
Modified:
branches/7.6.x/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
branches/7.6.x/engine/src/test/java/org/teiid/query/sql/visitor/TestExpressionMappingVisitor.java
branches/7.6.x/engine/src/test/java/org/teiid/query/sql/visitor/TestSQLStringVisitor.java
Log:
TEII-1907 ensuring visit node will be called for select
Modified:
branches/7.6.x/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
===================================================================
---
branches/7.6.x/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java 2012-01-20
22:01:56 UTC (rev 3809)
+++
branches/7.6.x/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java 2012-01-21
01:54:31 UTC (rev 3810)
@@ -779,8 +779,26 @@
public void visit( Query obj ) {
addCacheHint(obj.getCacheHint());
addWithClause(obj);
+ append(SELECT);
+
+ SourceHint sh = obj.getSourceHint();
+ if (sh != null) {
+ append(SPACE);
+ append(BEGIN_HINT);
+ append("sh"); //$NON-NLS-1$
+ if (sh.getGeneralHint() != null) {
+ appendSourceHintValue(sh.getGeneralHint());
+ }
+ if (sh.getSourceHints() != null) {
+ for (Map.Entry<String, String> entry : sh.getSourceHints().entrySet()) {
+ append(entry.getKey());
+ appendSourceHintValue(entry.getValue());
+ }
+ }
+ append(END_HINT);
+ }
if (obj.getSelect() != null) {
- visitDirect(obj.getSelect(), obj);
+ visitNode(obj.getSelect());
}
if (obj.getInto() != null) {
@@ -868,31 +886,6 @@
}
public void visit( Select obj ) {
- visitDirect(obj, null);
- }
-
- private void visitDirect(Select obj, Query query) {
- append(SELECT);
-
- if (query != null) {
- SourceHint sh = query.getSourceHint();
- if (sh != null) {
- append(SPACE);
- append(BEGIN_HINT);
- append("sh"); //$NON-NLS-1$
- if (sh.getGeneralHint() != null) {
- appendSourceHintValue(sh.getGeneralHint());
- }
- if (sh.getSourceHints() != null) {
- for (Map.Entry<String, String> entry : sh.getSourceHints().entrySet())
{
- append(entry.getKey());
- appendSourceHintValue(entry.getValue());
- }
- }
- append(END_HINT);
- }
- }
-
if (obj.isDistinct()) {
append(SPACE);
append(DISTINCT);
Modified:
branches/7.6.x/engine/src/test/java/org/teiid/query/sql/visitor/TestExpressionMappingVisitor.java
===================================================================
---
branches/7.6.x/engine/src/test/java/org/teiid/query/sql/visitor/TestExpressionMappingVisitor.java 2012-01-20
22:01:56 UTC (rev 3809)
+++
branches/7.6.x/engine/src/test/java/org/teiid/query/sql/visitor/TestExpressionMappingVisitor.java 2012-01-21
01:54:31 UTC (rev 3810)
@@ -180,7 +180,7 @@
ExpressionMappingVisitor.mapExpressions(toMap, map);
- assertEquals("Did not get expected mapped expression", "SELECT
z.X", toMap.toString()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Did not get expected mapped expression", "
z.X", toMap.toString()); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
Modified:
branches/7.6.x/engine/src/test/java/org/teiid/query/sql/visitor/TestSQLStringVisitor.java
===================================================================
---
branches/7.6.x/engine/src/test/java/org/teiid/query/sql/visitor/TestSQLStringVisitor.java 2012-01-20
22:01:56 UTC (rev 3809)
+++
branches/7.6.x/engine/src/test/java/org/teiid/query/sql/visitor/TestSQLStringVisitor.java 2012-01-21
01:54:31 UTC (rev 3810)
@@ -708,7 +708,7 @@
Select select = new Select();
select.addSymbol(new ElementSymbol("e1")); //$NON-NLS-1$
- helpTest(select, "SELECT e1"); //$NON-NLS-1$
+ helpTest(select, " e1"); //$NON-NLS-1$
}
@Test public void testSelect2() {
@@ -716,7 +716,7 @@
select.setDistinct(true);
select.addSymbol(new ElementSymbol("e1")); //$NON-NLS-1$
- helpTest(select, "SELECT DISTINCT e1"); //$NON-NLS-1$
+ helpTest(select, " DISTINCT e1"); //$NON-NLS-1$
}
@Test public void testSelect3() {
@@ -724,7 +724,7 @@
select.addSymbol(new ElementSymbol("e1")); //$NON-NLS-1$
select.addSymbol(new ElementSymbol("e2")); //$NON-NLS-1$
- helpTest(select, "SELECT e1, e2"); //$NON-NLS-1$
+ helpTest(select, " e1, e2"); //$NON-NLS-1$
}
@Test public void testSetCriteria1() {
Show replies by date