Author: shawkins
Date: 2010-10-14 14:57:42 -0400 (Thu, 14 Oct 2010)
New Revision: 2654
Modified:
branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html
branches/7.1.x/engine/src/main/java/org/teiid/query/sql/ProcedureReservedWords.java
branches/7.1.x/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
branches/7.1.x/engine/src/main/resources/org/teiid/query/i18n.properties
Log:
TEIID-1294 additional procedure validation to clarify assignment syntax.
Modified: branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html 2010-10-14 16:21:44
UTC (rev 2653)
+++ branches/7.1.x/build/kits/jboss-container/teiid-releasenotes.html 2010-10-14 18:57:42
UTC (rev 2654)
@@ -51,8 +51,10 @@
<li>Overwriting an existing VDB will cause old connections to be terminated.
Production systems should rely on VDB versioning.
<li>The jdbc:metamatrix JDBC URL prefix is no longer accepted. Use jdbc:teiid
instead.
<li>Model visibility no longer restricts access to tables and procedures.
Setting visible to false will only hide entries from system tables. Data roles should be
used to restrict data access.
- <li>On Admin API "getWorkManagerStats" methods renamed to
"getWorkerPoolStats". Also, "setRuntimeProperty" and
"getProcesses" methods are not supported.
- <li>By default the "ENV" system function is now turned off. To enable
it, edit the Teiid configuration file.
+ <li>Admin API "getWorkManagerStats" methods renamed to
"getWorkerPoolStats". Also, "setRuntimeProperty" and
"getProcesses" methods were removed.
+ <li>By default the "ENV" system function is now turned off. To enable
it, edit the teiid-jboss-beans.xml configuration file.
+ <li>The use of VARIABLES.ROWCOUNT is now reserved. Use a different
+ <li>Direct assignments in virtual procedures using stored procedures (e.g. var =
EXEC foo()) are only valid if the procedure has a return parameter and no result set.
</ul>
<h4>from 7.0</h4>
<ul>
Modified:
branches/7.1.x/engine/src/main/java/org/teiid/query/sql/ProcedureReservedWords.java
===================================================================
---
branches/7.1.x/engine/src/main/java/org/teiid/query/sql/ProcedureReservedWords.java 2010-10-14
16:21:44 UTC (rev 2653)
+++
branches/7.1.x/engine/src/main/java/org/teiid/query/sql/ProcedureReservedWords.java 2010-10-14
18:57:42 UTC (rev 2654)
@@ -40,6 +40,8 @@
public static final String INPUTS = "INPUTS"; //$NON-NLS-1$
public static final String ROWS_UPDATED = "ROWS_UPDATED"; //$NON-NLS-1$
+
+ public static final String ROWCOUNT = "ROWCOUNT"; //$NON-NLS-1$
public static final String CHANGING = "CHANGING"; //$NON-NLS-1$
Modified:
branches/7.1.x/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
===================================================================
---
branches/7.1.x/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2010-10-14
16:21:44 UTC (rev 2653)
+++
branches/7.1.x/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java 2010-10-14
18:57:42 UTC (rev 2654)
@@ -81,6 +81,7 @@
import org.teiid.query.sql.lang.SetClauseList;
import org.teiid.query.sql.lang.SetCriteria;
import org.teiid.query.sql.lang.SetQuery;
+import org.teiid.query.sql.lang.StoredProcedure;
import org.teiid.query.sql.lang.SubqueryCompareCriteria;
import org.teiid.query.sql.lang.SubqueryContainer;
import org.teiid.query.sql.lang.SubqueryFromClause;
@@ -376,7 +377,16 @@
if(groupName.equals(ProcedureReservedWords.CHANGING) ||
groupName.equals(ProcedureReservedWords.INPUTS)) {
handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0012",
ProcedureReservedWords.INPUTS, ProcedureReservedWords.CHANGING), obj); //$NON-NLS-1$
}
-
+
+ if (obj.getExpression() instanceof ScalarSubquery) {
+ ScalarSubquery ss = (ScalarSubquery)obj.getExpression();
+ if (ss.getCommand() instanceof StoredProcedure) {
+ StoredProcedure sp = (StoredProcedure)ss.getCommand();
+ if (sp.returnsResultSet() || !sp.returnsScalarValue()) {
+
handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.procedure_assigment"),
obj); //$NON-NLS-1$
+ }
+ }
+ }
}
@Override
@@ -418,6 +428,8 @@
// varible cannot be one of the special variables
if(elementname.equals(ProcedureReservedWords.ROWS_UPDATED)) {
handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0017", new
Object[] {ProcedureReservedWords.ROWS_UPDATED}), obj); //$NON-NLS-1$
+ } else if(elementname.equals(ProcedureReservedWords.ROWCOUNT)) {
+ handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0017", new
Object[] {ProcedureReservedWords.ROWCOUNT}), obj); //$NON-NLS-1$
}
visit((AssignmentStatement)obj);
Modified: branches/7.1.x/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- branches/7.1.x/engine/src/main/resources/org/teiid/query/i18n.properties 2010-10-14
16:21:44 UTC (rev 2653)
+++ branches/7.1.x/engine/src/main/resources/org/teiid/query/i18n.properties 2010-10-14
18:57:42 UTC (rev 2654)
@@ -176,6 +176,7 @@
ERR.015.012.0010 = The query defining an updatable simple virtual group should select all
the required elements in its FROM clause {0}
ERR.015.012.0011 = There must be exactly one projected symbol in the subcommand of an IN
clause.
ERR.015.012.0012 = An AssignmentStatement cannot change the value of a {0} or {1}
variable.
+ValidationVisitor.procedure_assigment = A procedure used in an assignment should have a
return parameter. If result set or out parameter values are needed, please use a scalar
subquery, e.g. (SELECT param FROM (EXEC proc(...)) X)
ERR.015.012.0016 = Variable {0} not assigned any value in this procedure.
ERR.015.012.0017 = Variables declared the procedure''s DeclareStatement cannot be
one of the special variables: {0}, {1} and {2}.
ERR.015.012.0019 = TranslateCriteria cannot be used in on an if or while statement.