Author: shawkins
Date: 2009-11-20 13:53:09 -0500 (Fri, 20 Nov 2009)
New Revision: 1580
Modified:
trunk/client/src/main/java/com/metamatrix/dqp/message/RequestMessage.java
trunk/engine/src/main/java/com/metamatrix/query/parser/ParseInfo.java
trunk/engine/src/main/java/com/metamatrix/query/parser/SQLParserUtil.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
trunk/engine/src/test/java/com/metamatrix/query/parser/TestParser.java
trunk/engine/src/test/java/com/metamatrix/query/processor/xml/TestXMLProcessor.java
trunk/engine/src/test/java/com/metamatrix/query/resolver/TestXMLResolver.java
Log:
TEIID-145 changing the client default to ansi mode by default
Modified: trunk/client/src/main/java/com/metamatrix/dqp/message/RequestMessage.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/dqp/message/RequestMessage.java 2009-11-20
17:58:23 UTC (rev 1579)
+++ trunk/client/src/main/java/com/metamatrix/dqp/message/RequestMessage.java 2009-11-20
18:53:09 UTC (rev 1580)
@@ -66,7 +66,7 @@
private boolean useResultSetCache;
// Treat the double quoted strings as variables in the command
- private boolean dblQuotedVariableAllowed = false;
+ private boolean dblQuotedVariableAllowed = true;
//whether query plan is allowed or not
private boolean queryPlanAllowed = true;
Modified: trunk/engine/src/main/java/com/metamatrix/query/parser/ParseInfo.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/parser/ParseInfo.java 2009-11-20
17:58:23 UTC (rev 1579)
+++ trunk/engine/src/main/java/com/metamatrix/query/parser/ParseInfo.java 2009-11-20
18:53:09 UTC (rev 1580)
@@ -37,17 +37,17 @@
public boolean aggregatesAllowed = false;
// treat a double quoted variable as variable instead of string
- public boolean allowDoubleQuotedVariable=true;
+ public boolean ansiQuotedIdentifiers=true;
public ParseInfo() { }
- public boolean allowDoubleQuotedVariable() {
- return allowDoubleQuotedVariable;
+ public boolean useAnsiQuotedIdentifiers() {
+ return ansiQuotedIdentifiers;
}
@Override
public int hashCode() {
- return allowDoubleQuotedVariable?1:0;
+ return ansiQuotedIdentifiers?1:0;
}
@Override
@@ -59,6 +59,6 @@
return false;
}
ParseInfo other = (ParseInfo)obj;
- return this.allowDoubleQuotedVariable == other.allowDoubleQuotedVariable;
+ return this.ansiQuotedIdentifiers == other.ansiQuotedIdentifiers;
}
}
\ No newline at end of file
Modified: trunk/engine/src/main/java/com/metamatrix/query/parser/SQLParserUtil.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/parser/SQLParserUtil.java 2009-11-20
17:58:23 UTC (rev 1579)
+++ trunk/engine/src/main/java/com/metamatrix/query/parser/SQLParserUtil.java 2009-11-20
18:53:09 UTC (rev 1580)
@@ -121,7 +121,7 @@
* @param id Possible string literal
*/
boolean isStringLiteral(String str, ParseInfo info) throws ParseException {
- if (info.allowDoubleQuotedVariable() || str.charAt(0) != '"' ||
str.charAt(str.length() - 1) != '"') {
+ if (info.useAnsiQuotedIdentifiers() || str.charAt(0) != '"' ||
str.charAt(str.length() - 1) != '"') {
return false;
}
int index = 1;
Modified:
trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java 2009-11-20
17:58:23 UTC (rev 1579)
+++
trunk/engine/src/main/java/org/teiid/dqp/internal/process/MetaDataProcessor.java 2009-11-20
18:53:09 UTC (rev 1580)
@@ -215,7 +215,7 @@
ParseInfo info = new ParseInfo();
// Defect 19747 - the parser needs the following connection property to decide
whether to treat double-quoted strings as variable names
- info.allowDoubleQuotedVariable = isDoubleQuotedVariablesAllowed;
+ info.ansiQuotedIdentifiers = isDoubleQuotedVariablesAllowed;
CacheID id = new PreparedPlanCache.CacheID(workContext, info, sql);
PreparedPlanCache.PreparedPlan plan = planCache.getPreparedPlan(id);
if(plan != null) {
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2009-11-20
17:58:23 UTC (rev 1579)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/Request.java 2009-11-20
18:53:09 UTC (rev 1580)
@@ -333,7 +333,7 @@
public static ParseInfo createParseInfo(RequestMessage requestMsg) {
ParseInfo parseInfo = new ParseInfo();
- parseInfo.allowDoubleQuotedVariable = requestMsg.isDoubleQuotedVariableAllowed();
+ parseInfo.ansiQuotedIdentifiers = requestMsg.isDoubleQuotedVariableAllowed();
return parseInfo;
}
@@ -584,8 +584,8 @@
boolean isRootXQuery = recursionGroup == null &&
commandContext.getCallStackDepth() == 0 && userCommand instanceof XQuery;
ParseInfo parseInfo = new ParseInfo();
- if (isRootXQuery && requestMsg.isDoubleQuotedVariableAllowed()) {
- parseInfo.allowDoubleQuotedVariable = true;
+ if (isRootXQuery) {
+ parseInfo.ansiQuotedIdentifiers = requestMsg.isDoubleQuotedVariableAllowed();
}
Command newCommand = QueryParser.getQueryParser().parseCommand(query, parseInfo);
QueryResolver.resolveCommand(newCommand, metadata);
Modified: trunk/engine/src/test/java/com/metamatrix/query/parser/TestParser.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/parser/TestParser.java 2009-11-20
17:58:23 UTC (rev 1579)
+++ trunk/engine/src/test/java/com/metamatrix/query/parser/TestParser.java 2009-11-20
18:53:09 UTC (rev 1580)
@@ -2221,7 +2221,7 @@
query.setSelect(select);
query.setFrom(from);
ParseInfo info = new ParseInfo();
- info.allowDoubleQuotedVariable = false;
+ info.ansiQuotedIdentifiers = false;
helpTest("SELECT \"g\"\".\"\"a\" from g",
//$NON-NLS-1$
"SELECT 'g\".\"a' FROM g", //$NON-NLS-1$
query, info);
Modified:
trunk/engine/src/test/java/com/metamatrix/query/processor/xml/TestXMLProcessor.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/processor/xml/TestXMLProcessor.java 2009-11-20
17:58:23 UTC (rev 1579)
+++
trunk/engine/src/test/java/com/metamatrix/query/processor/xml/TestXMLProcessor.java 2009-11-20
18:53:09 UTC (rev 1580)
@@ -67,7 +67,6 @@
import com.metamatrix.query.optimizer.capabilities.DefaultCapabilitiesFinder;
import com.metamatrix.query.optimizer.capabilities.SourceCapabilities.Capability;
import com.metamatrix.query.optimizer.xml.TestXMLPlanner;
-import com.metamatrix.query.parser.ParseInfo;
import com.metamatrix.query.parser.QueryParser;
import com.metamatrix.query.processor.FakeDataManager;
import com.metamatrix.query.processor.QueryProcessor;
@@ -2928,9 +2927,7 @@
public static Command helpGetCommand(String sql, QueryMetadataInterface metadata)
throws QueryParserException, QueryResolverException, MetaMatrixComponentException,
QueryValidatorException {
QueryParser parser = new QueryParser();
- ParseInfo info = new ParseInfo();
- info.allowDoubleQuotedVariable = true;
- Command command = parser.parseCommand(sql, info);
+ Command command = parser.parseCommand(sql);
QueryResolver.resolveCommand(command, metadata);
command = QueryRewriter.rewrite(command, null, metadata, null);
return command;
Modified: trunk/engine/src/test/java/com/metamatrix/query/resolver/TestXMLResolver.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/query/resolver/TestXMLResolver.java 2009-11-20
17:58:23 UTC (rev 1579)
+++
trunk/engine/src/test/java/com/metamatrix/query/resolver/TestXMLResolver.java 2009-11-20
18:53:09 UTC (rev 1580)
@@ -31,7 +31,6 @@
import com.metamatrix.common.types.DataTypeManager;
import com.metamatrix.query.analysis.AnalysisRecord;
-import com.metamatrix.query.parser.ParseInfo;
import com.metamatrix.query.parser.QueryParser;
import com.metamatrix.query.sql.lang.Command;
import com.metamatrix.query.sql.lang.CompareCriteria;
@@ -442,9 +441,7 @@
expected.setOperator(CompareCriteria.EQ);
expected.setRightExpression(new Constant("yyz")); //$NON-NLS-1$
- ParseInfo info = new ParseInfo();
- info.allowDoubleQuotedVariable = true;
- Query query = (Query)
TestResolver.helpResolve(QueryParser.getQueryParser().parseCommand("select
\"xml\" from xmltest.doc1 where node1 = 'yyz'", info),
FakeMetadataFactory.example1Cached(), null); //$NON-NLS-1$
+ Query query = (Query)
TestResolver.helpResolve(QueryParser.getQueryParser().parseCommand("select
\"xml\" from xmltest.doc1 where node1 = 'yyz'"),
FakeMetadataFactory.example1Cached(), null); //$NON-NLS-1$
Criteria actual = query.getCriteria();
assertEquals("Did not match expected criteria", expected, actual);
//$NON-NLS-1$
}