Author: shawkins
Date: 2011-11-21 15:54:23 -0500 (Mon, 21 Nov 2011)
New Revision: 3679
Modified:
branches/7.6.x/engine/src/main/java/org/teiid/query/sql/lang/Command.java
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/parser/TestOptionsAndHints.java
Log:
TEIID-1845 fix for cache hint on a procedure
Modified: branches/7.6.x/engine/src/main/java/org/teiid/query/sql/lang/Command.java
===================================================================
--- branches/7.6.x/engine/src/main/java/org/teiid/query/sql/lang/Command.java 2011-11-21
20:41:44 UTC (rev 3678)
+++ branches/7.6.x/engine/src/main/java/org/teiid/query/sql/lang/Command.java 2011-11-21
20:54:23 UTC (rev 3679)
@@ -344,7 +344,6 @@
protected boolean sameOptionAndHint(Command cmd) {
return EquivalenceUtil.areEqual(this.cacheHint, cmd.cacheHint) &&
- EquivalenceUtil.areEqual(this.cacheHint, cmd.cacheHint) &&
EquivalenceUtil.areEqual(this.option, cmd.option);
}
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 2011-11-21
20:41:44 UTC (rev 3678)
+++
branches/7.6.x/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java 2011-11-21
20:54:23 UTC (rev 3679)
@@ -1463,6 +1463,7 @@
}
public void visit( CreateUpdateProcedureCommand obj ) {
+ addCacheHint(obj.getCacheHint());
append(CREATE);
append(SPACE);
if (!obj.isUpdateProcedure()) {
Modified:
branches/7.6.x/engine/src/test/java/org/teiid/query/parser/TestOptionsAndHints.java
===================================================================
---
branches/7.6.x/engine/src/test/java/org/teiid/query/parser/TestOptionsAndHints.java 2011-11-21
20:41:44 UTC (rev 3678)
+++
branches/7.6.x/engine/src/test/java/org/teiid/query/parser/TestOptionsAndHints.java 2011-11-21
20:54:23 UTC (rev 3679)
@@ -1055,6 +1055,14 @@
TestParser.helpTest(sql, "/*+ cache */ SELECT * FROM t1", query);
//$NON-NLS-1$
}
+ @Test public void testCacheProc() {
+ String sql = "/*+ cache */ CREATE VIRTUAL PROCEDURE BEGIN END";
//$NON-NLS-1$
+ CreateUpdateProcedureCommand command = new CreateUpdateProcedureCommand(new
Block());
+ command.setUpdateProcedure(false);
+ command.setCacheHint(new CacheHint());
+ TestParser.helpTest(sql, "/*+ cache */ CREATE VIRTUAL
PROCEDURE\nBEGIN\nEND", command); //$NON-NLS-1$
+ }
+
@Test public void testCacheScope() {
String sql = "/*+ cache(pref_mem scope:session) */ SELECT * FROM t1";
//$NON-NLS-1$