Author: shawkins
Date: 2010-02-27 07:48:26 -0500 (Sat, 27 Feb 2010)
New Revision: 1879
Added:
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Select.java
Removed:
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/From.java
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/QuerySpecification.java
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Select.java
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestFromImpl.java
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSelectImpl.java
Modified:
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/LanguageFactory.java
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/QueryExpression.java
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/ScalarSubquery.java
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/SetQuery.java
branches/JCA/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Procedure.java
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/framework/AbstractLanguageVisitor.java
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/framework/DelegatingHierarchyVisitor.java
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/framework/HierarchyVisitor.java
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/framework/LanguageObjectVisitor.java
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/util/CollectorVisitor.java
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/util/SQLStringVisitor.java
branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/ConnectorShellCommandTarget.java
branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java
branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCUpdateExecution.java
branches/JCA/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/IQueryToLdapSearchParser.java
branches/JCA/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPConnection.java
branches/JCA/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPSyncQueryExecution.java
branches/JCA/connectors/connector-ldap/src/test/java/com/metamatrix/connector/ldap/TestIQueryToLdapSearchParser.java
branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/QueryExecutionImpl.java
branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/SelectVisitor.java
branches/JCA/connectors/connector-salesforce/src/test/java/com/metamatrix/connector/salesforce/execution/visitors/TestVisitors.java
branches/JCA/connectors/connector-text/src/main/java/com/metamatrix/connector/text/TextConnection.java
branches/JCA/connectors/connector-text/src/main/java/com/metamatrix/connector/text/TextSynchExecution.java
branches/JCA/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/http/HTTPConnectionImpl.java
branches/JCA/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/http/HTTPExecution.java
branches/JCA/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SOAPConnectionImpl.java
branches/JCA/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SOAPExecution.java
branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/IQueryPreprocessor.java
branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/CriteriaDesc.java
branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/QueryAnalyzer.java
branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/streaming/BaseStreamingExecution.java
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/MockQueryPreprocessor.java
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/TestElementCollector.java
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/ProxyObjectFactory.java
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestCriteriaDesc.java
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestExecutionInfo.java
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestOutputXPathDesc.java
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestParameterDescriptor.java
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestQueryAnalyzer.java
branches/JCA/connectors/connector-xmlsource-file/src/main/java/org/teiid/connector/xmlsource/file/FileConnection.java
branches/JCA/connectors/connector-xmlsource-file/src/main/java/org/teiid/connector/xmlsource/file/FileResultSetExecution.java
branches/JCA/connectors/connector-xmlsource-soap/src/main/java/org/teiid/connector/xmlsource/soap/SOAPResultSetExecution.java
branches/JCA/connectors/connector-xmlsource-soap/src/main/java/org/teiid/connector/xmlsource/soap/SoapConnection.java
branches/JCA/connectors/sandbox/connector-exec/src/main/java/com/metamatrix/connector/exec/ExecAntExecution.java
branches/JCA/connectors/sandbox/connector-exec/src/main/java/com/metamatrix/connector/exec/ExecConnection.java
branches/JCA/connectors/sandbox/connector-yahoo/src/main/java/com/metamatrix/connector/yahoo/YahooConnection.java
branches/JCA/connectors/sandbox/connector-yahoo/src/main/java/com/metamatrix/connector/yahoo/YahooExecution.java
branches/JCA/connectors/sandbox/connector-yahoo/src/test/java/com/metamatrix/connector/yahoo/TestYahooTranslation.java
branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LanguageBridgeFactory.java
branches/JCA/engine/src/test/java/com/metamatrix/dqp/message/TestAtomicRequestMessage.java
branches/JCA/engine/src/test/java/com/metamatrix/query/unittest/RealMetadataFactory.java
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestExistsCriteriaImpl.java
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestInlineViewImpl.java
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestQueryImpl.java
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestScalarSubqueryImpl.java
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSelectSymbolImpl.java
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSetQueryImpl.java
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSubqueryCompareCriteriaImpl.java
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSubqueryInCriteriaImpl.java
branches/JCA/test-integration/common/src/test/java/com/metamatrix/cdk/api/TestTranslationUtility.java
branches/JCA/test-integration/common/src/test/java/com/metamatrix/connector/jdbc/extension/TestSQLConversionVisitor.java
branches/JCA/test-integration/common/src/test/java/com/metamatrix/connector/jdbc/util/TestJDBCExecutionHelper.java
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/language/TestLanguageUtil.java
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/MockConnector.java
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestElement.java
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestGroup.java
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestMetadataObject.java
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestCollectorVisitor.java
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestSQLStringVisitor.java
Log:
TEIID-1003 removing the select and from classes and renaming queryspecification to
select.
Deleted: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/From.java
===================================================================
---
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/From.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/From.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.connector.language;
-
-import java.util.List;
-
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-/**
- * Represents a FROM clause in a query.
- */
-public class From extends BaseLanguageObject {
-
- private List<TableReference> items;
-
- public From(List<TableReference> items) {
- this.items = items;
- }
-
- /**
- * Get a List of IFromItem in this FROM clause.
- * @return List of IFromItem
- */
- public List<TableReference> getItems() {
- return items;
- }
-
- public void acceptVisitor(LanguageObjectVisitor visitor) {
- visitor.visit(this);
- }
-
- public void setItems(List<TableReference> items) {
- this.items = items;
- }
-
-}
Modified:
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/LanguageFactory.java
===================================================================
---
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/LanguageFactory.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/LanguageFactory.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -67,14 +67,10 @@
return new ColumnReference(group, name, metadataReference, type);
}
- public Exists createExists(QuerySpecification query) {
+ public Exists createExists(Select query) {
return new Exists(query);
}
- public From createFrom(List<TableReference> items) {
- return new From(items);
- }
-
public Function createFunction(String functionName, Expression[] args, Class<?>
type) {
return new Function(functionName, Arrays.asList(args), type);
}
@@ -143,17 +139,18 @@
return new Call(name, parameters, metadataReference);
}
- public QuerySpecification createQuery(
- Select select,
- From from,
+ public Select createQuery(
+ List<DerivedColumn> select,
+ boolean isDistinct,
+ List<TableReference> from,
Condition where,
GroupBy groupBy,
Condition having,
OrderBy orderBy) {
- return new QuerySpecification(select, from, where, groupBy, having, orderBy);
+ return new Select(select, isDistinct, from, where, groupBy, having, orderBy);
}
- public ScalarSubquery createScalarSubquery(QuerySpecification query) {
+ public ScalarSubquery createScalarSubquery(Select query) {
return new ScalarSubquery(query);
}
@@ -165,10 +162,6 @@
return new SearchedCase(new ArrayList<Condition>(whenExpressions), new
ArrayList<Expression>(thenExpressions), elseExpression, type);
}
- public Select createSelect(boolean isDistinct, List<DerivedColumn>
selectSymbols) {
- return new Select(selectSymbols, isDistinct);
- }
-
public DerivedColumn createSelectSymbol(String name, Expression expression) {
return new DerivedColumn(name, expression);
}
@@ -177,11 +170,11 @@
Expression leftExpression,
Comparison.Operator operator,
SubqueryComparison.Quantifier quantifier,
- QuerySpecification subquery) {
+ Select subquery) {
return new SubqueryComparison(leftExpression, operator, quantifier, subquery);
}
- public SubqueryIn createSubqueryInCriteria(Expression expression, QuerySpecification
subquery, boolean isNegated) {
+ public SubqueryIn createSubqueryInCriteria(Expression expression, Select subquery,
boolean isNegated) {
return new SubqueryIn(expression, isNegated, subquery);
}
Modified:
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/QueryExpression.java
===================================================================
---
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/QueryExpression.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/QueryExpression.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -29,7 +29,7 @@
private OrderBy orderBy;
private Limit limit;
- public abstract QuerySpecification getProjectedQuery();
+ public abstract Select getProjectedQuery();
/**
* Get ORDER BY clause, may be null.
@@ -54,7 +54,7 @@
* @since 4.3
*/
public String[] getColumnNames() {
- List<DerivedColumn> selectSymbols =
getProjectedQuery().getSelect().getDerivedColumns();
+ List<DerivedColumn> selectSymbols =
getProjectedQuery().getDerivedColumns();
String[] columnNames = new String[selectSymbols.size()];
int symbolIndex = 0;
for (DerivedColumn column : selectSymbols) {
@@ -69,7 +69,7 @@
* @since 4.3
*/
public Class<?>[] getColumnTypes() {
- List<DerivedColumn> selectSymbols =
getProjectedQuery().getSelect().getDerivedColumns();
+ List<DerivedColumn> selectSymbols =
getProjectedQuery().getDerivedColumns();
Class<?>[] columnTypes = new Class[selectSymbols.size()];
int symbolIndex = 0;
for (DerivedColumn column : selectSymbols) {
Deleted:
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/QuerySpecification.java
===================================================================
---
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/QuerySpecification.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/QuerySpecification.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -1,135 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.connector.language;
-
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-/**
- * Represents a simple SELECT query.
- */
-public class QuerySpecification extends QueryExpression {
-
- private Select select;
- private From from;
- private Condition where;
- private GroupBy groupBy;
- private Condition having;
-
- public QuerySpecification(Select select, From from, Condition where,
- GroupBy groupBy, Condition having, OrderBy orderBy) {
- this.select = select;
- this.from = from;
- this.where = where;
- this.groupBy = groupBy;
- this.having = having;
- this.setOrderBy(orderBy);
- }
-
- /**
- * Get SELECT clause, should never be null.
- * @return Select clause object
- */
- public Select getSelect() {
- return select;
- }
-
- /**
- * Get FROM clause, should never be null.
- * @return From clause object
- */
- public From getFrom() {
- return from;
- }
-
- /**
- * Get WHERE clause, may be null.
- * @return A criteria object
- */
- public Condition getWhere() {
- return where;
- }
-
- /**
- * Get GROUP BY clause, may be null.
- * @return A group by object
- */
- public GroupBy getGroupBy() {
- return groupBy;
- }
-
- /**
- * Get HAVING clause, may be null.
- * @return A criteria object
- */
- public Condition getHaving() {
- return having;
- }
-
- public void acceptVisitor(LanguageObjectVisitor visitor) {
- visitor.visit(this);
- }
-
- /**
- * Set SELECT clause, should never be null.
- * @param select Select clause object
- */
- public void setSelect(Select select) {
- this.select = select;
- }
-
- /**
- * Set FROM clause, should never be null.
- * @param from From clause object
- */
- public void setFrom(From from) {
- this.from = from;
- }
-
- /**
- * Set WHERE clause, may be null.
- * @param criteria A criteria object
- */
- public void setWhere(Condition criteria) {
- this.where = criteria;
- }
-
- /**
- * Set GROUP BY clause, may be null.
- * @param groupBy A group by object
- */
- public void setGroupBy(GroupBy groupBy) {
- this.groupBy = groupBy;
- }
-
- /**
- * Set HAVING clause, may be null.
- * @param criteria A criteria object
- */
- public void setHaving(Condition criteria) {
- this.having = criteria;
- }
-
- public QuerySpecification getProjectedQuery() {
- return this;
- }
-}
Modified:
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/ScalarSubquery.java
===================================================================
---
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/ScalarSubquery.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/ScalarSubquery.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -53,7 +53,7 @@
@Override
public Class<?> getType() {
- return
query.getProjectedQuery().getSelect().getDerivedColumns().get(0).getExpression().getType();
+ return
query.getProjectedQuery().getDerivedColumns().get(0).getExpression().getType();
}
Deleted:
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Select.java
===================================================================
---
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Select.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Select.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -1,59 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.connector.language;
-
-import java.util.List;
-
-import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
-
-public class Select extends BaseLanguageObject {
-
- private List<DerivedColumn> derivedColumns;
- private boolean isDistinct;
-
- public Select(List<DerivedColumn> derivedColumns, boolean distinct) {
- this.derivedColumns = derivedColumns;
- this.isDistinct = distinct;
- }
-
- public List<DerivedColumn> getDerivedColumns() {
- return derivedColumns;
- }
-
- public boolean isDistinct() {
- return this.isDistinct;
- }
-
- public void acceptVisitor(LanguageObjectVisitor visitor) {
- visitor.visit(this);
- }
-
- public void setDerivedColumns(List<DerivedColumn> symbols) {
- this.derivedColumns = symbols;
- }
-
- public void setDistinct(boolean distinct) {
- this.isDistinct = distinct;
- }
-
-}
Copied: branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Select.java
(from rev 1878,
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/QuerySpecification.java)
===================================================================
--- branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Select.java
(rev 0)
+++
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/Select.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -0,0 +1,139 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.connector.language;
+
+import java.util.List;
+
+import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
+
+/**
+ * Represents a simple SELECT query.
+ */
+public class Select extends QueryExpression {
+
+ private List<DerivedColumn> derivedColumns;
+ private boolean isDistinct;
+ private List<TableReference> from;
+ private Condition where;
+ private GroupBy groupBy;
+ private Condition having;
+
+ public Select(List<DerivedColumn> derivedColumns, boolean distinct,
List<TableReference> from, Condition where,
+ GroupBy groupBy, Condition having, OrderBy orderBy) {
+ this.derivedColumns = derivedColumns;
+ this.isDistinct = distinct;
+ this.from = from;
+ this.where = where;
+ this.groupBy = groupBy;
+ this.having = having;
+ this.setOrderBy(orderBy);
+ }
+
+ public List<DerivedColumn> getDerivedColumns() {
+ return derivedColumns;
+ }
+
+ public boolean isDistinct() {
+ return this.isDistinct;
+ }
+
+ public void setDerivedColumns(List<DerivedColumn> symbols) {
+ this.derivedColumns = symbols;
+ }
+
+ public void setDistinct(boolean distinct) {
+ this.isDistinct = distinct;
+ }
+
+ /**
+ * Get FROM clause, should never be null.
+ * @return From clause object
+ */
+ public List<TableReference> getFrom() {
+ return from;
+ }
+
+ /**
+ * Get WHERE clause, may be null.
+ * @return A criteria object
+ */
+ public Condition getWhere() {
+ return where;
+ }
+
+ /**
+ * Get GROUP BY clause, may be null.
+ * @return A group by object
+ */
+ public GroupBy getGroupBy() {
+ return groupBy;
+ }
+
+ /**
+ * Get HAVING clause, may be null.
+ * @return A criteria object
+ */
+ public Condition getHaving() {
+ return having;
+ }
+
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ /**
+ * Set FROM clause, should never be null.
+ * @param from From clause object
+ */
+ public void setFrom(List<TableReference> from) {
+ this.from = from;
+ }
+
+ /**
+ * Set WHERE clause, may be null.
+ * @param criteria A criteria object
+ */
+ public void setWhere(Condition criteria) {
+ this.where = criteria;
+ }
+
+ /**
+ * Set GROUP BY clause, may be null.
+ * @param groupBy A group by object
+ */
+ public void setGroupBy(GroupBy groupBy) {
+ this.groupBy = groupBy;
+ }
+
+ /**
+ * Set HAVING clause, may be null.
+ * @param criteria A criteria object
+ */
+ public void setHaving(Condition criteria) {
+ this.having = criteria;
+ }
+
+ public Select getProjectedQuery() {
+ return this;
+ }
+}
Modified:
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/SetQuery.java
===================================================================
---
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/SetQuery.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connector-api/src/main/java/org/teiid/connector/language/SetQuery.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -43,9 +43,9 @@
/**
* @see org.teiid.connector.language.QueryExpression#getProjectedQuery()
*/
- public QuerySpecification getProjectedQuery() {
- if (leftQuery instanceof QuerySpecification) {
- return (QuerySpecification)leftQuery;
+ public Select getProjectedQuery() {
+ if (leftQuery instanceof Select) {
+ return (Select)leftQuery;
}
return leftQuery.getProjectedQuery();
}
Modified:
branches/JCA/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Procedure.java
===================================================================
---
branches/JCA/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Procedure.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connector-api/src/main/java/org/teiid/connector/metadata/runtime/Procedure.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -22,6 +22,7 @@
package org.teiid.connector.metadata.runtime;
+import java.util.LinkedList;
import java.util.List;
@@ -40,7 +41,7 @@
private boolean isFunction;
private boolean isVirtual;
private int updateCount = 1;
- private List<ProcedureParameter> parameters;
+ private List<ProcedureParameter> parameters = new
LinkedList<ProcedureParameter>();
private ColumnSet<Procedure> resultSet;
private String queryPlan;
Modified:
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/framework/AbstractLanguageVisitor.java
===================================================================
---
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/framework/AbstractLanguageVisitor.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/framework/AbstractLanguageVisitor.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -36,7 +36,6 @@
import org.teiid.connector.language.DerivedTable;
import org.teiid.connector.language.Exists;
import org.teiid.connector.language.ExpressionValueSource;
-import org.teiid.connector.language.From;
import org.teiid.connector.language.Function;
import org.teiid.connector.language.GroupBy;
import org.teiid.connector.language.In;
@@ -50,10 +49,9 @@
import org.teiid.connector.language.NamedTable;
import org.teiid.connector.language.Not;
import org.teiid.connector.language.OrderBy;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.language.ScalarSubquery;
import org.teiid.connector.language.SearchedCase;
-import org.teiid.connector.language.Select;
import org.teiid.connector.language.SetClause;
import org.teiid.connector.language.SetClauseList;
import org.teiid.connector.language.SetQuery;
@@ -122,7 +120,6 @@
public void visit(ColumnReference obj) {}
public void visit(Call obj) {}
public void visit(Exists obj) {}
- public void visit(From obj) {}
public void visit(Function obj) {}
public void visit(NamedTable obj) {}
public void visit(GroupBy obj) {}
@@ -139,10 +136,9 @@
public void visit(OrderBy obj) {}
public void visit(SortSpecification obj) {}
public void visit(Argument obj) {}
- public void visit(QuerySpecification obj) {}
+ public void visit(Select obj) {}
public void visit(ScalarSubquery obj) {}
public void visit(SearchedCase obj) {}
- public void visit(Select obj) {}
public void visit(DerivedColumn obj) {}
public void visit(SubqueryComparison obj) {}
public void visit(SubqueryIn obj) {}
Modified:
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/framework/DelegatingHierarchyVisitor.java
===================================================================
---
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/framework/DelegatingHierarchyVisitor.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/framework/DelegatingHierarchyVisitor.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -34,7 +34,6 @@
import org.teiid.connector.language.DerivedColumn;
import org.teiid.connector.language.DerivedTable;
import org.teiid.connector.language.Exists;
-import org.teiid.connector.language.From;
import org.teiid.connector.language.Function;
import org.teiid.connector.language.GroupBy;
import org.teiid.connector.language.In;
@@ -48,10 +47,9 @@
import org.teiid.connector.language.NamedTable;
import org.teiid.connector.language.Not;
import org.teiid.connector.language.OrderBy;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.language.ScalarSubquery;
import org.teiid.connector.language.SearchedCase;
-import org.teiid.connector.language.Select;
import org.teiid.connector.language.SetClause;
import org.teiid.connector.language.SetClauseList;
import org.teiid.connector.language.SetQuery;
@@ -163,15 +161,6 @@
postVisitor.visit(obj);
}
}
- public void visit(From obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
public void visit(Function obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
@@ -309,7 +298,7 @@
postVisitor.visit(obj);
}
}
- public void visit(QuerySpecification obj) {
+ public void visit(Select obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
}
@@ -337,15 +326,6 @@
postVisitor.visit(obj);
}
}
- public void visit(Select obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
public void visit(DerivedColumn obj) {
if (preVisitor != null) {
preVisitor.visit(obj);
Modified:
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/framework/HierarchyVisitor.java
===================================================================
---
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/framework/HierarchyVisitor.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/framework/HierarchyVisitor.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -32,7 +32,6 @@
import org.teiid.connector.language.DerivedTable;
import org.teiid.connector.language.Exists;
import org.teiid.connector.language.ExpressionValueSource;
-import org.teiid.connector.language.From;
import org.teiid.connector.language.Function;
import org.teiid.connector.language.GroupBy;
import org.teiid.connector.language.In;
@@ -43,10 +42,9 @@
import org.teiid.connector.language.Not;
import org.teiid.connector.language.OrderBy;
import org.teiid.connector.language.QueryExpression;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.language.ScalarSubquery;
import org.teiid.connector.language.SearchedCase;
-import org.teiid.connector.language.Select;
import org.teiid.connector.language.SetClause;
import org.teiid.connector.language.SetClauseList;
import org.teiid.connector.language.SetQuery;
@@ -110,10 +108,6 @@
}
}
- public void visit(From obj) {
- visitNodes(obj.getItems());
- }
-
public void visit(Function obj) {
visitNodes(obj.getParameters());
}
@@ -163,9 +157,9 @@
visitNodes(obj.getSortSpecifications());
}
- public void visit(QuerySpecification obj) {
- visitNode(obj.getSelect());
- visitNode(obj.getFrom());
+ public void visit(Select obj) {
+ visitNodes(obj.getDerivedColumns());
+ visitNodes(obj.getFrom());
visitNode(obj.getWhere());
visitNode(obj.getGroupBy());
visitNode(obj.getHaving());
@@ -187,10 +181,6 @@
visitNode(obj.getElseExpression());
}
- public void visit(Select obj) {
- visitNodes(obj.getDerivedColumns());
- }
-
public void visit(DerivedColumn obj) {
visitNode(obj.getExpression());
}
Modified:
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/framework/LanguageObjectVisitor.java
===================================================================
---
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/framework/LanguageObjectVisitor.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/framework/LanguageObjectVisitor.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -36,7 +36,6 @@
public void visit(ColumnReference obj);
public void visit(Call obj);
public void visit(Exists obj);
- public void visit(From obj);
public void visit(Function obj);
public void visit(NamedTable obj);
public void visit(GroupBy obj);
@@ -52,10 +51,9 @@
public void visit(OrderBy obj);
public void visit(SortSpecification obj);
public void visit(Argument obj);
- public void visit(QuerySpecification obj);
+ public void visit(Select obj);
public void visit(ScalarSubquery obj);
public void visit(SearchedCase obj);
- public void visit(Select obj);
public void visit(DerivedColumn obj);
public void visit(SubqueryComparison obj);
public void visit(SubqueryIn obj);
Modified:
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/util/CollectorVisitor.java
===================================================================
---
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/util/CollectorVisitor.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/util/CollectorVisitor.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -39,7 +39,6 @@
import org.teiid.connector.language.DerivedTable;
import org.teiid.connector.language.Exists;
import org.teiid.connector.language.ExpressionValueSource;
-import org.teiid.connector.language.From;
import org.teiid.connector.language.Function;
import org.teiid.connector.language.GroupBy;
import org.teiid.connector.language.In;
@@ -53,10 +52,9 @@
import org.teiid.connector.language.NamedTable;
import org.teiid.connector.language.Not;
import org.teiid.connector.language.OrderBy;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.language.ScalarSubquery;
import org.teiid.connector.language.SearchedCase;
-import org.teiid.connector.language.Select;
import org.teiid.connector.language.SetClause;
import org.teiid.connector.language.SetClauseList;
import org.teiid.connector.language.SetQuery;
@@ -121,10 +119,6 @@
checkInstance(obj);
}
- public void visit(From obj) {
- checkInstance(obj);
- }
-
public void visit(Function obj) {
checkInstance(obj);
}
@@ -193,7 +187,7 @@
checkInstance(obj);
}
- public void visit(QuerySpecification obj) {
+ public void visit(Select obj) {
checkInstance(obj);
}
@@ -205,10 +199,6 @@
checkInstance(obj);
}
- public void visit(Select obj) {
- checkInstance(obj);
- }
-
public void visit(DerivedColumn obj) {
checkInstance(obj);
}
Modified:
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/util/SQLStringVisitor.java
===================================================================
---
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/util/SQLStringVisitor.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connector-api/src/main/java/org/teiid/connector/visitor/util/SQLStringVisitor.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -41,7 +41,6 @@
import org.teiid.connector.language.Exists;
import org.teiid.connector.language.Expression;
import org.teiid.connector.language.ExpressionValueSource;
-import org.teiid.connector.language.From;
import org.teiid.connector.language.Function;
import org.teiid.connector.language.GroupBy;
import org.teiid.connector.language.In;
@@ -56,10 +55,9 @@
import org.teiid.connector.language.Not;
import org.teiid.connector.language.OrderBy;
import org.teiid.connector.language.QueryExpression;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.language.ScalarSubquery;
import org.teiid.connector.language.SearchedCase;
-import org.teiid.connector.language.Select;
import org.teiid.connector.language.SetClause;
import org.teiid.connector.language.SetClauseList;
import org.teiid.connector.language.SetQuery;
@@ -349,15 +347,6 @@
buffer.append(SQLReservedWords.RPAREN);
}
- /**
- * @see
com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.From)
- */
- public void visit(From obj) {
- buffer.append(SQLReservedWords.FROM)
- .append(SQLReservedWords.SPACE);
- append(obj.getItems());
- }
-
protected boolean isInfixFunction(String function) {
return infixFunctions.contains(function);
}
@@ -690,10 +679,15 @@
buffer.append(obj.getArgumentValue());
}
- public void visit(QuerySpecification obj) {
- visitSelect(obj.getSelect(), obj);
+ public void visit(Select obj) {
+ buffer.append(SQLReservedWords.SELECT).append(SQLReservedWords.SPACE);
+ buffer.append(getSourceComment(obj));
+ if (obj.isDistinct()) {
+ buffer.append(SQLReservedWords.DISTINCT).append(SQLReservedWords.SPACE);
+ }
+ append(obj.getDerivedColumns());
if (obj.getFrom() != null) {
- buffer.append(SQLReservedWords.SPACE);
+
buffer.append(SQLReservedWords.SPACE).append(SQLReservedWords.FROM).append(SQLReservedWords.SPACE);
append(obj.getFrom());
}
if (obj.getWhere() != null) {
@@ -745,19 +739,6 @@
.append(SQLReservedWords.END);
}
- public void visit(Select obj) {
- visitSelect(obj, null);
- }
-
- private void visitSelect(Select obj, Command command) {
- buffer.append(SQLReservedWords.SELECT).append(SQLReservedWords.SPACE);
- buffer.append(getSourceComment(command));
- if (obj.isDistinct()) {
- buffer.append(SQLReservedWords.DISTINCT).append(SQLReservedWords.SPACE);
- }
- append(obj.getDerivedColumns());
- }
-
protected String getSourceComment(Command command) {
return ""; //$NON-NLS-1$
}
Modified:
branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/ConnectorShellCommandTarget.java
===================================================================
---
branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/ConnectorShellCommandTarget.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connector-sdk/src/main/java/com/metamatrix/cdk/ConnectorShellCommandTarget.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -46,7 +46,7 @@
import org.teiid.connector.api.ExecutionContext;
import org.teiid.connector.language.Command;
import org.teiid.connector.language.Call;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import com.metamatrix.cdk.api.ConnectorHost;
import com.metamatrix.cdk.file.ConfigReaderWriter;
@@ -92,8 +92,8 @@
try {
Command command = getConnectorHost().getCommand(query);
String[] columnNames = null;
- if(command instanceof QuerySpecification) {
- QuerySpecification iquery = (QuerySpecification) command;
+ if(command instanceof Select) {
+ Select iquery = (Select) command;
columnNames = iquery.getColumnNames();
} else if (!(command instanceof Call)){
columnNames = new String[] {"count"}; //$NON-NLS-1$
Modified:
branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java
===================================================================
---
branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -54,7 +54,7 @@
import org.teiid.connector.language.Insert;
import org.teiid.connector.language.ExpressionValueSource;
import org.teiid.connector.language.Limit;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.language.QueryExpression;
import org.teiid.connector.language.DerivedColumn;
import org.teiid.connector.language.SetQuery.Operation;
@@ -234,7 +234,7 @@
* we just use the projected names
*/
boolean allAliased = true;
- for (DerivedColumn selectSymbol :
queryCommand.getProjectedQuery().getSelect().getDerivedColumns()) {
+ for (DerivedColumn selectSymbol :
queryCommand.getProjectedQuery().getDerivedColumns()) {
if (selectSymbol.getAlias() == null) {
allAliased = false;
break;
@@ -297,7 +297,7 @@
}
}
- if (command instanceof QuerySpecification) {
+ if (command instanceof Select) {
//
// This simple algorithm determines the hint which will be added to the
// query.
Modified:
branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCUpdateExecution.java
===================================================================
---
branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCUpdateExecution.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCUpdateExecution.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -51,7 +51,7 @@
Connection connection = Mockito.mock(Connection.class);
PreparedStatement p = Mockito.mock(PreparedStatement.class);
Mockito.stub(p.executeBatch()).toReturn(new int [] {1, 1});
- Mockito.stub(connection.prepareStatement("INSERT INTO BQT1.SmallA (IntKey, IntNum)
VALUES (?, ?)")).toReturn(p); //$NON-NLS-1$
+ Mockito.stub(connection.prepareStatement("INSERT INTO SmallA (IntKey, IntNum)
VALUES (?, ?)")).toReturn(p); //$NON-NLS-1$
JDBCManagedConnectionFactory config =
Mockito.mock(JDBCManagedConnectionFactory.class);
Mockito.stub(config.getExtensionTranslationClass()).toReturn(new Translator());
Modified:
branches/JCA/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/IQueryToLdapSearchParser.java
===================================================================
---
branches/JCA/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/IQueryToLdapSearchParser.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/IQueryToLdapSearchParser.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -64,7 +64,7 @@
import org.teiid.connector.language.NamedTable;
import org.teiid.connector.language.Not;
import org.teiid.connector.language.OrderBy;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.language.ScalarSubquery;
import org.teiid.connector.language.SearchedCase;
import org.teiid.connector.language.SortSpecification;
@@ -112,7 +112,7 @@
// ou=people,dc=company,dc=com?SUBTREE_SCOPE?RESTRICT
// TODO - change method for calling RESTRICT to also specify
// object class name (RESTRICT=inetOrgPerson)
- public LDAPSearchDetails translateSQLQueryToLDAPSearch(QuerySpecification query) throws
ConnectorException {
+ public LDAPSearchDetails translateSQLQueryToLDAPSearch(Select query) throws
ConnectorException {
// Parse SELECT symbols.
// The columns will be translated into LDAP attributes of interest.
ArrayList attributeList = getAttributesFromSelectSymbols(query);
@@ -120,7 +120,7 @@
// Parse FROM table.
// Only one table is expected here.
- List fromList = query.getFrom().getItems();
+ List fromList = query.getFrom();
Iterator itr = fromList.listIterator();
if(!itr.hasNext()) {
final String msg =
LDAPPlugin.Util.getString("IQueryToLdapSearchParser.noTablesInFromError");
//$NON-NLS-1$
@@ -607,9 +607,9 @@
* @param query the supplied Query
* @return the list of SELECT elements
*/
- private ArrayList getElementsFromSelectSymbols(QuerySpecification query) throws
ConnectorException {
+ private ArrayList getElementsFromSelectSymbols(Select query) throws ConnectorException
{
ArrayList selectElementList = new ArrayList();
- Iterator selectSymbolItr = query.getSelect().getDerivedColumns().iterator();
+ Iterator selectSymbolItr = query.getDerivedColumns().iterator();
while(selectSymbolItr.hasNext()) {
Column e = getElementFromSymbol((DerivedColumn)selectSymbolItr.next());
@@ -623,10 +623,10 @@
* @param query the supplied Query
* @return the list of attributes
*/
- private ArrayList getAttributesFromSelectSymbols(QuerySpecification query) throws
ConnectorException {
+ private ArrayList getAttributesFromSelectSymbols(Select query) throws ConnectorException
{
ArrayList ldapAttributeList = new ArrayList();
- Iterator selectSymbolItr = query.getSelect().getDerivedColumns().iterator();
+ Iterator selectSymbolItr = query.getDerivedColumns().iterator();
int i=0;
while(selectSymbolItr.hasNext()) {
Column e = getElementFromSymbol((DerivedColumn)selectSymbolItr.next());
Modified:
branches/JCA/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPConnection.java
===================================================================
---
branches/JCA/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPConnection.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPConnection.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -36,7 +36,7 @@
import org.teiid.connector.api.UpdateExecution;
import org.teiid.connector.basic.BasicConnection;
import org.teiid.connector.language.Command;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.language.QueryExpression;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
@@ -157,7 +157,7 @@
public ResultSetExecution createResultSetExecution(QueryExpression command,
ExecutionContext executionContext, RuntimeMetadata metadata)
throws ConnectorException {
- return new LDAPSyncQueryExecution((QuerySpecification)command, executionContext,
metadata, this.initCtx, this.config);
+ return new LDAPSyncQueryExecution((Select)command, executionContext, metadata,
this.initCtx, this.config);
}
@Override
Modified:
branches/JCA/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPSyncQueryExecution.java
===================================================================
---
branches/JCA/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPSyncQueryExecution.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-ldap/src/main/java/com/metamatrix/connector/ldap/LDAPSyncQueryExecution.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -98,7 +98,7 @@
import org.teiid.connector.api.ExecutionContext;
import org.teiid.connector.api.ResultSetExecution;
import org.teiid.connector.basic.BasicExecution;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.metadata.runtime.Column;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
@@ -115,7 +115,7 @@
private LdapContext ldapCtx;
private NamingEnumeration searchEnumeration;
private IQueryToLdapSearchParser parser;
- private QuerySpecification query;
+ private Select query;
private LDAPManagedConnectionFactory config;
/**
@@ -126,7 +126,7 @@
* @param logger the ConnectorLogger
* @param ldapCtx the LDAP Context
*/
- public LDAPSyncQueryExecution(QuerySpecification query, ExecutionContext ctx,
RuntimeMetadata rm, InitialLdapContext ldapCtx, LDAPManagedConnectionFactory config)
throws ConnectorException {
+ public LDAPSyncQueryExecution(Select query, ExecutionContext ctx, RuntimeMetadata rm,
InitialLdapContext ldapCtx, LDAPManagedConnectionFactory config) throws ConnectorException
{
this.rm = rm;
this.initialLdapContext = ldapCtx;
this.query = query;
Modified:
branches/JCA/connectors/connector-ldap/src/test/java/com/metamatrix/connector/ldap/TestIQueryToLdapSearchParser.java
===================================================================
---
branches/JCA/connectors/connector-ldap/src/test/java/com/metamatrix/connector/ldap/TestIQueryToLdapSearchParser.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-ldap/src/test/java/com/metamatrix/connector/ldap/TestIQueryToLdapSearchParser.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -37,7 +37,7 @@
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ConnectorLogger;
import org.teiid.connector.language.Command;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
import org.teiid.dqp.internal.datamgr.metadata.RuntimeMetadataImpl;
@@ -258,7 +258,7 @@
IQueryToLdapSearchParser searchParser = new IQueryToLdapSearchParser(rm, config);
- QuerySpecification query = (QuerySpecification)getCommand(queryString,
metadata);
+ Select query = (Select)getCommand(queryString, metadata);
LDAPSearchDetails searchDetails =
searchParser.translateSQLQueryToLDAPSearch(query);
return searchDetails;
Modified:
branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/QueryExecutionImpl.java
===================================================================
---
branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/QueryExecutionImpl.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/QueryExecutionImpl.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -42,10 +42,10 @@
import org.teiid.connector.api.ResultSetExecution;
import org.teiid.connector.basic.BasicExecution;
import org.teiid.connector.language.AggregateFunction;
-import org.teiid.connector.language.From;
import org.teiid.connector.language.Join;
import org.teiid.connector.language.QueryExpression;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
+import org.teiid.connector.language.TableReference;
import org.teiid.connector.metadata.runtime.Column;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
@@ -117,9 +117,9 @@
public void execute() throws ConnectorException {
connectorEnv.getLogger().logInfo(
getLogPreamble() + "Incoming Query: " + query.toString());
- From from = ((QuerySpecification)query).getFrom();
+ List<TableReference> from = ((Select)query).getFrom();
String finalQuery;
- if(from.getItems().get(0) instanceof Join) {
+ if(from.get(0) instanceof Join) {
visitor = new JoinQueryVisitor(metadata);
visitor.visitNode(query);
finalQuery = visitor.getQuery().trim();
@@ -146,7 +146,7 @@
@Override
public List next() throws ConnectorException, DataNotAvailableException {
List<?> result;
- if (query.getProjectedQuery().getSelect().getDerivedColumns().get(0)
+ if (query.getProjectedQuery().getDerivedColumns().get(0)
.getExpression() instanceof AggregateFunction) {
result = Arrays.asList(results.getSize());
results = null;
Modified:
branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/SelectVisitor.java
===================================================================
---
branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/SelectVisitor.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-salesforce/src/main/java/com/metamatrix/connector/salesforce/execution/visitors/SelectVisitor.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -30,13 +30,11 @@
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.language.AggregateFunction;
import org.teiid.connector.language.ColumnReference;
+import org.teiid.connector.language.DerivedColumn;
import org.teiid.connector.language.Expression;
-import org.teiid.connector.language.From;
-import org.teiid.connector.language.TableReference;
import org.teiid.connector.language.NamedTable;
-import org.teiid.connector.language.QuerySpecification;
import org.teiid.connector.language.Select;
-import org.teiid.connector.language.DerivedColumn;
+import org.teiid.connector.language.TableReference;
import org.teiid.connector.metadata.runtime.Column;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
@@ -59,21 +57,13 @@
}
- public void visit(QuerySpecification query) {
+ public void visit(Select query) {
super.visit(query);
- if(null != query.getLimit()) {
- limitClause.append(LIMIT).append(SPACE).append(query.getLimit().getRowLimit());
- }
- }
-
-
- public void visit(Select select) {
- super.visit(select);
- if (select.isDistinct()) {
+ if (query.isDistinct()) {
exceptions.add(new ConnectorException(
Messages.getString("SelectVisitor.distinct.not.supported")));
}
- selectSymbols = select.getDerivedColumns();
+ selectSymbols = query.getDerivedColumns();
selectSymbolCount = selectSymbols.size();
Iterator<DerivedColumn> symbolIter = selectSymbols.iterator();
int index = 0;
@@ -98,15 +88,10 @@
}
++index;
}
- }
-
- @Override
- public void visit(From from) {
- super.visit(from);
try {
// could be a join here, but if so we do nothing and handle
// it in visit(IJoin join).
- TableReference fromItem = from.getItems().get(0);
+ TableReference fromItem = query.getFrom().get(0);
if(fromItem instanceof NamedTable) {
table = ((NamedTable)fromItem).getMetadataObject();
String supportsQuery = table.getProperties().get(Constants.SUPPORTS_QUERY);
@@ -120,8 +105,11 @@
} catch (ConnectorException ce) {
exceptions.add(ce);
}
+ if(null != query.getLimit()) {
+ limitClause.append(LIMIT).append(SPACE).append(query.getLimit().getRowLimit());
+ }
}
-
+
/*
* The SOQL SELECT command uses the following syntax: SELECT fieldList FROM
* objectType [WHERE The Condition Expression (WHERE Clause)] [ORDER BY]
Modified:
branches/JCA/connectors/connector-salesforce/src/test/java/com/metamatrix/connector/salesforce/execution/visitors/TestVisitors.java
===================================================================
---
branches/JCA/connectors/connector-salesforce/src/test/java/com/metamatrix/connector/salesforce/execution/visitors/TestVisitors.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-salesforce/src/test/java/com/metamatrix/connector/salesforce/execution/visitors/TestVisitors.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -27,7 +27,7 @@
import java.util.List;
import org.junit.Test;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import com.metamatrix.cdk.api.TranslationUtility;
import com.metamatrix.common.types.DataTypeManager;
@@ -107,28 +107,28 @@
private static TranslationUtility translationUtility = new
TranslationUtility(exampleSalesforce());
@Test public void testOr() throws Exception {
- QuerySpecification command =
(QuerySpecification)translationUtility.parseCommand("select * from Account where Name
= 'foo' or Stuff = 'bar'"); //$NON-NLS-1$
+ Select command = (Select)translationUtility.parseCommand("select * from Account
where Name = 'foo' or Stuff = 'bar'"); //$NON-NLS-1$
SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
visitor.visit(command);
assertEquals("SELECT Account.id, Account.AccountName, Account.Stuff,
Account.Industry FROM Account WHERE (Account.AccountName = 'foo') OR
(Account.Stuff = 'bar')", visitor.getQuery().toString().trim());
//$NON-NLS-1$
}
@Test public void testNot() throws Exception {
- QuerySpecification command =
(QuerySpecification)translationUtility.parseCommand("select * from Account where not
(Name = 'foo' and Stuff = 'bar')"); //$NON-NLS-1$
+ Select command = (Select)translationUtility.parseCommand("select * from Account
where not (Name = 'foo' and Stuff = 'bar')"); //$NON-NLS-1$
SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
visitor.visit(command);
assertEquals("SELECT Account.id, Account.AccountName, Account.Stuff,
Account.Industry FROM Account WHERE (Account.AccountName != 'foo') OR
(Account.Stuff != 'bar')", visitor.getQuery().toString().trim());
//$NON-NLS-1$
}
@Test public void testCountStart() throws Exception {
- QuerySpecification command =
(QuerySpecification)translationUtility.parseCommand("select count(*) from
Account"); //$NON-NLS-1$
+ Select command = (Select)translationUtility.parseCommand("select count(*) from
Account"); //$NON-NLS-1$
SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
visitor.visit(command);
assertEquals("SELECT count() FROM Account",
visitor.getQuery().toString().trim()); //$NON-NLS-1$
}
@Test public void testNotLike() throws Exception {
- QuerySpecification command =
(QuerySpecification)translationUtility.parseCommand("select * from Account where Name
not like '%foo' or Stuff = 'bar'"); //$NON-NLS-1$
+ Select command = (Select)translationUtility.parseCommand("select * from Account
where Name not like '%foo' or Stuff = 'bar'"); //$NON-NLS-1$
SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
visitor.visit(command);
assertEquals("SELECT Account.id, Account.AccountName, Account.Stuff,
Account.Industry FROM Account WHERE (NOT (Account.AccountName LIKE '%foo')) OR
(Account.Stuff = 'bar')", visitor.getQuery().toString().trim());
//$NON-NLS-1$
@@ -136,7 +136,7 @@
@Test public void testIN() throws Exception {
- QuerySpecification command =
(QuerySpecification)translationUtility.parseCommand("select * from Account where
Industry IN (1,2,3)"); //$NON-NLS-1$
+ Select command = (Select)translationUtility.parseCommand("select * from Account
where Industry IN (1,2,3)"); //$NON-NLS-1$
SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
visitor.visit(command);
assertFalse(visitor.hasOnlyIDCriteria());
@@ -146,7 +146,7 @@
@Test public void testOnlyIDsIN() throws Exception {
// this can resolve to a better performing retrieve call
- QuerySpecification command =
(QuerySpecification)translationUtility.parseCommand("select * from Account where ID
IN (1,2,3)"); //$NON-NLS-1$
+ Select command = (Select)translationUtility.parseCommand("select * from Account
where ID IN (1,2,3)"); //$NON-NLS-1$
SelectVisitor visitor = new SelectVisitor(translationUtility.createRuntimeMetadata());
visitor.visit(command);
assertTrue(visitor.hasOnlyIdInCriteria());
@@ -156,14 +156,14 @@
}
@Test public void testJoin() throws Exception {
- QuerySpecification command =
(QuerySpecification)translationUtility.parseCommand("SELECT Account.Name,
Contact.Name FROM Contact LEFT OUTER JOIN Account ON Account.Id =
Contact.AccountId"); //$NON-NLS-1$
+ Select command = (Select)translationUtility.parseCommand("SELECT Account.Name,
Contact.Name FROM Contact LEFT OUTER JOIN Account ON Account.Id =
Contact.AccountId"); //$NON-NLS-1$
SelectVisitor visitor = new
JoinQueryVisitor(translationUtility.createRuntimeMetadata());
visitor.visit(command);
assertEquals("SELECT Account.AccountName, Contact.ContactName FROM Contact",
visitor.getQuery().toString().trim()); //$NON-NLS-1$
}
@Test public void testJoin2() throws Exception {
- QuerySpecification command =
(QuerySpecification)translationUtility.parseCommand("SELECT Account.Name,
Contact.Name FROM Account LEFT OUTER JOIN Contact ON Account.Id =
Contact.AccountId"); //$NON-NLS-1$
+ Select command = (Select)translationUtility.parseCommand("SELECT Account.Name,
Contact.Name FROM Account LEFT OUTER JOIN Contact ON Account.Id =
Contact.AccountId"); //$NON-NLS-1$
SelectVisitor visitor = new
JoinQueryVisitor(translationUtility.createRuntimeMetadata());
visitor.visit(command);
assertEquals("SELECT Account.AccountName, (SELECT Contact.ContactName FROM
Contacts) FROM Account", visitor.getQuery().toString().trim()); //$NON-NLS-1$
Modified:
branches/JCA/connectors/connector-text/src/main/java/com/metamatrix/connector/text/TextConnection.java
===================================================================
---
branches/JCA/connectors/connector-text/src/main/java/com/metamatrix/connector/text/TextConnection.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-text/src/main/java/com/metamatrix/connector/text/TextConnection.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -31,7 +31,7 @@
import org.teiid.connector.api.ResultSetExecution;
import org.teiid.connector.api.TypeFacility;
import org.teiid.connector.basic.BasicConnection;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.language.QueryExpression;
import org.teiid.connector.metadata.runtime.Column;
import org.teiid.connector.metadata.runtime.MetadataFactory;
@@ -62,7 +62,7 @@
@Override
public ResultSetExecution createResultSetExecution(QueryExpression command,
ExecutionContext executionContext, RuntimeMetadata metadata)
throws ConnectorException {
- return new TextSynchExecution(this.config, (QuerySpecification)command,
this.metadataProps);
+ return new TextSynchExecution(this.config, (Select)command, this.metadataProps);
}
@Override
Modified:
branches/JCA/connectors/connector-text/src/main/java/com/metamatrix/connector/text/TextSynchExecution.java
===================================================================
---
branches/JCA/connectors/connector-text/src/main/java/com/metamatrix/connector/text/TextSynchExecution.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-text/src/main/java/com/metamatrix/connector/text/TextSynchExecution.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -44,12 +44,11 @@
import org.teiid.connector.api.ResultSetExecution;
import org.teiid.connector.api.TypeFacility;
import org.teiid.connector.basic.BasicExecution;
-import org.teiid.connector.language.Command;
import org.teiid.connector.language.ColumnReference;
-import org.teiid.connector.language.From;
-import org.teiid.connector.language.NamedTable;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Command;
import org.teiid.connector.language.DerivedColumn;
+import org.teiid.connector.language.NamedTable;
+import org.teiid.connector.language.Select;
import org.teiid.connector.metadata.runtime.Column;
import org.teiid.connector.metadata.runtime.Table;
@@ -61,7 +60,7 @@
*/
public class TextSynchExecution extends BasicExecution implements ResultSetExecution {
// Command to be executed
- private QuerySpecification cmd;
+ private Select cmd;
// metadata properties
private Map metadataProps;
@@ -111,7 +110,7 @@
* @param cmd
* @param txtConn
*/
- public TextSynchExecution(TextManagedConnectionFactory config, QuerySpecification
query, Map <String, Properties> metaProps) {
+ public TextSynchExecution(TextManagedConnectionFactory config, Select query, Map
<String, Properties> metaProps) {
this.config = config;
this.metadataProps = metaProps;
this.cmd = query;
@@ -128,7 +127,7 @@
// translate results
translateResults(response, cmd);
- cols = getSelectCols(cmd.getSelect().getDerivedColumns());
+ cols = getSelectCols(cmd.getDerivedColumns());
}
@Override
@@ -136,7 +135,7 @@
if (canceled) {
throw new ConnectorException("Execution cancelled"); //$NON-NLS-1$
}
- QuerySpecification query = cmd;
+ Select query = cmd;
Class[] types = query.getColumnTypes();
@@ -368,14 +367,13 @@
}
// Get the columns widths for all the elements in the group.
- QuerySpecification query = (QuerySpecification) request;
+ Select query = (Select) request;
/* Defect 13371
* Can't use the select columns to get the columns widths because we may not
be selecting all the columns. Instead,
* we need to get all the child elements of the group being queried, and get the
columns widths of each one of them.
*/
- From from = query.getFrom();
- NamedTable group = (NamedTable)from.getItems().get(0);
+ NamedTable group = (NamedTable)query.getFrom().get(0);
try {
/* We need to create the reader queue before we
* attempt to create the request as we may need
@@ -434,8 +432,7 @@
}
// get the group metadataID for group present on the command
- From from = ((QuerySpecification) cmd).getFrom();
- List groups = from.getItems();
+ List groups = ((Select) cmd).getFrom();
NamedTable symbol = (NamedTable) groups.get(0);
Table group = symbol.getMetadataObject();
Modified:
branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/IQueryPreprocessor.java
===================================================================
---
branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/IQueryPreprocessor.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/IQueryPreprocessor.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -26,7 +26,7 @@
import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
public interface IQueryPreprocessor {
@@ -41,6 +41,6 @@
* @param m_metadata the runtime metadata
* @return an IQuery object representing the altered query
*/
- public QuerySpecification preprocessQuery(QuerySpecification query, RuntimeMetadata
m_metadata, ExecutionContext exeContext, ConnectorEnvironment config);
+ public Select preprocessQuery(Select query, RuntimeMetadata m_metadata, ExecutionContext
exeContext, ConnectorEnvironment config);
}
Modified:
branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/CriteriaDesc.java
===================================================================
---
branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/CriteriaDesc.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/CriteriaDesc.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -35,7 +35,7 @@
import org.teiid.connector.language.Expression;
import org.teiid.connector.language.In;
import org.teiid.connector.language.Literal;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.language.LanguageUtil;
import org.teiid.connector.language.Comparison.Operator;
import org.teiid.connector.metadata.runtime.Column;
@@ -105,7 +105,7 @@
//use static method do see if a criteria object needs to be created
public static CriteriaDesc getCriteriaDescForColumn(Column element,
- QuerySpecification query) throws ConnectorException {
+ Select query) throws ConnectorException {
CriteriaDesc retVal = null;
List values = parseCriteriaToValues(element, query);
@@ -352,7 +352,7 @@
m_currentIndexInValuesList = 0;
}
- private static ArrayList parseCriteriaToValues(Column element, QuerySpecification
query) throws ConnectorException {
+ private static ArrayList parseCriteriaToValues(Column element, Select query) throws
ConnectorException {
String fullName = element.getFullName().trim().toUpperCase();
ArrayList parmPair = new ArrayList();
Modified:
branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/QueryAnalyzer.java
===================================================================
---
branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/QueryAnalyzer.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/QueryAnalyzer.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -29,24 +29,22 @@
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.language.ColumnReference;
+import org.teiid.connector.language.DerivedColumn;
import org.teiid.connector.language.Expression;
-import org.teiid.connector.language.From;
-import org.teiid.connector.language.TableReference;
-import org.teiid.connector.language.NamedTable;
import org.teiid.connector.language.Literal;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.NamedTable;
import org.teiid.connector.language.Select;
-import org.teiid.connector.language.DerivedColumn;
+import org.teiid.connector.language.TableReference;
import org.teiid.connector.metadata.runtime.Column;
import org.teiid.connector.metadata.runtime.Table;
public class QueryAnalyzer {
- private QuerySpecification command;
+ private Select command;
private Table table;
private ExecutionInfo executionInfo;
- public QueryAnalyzer(QuerySpecification query) throws ConnectorException {
+ public QueryAnalyzer(Select query) throws ConnectorException {
this.command = query;
executionInfo = new ExecutionInfo();
analyze();
@@ -66,8 +64,7 @@
}
private void setGroupInfo() throws ConnectorException {
- From from = command.getFrom();
- List<TableReference> fromItems = from.getItems();
+ List<TableReference> fromItems = command.getFrom();
//Can only be one because we do not support joins
NamedTable group = (NamedTable) fromItems.get(0);
this.table = group.getMetadataObject();
@@ -78,8 +75,7 @@
List<OutputXPathDesc> columns = new ArrayList<OutputXPathDesc>();
//get the request items
- Select select = this.command.getSelect();
- List<DerivedColumn> selectSymbols = select.getDerivedColumns();
+ List<DerivedColumn> selectSymbols = this.command.getDerivedColumns();
//setup column numbers
int projectedColumnCount = 0;
Modified:
branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/streaming/BaseStreamingExecution.java
===================================================================
---
branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/streaming/BaseStreamingExecution.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/streaming/BaseStreamingExecution.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -34,7 +34,7 @@
import org.teiid.connector.api.DataNotAvailableException;
import org.teiid.connector.api.ExecutionContext;
import org.teiid.connector.basic.BasicManagedConnectionFactory;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
import com.metamatrix.connector.xml.Document;
@@ -48,12 +48,12 @@
private int resultIndex = 0;
// injected state
- protected QuerySpecification query;
+ protected Select query;
protected RuntimeMetadata metadata;
protected ExecutionContext context;
protected XMLBaseManagedConnectionFactory config;
- public BaseStreamingExecution(QuerySpecification command,
XMLBaseManagedConnectionFactory config, RuntimeMetadata rtMetadata, ExecutionContext
context) {
+ public BaseStreamingExecution(Select command, XMLBaseManagedConnectionFactory config,
RuntimeMetadata rtMetadata, ExecutionContext context) {
this.query = command;
this.metadata = rtMetadata;
this.context = context;
Modified:
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/MockQueryPreprocessor.java
===================================================================
---
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/MockQueryPreprocessor.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/MockQueryPreprocessor.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -26,7 +26,7 @@
import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
public class MockQueryPreprocessor implements IQueryPreprocessor {
@@ -35,7 +35,7 @@
super();
}
- public QuerySpecification preprocessQuery(QuerySpecification query, RuntimeMetadata
m_metadata, ExecutionContext exeContext, ConnectorEnvironment connectorEnv) {
+ public Select preprocessQuery(Select query, RuntimeMetadata m_metadata, ExecutionContext
exeContext, ConnectorEnvironment connectorEnv) {
return query;
}
Modified:
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/TestElementCollector.java
===================================================================
---
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/TestElementCollector.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/TestElementCollector.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -12,7 +12,7 @@
import junit.framework.TestCase;
import org.teiid.connector.basic.TypeFacilityImpl;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import com.metamatrix.common.types.InputStreamFactory;
import com.metamatrix.connector.xml.base.ExecutionInfo;
@@ -35,7 +35,7 @@
Map prefixes = new HashMap<String, String>();
prefixes.put("po", "http://www.example.com/PO1");
prefixes.put("xsd", "http://www.w3.org/2001/XMLSchema");
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath, "SELECT
* FROM po_list.ITEM");
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, "SELECT * FROM
po_list.ITEM");
QueryAnalyzer analyzer = new QueryAnalyzer(query);
analyzer.analyze();
ExecutionInfo info = analyzer.getExecutionInfo();
Modified:
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/ProxyObjectFactory.java
===================================================================
---
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/ProxyObjectFactory.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/ProxyObjectFactory.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -31,7 +31,7 @@
import org.jdom.input.SAXBuilder;
import org.mockito.Mockito;
import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
import com.metamatrix.cdk.api.TranslationUtility;
@@ -176,9 +176,9 @@
// }
- public static QuerySpecification getDefaultIQuery(String vdbPath, String queryString)
{
+ public static Select getDefaultIQuery(String vdbPath, String queryString) {
TranslationUtility transUtil = new TranslationUtility(vdbPath);
- QuerySpecification query = (QuerySpecification)
transUtil.parseCommand(queryString);
+ Select query = (Select) transUtil.parseCommand(queryString);
return query;
}
Modified:
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestCriteriaDesc.java
===================================================================
---
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestCriteriaDesc.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestCriteriaDesc.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -35,7 +35,7 @@
import org.teiid.connector.language.Condition;
import org.teiid.connector.language.ColumnReference;
import org.teiid.connector.language.Expression;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.language.DerivedColumn;
import org.teiid.connector.language.LanguageUtil;
import org.teiid.connector.metadata.runtime.Column;
@@ -62,9 +62,9 @@
//case 1: values provided
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select RequiredDefaultedParam from CriteriaDescTable where
RequiredDefaultedParam in ('foo')"; //$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
CriteriaDesc desc = CriteriaDesc.getCriteriaDescForColumn(elem, iquery);
@@ -75,9 +75,9 @@
//case 2: param, required, defaulted
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select RequiredDefaultedParam from CriteriaDescTable";
//$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
CriteriaDesc desc = CriteriaDesc.getCriteriaDescForColumn(elem, iquery);
@@ -88,9 +88,9 @@
//case 3: param, not required, not defaulted, not allowed empty
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select OptionalNotAllowedEmptyParam from
CriteriaDescTable"; //$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
CriteriaDesc desc = CriteriaDesc.getCriteriaDescForColumn(elem, iquery);
@@ -102,8 +102,8 @@
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select OptionalAllowedEmptyParam from CriteriaDescTable";
//$NON-NLS-1$
final int colLocation = 0;
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
CriteriaDesc desc = CriteriaDesc.getCriteriaDescForColumn(elem, iquery);
@@ -115,9 +115,9 @@
try {
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select RequiredUndefaultedParam from
CriteriaDescTable"; //$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath,
query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
CriteriaDesc desc = CriteriaDesc.getCriteriaDescForColumn(elem, iquery);
@@ -130,9 +130,9 @@
//case 6: not a param
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select OutputColumn from CriteriaDescTable";
//$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
CriteriaDesc desc = CriteriaDesc.getCriteriaDescForColumn(elem, iquery);
@@ -143,9 +143,9 @@
//case 7: compare criteria
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select RequiredDefaultedParam from CriteriaDescTable where
RequiredDefaultedParam = 'foo'"; //$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
CriteriaDesc desc = CriteriaDesc.getCriteriaDescForColumn(elem, iquery);
@@ -156,9 +156,9 @@
public void testGetCriteriaDescForColumnMultiElement() throws Exception {
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select MultiElementParam from CriteriaDescTable where
MultiElementParam in ('foo','bar')"; //$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
String multiplicityStr = elem.getProperties().get(
@@ -170,9 +170,9 @@
public void testGetCriteriaDescForColumnDelimited() throws Exception {
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select DelimitedParam from CriteriaDescTable where
DelimitedParam in ('foo','bar')"; //$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
String multiplicityStr = elem.getProperties().get(
@@ -185,9 +185,9 @@
try {
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select LikeSearchableParam from CriteriaDescTable where
LikeSearchableParam in ('foo')"; //$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath,
query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
String multiplicityStr = elem.getProperties().get(
@@ -201,9 +201,9 @@
public void testGetCriteriaDescForColumnUnlikeSearchable() throws Exception {
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select UnlikeSearchableParam from CriteriaDescTable where
UnlikeSearchableParam in ('foo')"; //$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
String multiplicityStr = elem.getProperties().get(
@@ -215,9 +215,9 @@
try {
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select UnsearchableParam from CriteriaDescTable where
UnsearchableParam in ('foo','bar')"; //$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath,
query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
String multiplicityStr = elem.getProperties().get(
@@ -232,9 +232,9 @@
//case 1: values provided
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select RequiredDefaultedParam from CriteriaDescTable where
RequiredDefaultedParam like 'foo'"; //$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
CriteriaDesc desc = CriteriaDesc.getCriteriaDescForColumn(elem, iquery);
@@ -245,9 +245,9 @@
//case 1: values provided
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select RequiredDefaultedParam from CriteriaDescTable where
RequiredDefaultedParam != 'foo'"; //$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
CriteriaDesc desc = CriteriaDesc.getCriteriaDescForColumn(elem, iquery);
@@ -257,9 +257,9 @@
public void testGetCriteriaDescForColumnLiteral() throws Exception {
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select RequiredDefaultedParam from CriteriaDescTable where
concat(RequiredDefaultedParam, 'bar') in('foo')"; //$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
CriteriaDesc desc = CriteriaDesc.getCriteriaDescForColumn(elem, iquery);
@@ -269,9 +269,9 @@
public void testGetCriteriaDescForColumnNameMatchFailure() throws Exception {
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select RequiredDefaultedParam from CriteriaDescTable where
AttributeParam in('foo')"; //$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
CriteriaDesc desc = CriteriaDesc.getCriteriaDescForColumn(elem, iquery);
@@ -283,9 +283,9 @@
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select RequiredDefaultedParam from CriteriaDescTable "
//$NON-NLS-1$
+ "where concat('bar', 'foo') = concat('bar',
RequiredDefaultedParam)"; //$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
CriteriaDesc desc = CriteriaDesc.getCriteriaDescForColumn(elem, iquery);
@@ -295,9 +295,9 @@
public void testGetCriteriaDescForColumnTwoElements() throws Exception {
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select RequiredDefaultedParam from CriteriaDescTable where
OutputColumn = RequiredDefaultedParam"; //$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
CriteriaDesc desc = CriteriaDesc.getCriteriaDescForColumn(elem, iquery);
@@ -307,9 +307,9 @@
public void testGetCriteriaDescForColumnLeftElementEqualsLiteral() throws Exception {
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select RequiredDefaultedParam from CriteriaDescTable where
AttributeParam = 'foo'"; //$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
CriteriaDesc desc = CriteriaDesc.getCriteriaDescForColumn(elem, iquery);
@@ -320,9 +320,9 @@
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select RequiredDefaultedParam from CriteriaDescTable
where" //$NON-NLS-1$
+ " RequiredDefaultedParam = concat('foo', OutputColumn)";
//$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
CriteriaDesc desc = CriteriaDesc.getCriteriaDescForColumn(elem, iquery);
@@ -332,9 +332,9 @@
public void testGetInputXPathNoXpath() throws Exception {
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select BadNoInputXpath from CriteriaDescTable where
BadNoInputXpath in ('foo')"; //$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
CriteriaDesc desc = CriteriaDesc.getCriteriaDescForColumn(elem, iquery);
@@ -345,9 +345,9 @@
public void testGetInputXPathEmptyXpath() throws Exception {
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select BadEmptyInputXPath from CriteriaDescTable where
BadEmptyInputXPath in ('foo')"; //$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
CriteriaDesc desc = CriteriaDesc.getCriteriaDescForColumn(elem, iquery);
@@ -357,9 +357,9 @@
public void testGetDataAttributeNameEmptyName() throws Exception {
assertNotNull("vdb path is null", vdbPath); //$NON-NLS-1$
String query = "select BadNoDataAttributeName from CriteriaDescTable where
BadNoDataAttributeName in ('foo')"; //$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
CriteriaDesc desc = CriteriaDesc.getCriteriaDescForColumn(elem, iquery);
@@ -455,9 +455,9 @@
public void testGetCurrentIndexValueEnumerated() throws Exception {
String query = "select DelimitedParam from CriteriaDescTable where
DelimitedParam in ('foo', 'bar')"; //$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
CriteriaDesc desc = CriteriaDesc.getCriteriaDescForColumn(elem, iquery);
@@ -469,9 +469,9 @@
public void testIncrementIndexEnumerated() throws Exception {
String query = "select DelimitedParam from CriteriaDescTable where
DelimitedParam in ('foo', 'bar')"; //$NON-NLS-1$
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
RuntimeMetadata metadata = ProxyObjectFactory.getDefaultRuntimeMetadata(vdbPath);
Column elem = ((ColumnReference) expr).getMetadataObject();
@@ -515,7 +515,7 @@
}
public void testNameMatch() {
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
Condition crit = query.getWhere();
List criteriaList = LanguageUtil.separateCriteriaByAnd(crit);
Iterator criteriaIter = criteriaList.iterator();
@@ -575,7 +575,7 @@
String strQuery = "Select Balance from Response"; //$NON-NLS-1$
try {
Column elem = getElement(strQuery);
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath, strQuery);
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, strQuery);
CriteriaDesc desc = CriteriaDesc.getCriteriaDescForColumn(elem, query);
} finally {
vdbPath = tempVdbpath;
@@ -597,8 +597,8 @@
private Column getElement(String query, int colLocation)
throws ConnectorException {
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
Column elem = ((ColumnReference) expr).getMetadataObject();
return elem;
Modified:
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestExecutionInfo.java
===================================================================
---
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestExecutionInfo.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestExecutionInfo.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -30,7 +30,7 @@
import junit.framework.TestCase;
import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
/**
*
@@ -61,7 +61,7 @@
@Override
public void setUp() throws ConnectorException {
String vdbPath = ProxyObjectFactory.getStateCollegeVDBLocation();
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
QueryAnalyzer analyzer = new QueryAnalyzer(query);
analyzer.analyze();
m_info = analyzer.getExecutionInfo();
@@ -107,7 +107,7 @@
public void testGetCriteria() {
String vdbPath = ProxyObjectFactory.getStateCollegeVDBLocation();
//String query = "Select AttributeColumn from TestTable where AttributeColumn
in ('foo')";
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
try {
QueryAnalyzer analyzer = new QueryAnalyzer(iquery);
analyzer.analyze();
@@ -124,7 +124,7 @@
public void testGetOtherProperties() throws ConnectorException {
String vdbPath = ProxyObjectFactory.getDocumentsFolder() +
"/UnitTests.vdb";
String strQuery = "select * from Response";
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath,
strQuery);
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, strQuery);
QueryAnalyzer analyzer = new QueryAnalyzer(query);
analyzer.analyze();
ExecutionInfo info = analyzer.getExecutionInfo();
Modified:
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestOutputXPathDesc.java
===================================================================
---
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestOutputXPathDesc.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestOutputXPathDesc.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -27,15 +27,14 @@
import junit.framework.TestCase;
import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.language.ColumnReference;
import org.teiid.connector.language.Comparison;
import org.teiid.connector.language.Condition;
-import org.teiid.connector.language.ColumnReference;
+import org.teiid.connector.language.DerivedColumn;
import org.teiid.connector.language.Expression;
+import org.teiid.connector.language.LanguageUtil;
import org.teiid.connector.language.Literal;
-import org.teiid.connector.language.QuerySpecification;
import org.teiid.connector.language.Select;
-import org.teiid.connector.language.DerivedColumn;
-import org.teiid.connector.language.LanguageUtil;
import org.teiid.connector.metadata.runtime.Column;
@@ -73,9 +72,8 @@
* Class under test for void OutputXPathDesc(Element)
*/
public void testOutputXPathDescElement() throws Exception {
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
- Select select = query.getSelect();
- List symbols = select.getDerivedColumns();
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
+ List symbols = query.getDerivedColumns();
DerivedColumn selectSymbol = (DerivedColumn) symbols.get(0);
Expression expr = selectSymbol.getExpression();
assertTrue(expr instanceof ColumnReference);
@@ -87,9 +85,9 @@
public void testOutputXPathDescParam() throws Exception {
String query = "select RequiredDefaultedParam from CriteriaDescTable where
RequiredDefaultedParam in ('foo')";
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
assertTrue(expr instanceof ColumnReference);
Column element = ((ColumnReference) expr).getMetadataObject();
@@ -101,9 +99,9 @@
public void testOutputXPathDescNoXPath() throws Exception {
try {
String query = "select OutputColumnNoXPath from CriteriaDescTable";
- QuerySpecification iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath,
query);
+ Select iquery = ProxyObjectFactory.getDefaultIQuery(vdbPath, query);
final int colLocation = 0;
- DerivedColumn symbol = (DerivedColumn)
iquery.getSelect().getDerivedColumns().get(colLocation);
+ DerivedColumn symbol = (DerivedColumn)
iquery.getDerivedColumns().get(colLocation);
Expression expr = symbol.getExpression();
assertTrue(expr instanceof ColumnReference);
Column element = ((ColumnReference) expr).getMetadataObject();
@@ -119,7 +117,7 @@
public void testOutputXPathDescILiteral() throws Exception {
String strLiteral = "MetaMatrix";
String strQuery = "Select Company_id from Company where Company_id =
'" + strLiteral + "'";
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath, strQuery);
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, strQuery);
Condition crits = query.getWhere();
List criteriaList = LanguageUtil.separateCriteriaByAnd(crits);
Comparison compCriteria = (Comparison) criteriaList.get(0);
@@ -133,7 +131,7 @@
public void testOutputXPathDescILiteralNullValue() throws Exception {
String strLiteral = "MetaMatrix";
String strQuery = "Select Company_id from Company where Company_id =
'" + strLiteral + "'";
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath, strQuery);
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, strQuery);
Condition crits = query.getWhere();
List criteriaList = LanguageUtil.separateCriteriaByAnd(crits);
Comparison compCriteria = (Comparison) criteriaList.get(0);
@@ -146,9 +144,8 @@
}
public void testSetAndGetCurrentValue() throws Exception {
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
- Select select = query.getSelect();
- List symbols = select.getDerivedColumns();
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
+ List symbols = query.getDerivedColumns();
DerivedColumn selectSymbol = (DerivedColumn) symbols.get(0);
Expression expr = selectSymbol.getExpression();
assertTrue(expr instanceof ColumnReference);
@@ -160,9 +157,8 @@
}
public void testGetDataType() throws Exception {
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
- Select select = query.getSelect();
- List symbols = select.getDerivedColumns();
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
+ List symbols = query.getDerivedColumns();
DerivedColumn selectSymbol = (DerivedColumn) symbols.get(0);
Expression expr = selectSymbol.getExpression();
assertTrue(expr instanceof ColumnReference);
Modified:
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestParameterDescriptor.java
===================================================================
---
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestParameterDescriptor.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestParameterDescriptor.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -28,10 +28,9 @@
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.language.ColumnReference;
+import org.teiid.connector.language.DerivedColumn;
import org.teiid.connector.language.Expression;
-import org.teiid.connector.language.QuerySpecification;
import org.teiid.connector.language.Select;
-import org.teiid.connector.language.DerivedColumn;
import org.teiid.connector.metadata.runtime.Column;
@@ -69,9 +68,8 @@
* Class under test for void ParameterDescriptor(Element)
*/
public void testParameterDescriptorElement() throws Exception {
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
- Select select = query.getSelect();
- List symbols = select.getDerivedColumns();
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
+ List symbols = query.getDerivedColumns();
DerivedColumn selectSymbol = (DerivedColumn) symbols.get(0);
Expression expr = selectSymbol.getExpression();
assertTrue(expr instanceof ColumnReference);
@@ -82,9 +80,8 @@
public void testParameterDescriptorElementParameter() throws Exception {
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath,
"select RequiredDefaultedParam from CriteriaDescTable");
- Select select = query.getSelect();
- List symbols = select.getDerivedColumns();
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, "select
RequiredDefaultedParam from CriteriaDescTable");
+ List symbols = query.getDerivedColumns();
DerivedColumn selectSymbol = (DerivedColumn) symbols.get(0);
Expression expr = selectSymbol.getExpression();
assertTrue(expr instanceof ColumnReference);
@@ -96,9 +93,8 @@
public void testParameterDescriptorElementSpaceXPath() throws Exception {
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath,
"select OutputColumnSpaceXPath from CriteriaDescTable");
- Select select = query.getSelect();
- List symbols = select.getDerivedColumns();
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, "select
OutputColumnSpaceXPath from CriteriaDescTable");
+ List symbols = query.getDerivedColumns();
DerivedColumn selectSymbol = (DerivedColumn) symbols.get(0);
Expression expr = selectSymbol.getExpression();
assertTrue(expr instanceof ColumnReference);
@@ -147,9 +143,8 @@
}
public void testGetElement() throws Exception {
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
- Select select = query.getSelect();
- List symbols = select.getDerivedColumns();
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
+ List symbols = query.getDerivedColumns();
DerivedColumn selectSymbol = (DerivedColumn) symbols.get(0);
Expression expr = selectSymbol.getExpression();
assertTrue(expr instanceof ColumnReference);
@@ -162,9 +157,8 @@
String trueQuery = "select EmptyCol from EmptyTable where EmptyCol =
'foo'";
String falseQuery = "select Company_id from Company";
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath, trueQuery);
- Select select = query.getSelect();
- List symbols = select.getDerivedColumns();
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, trueQuery);
+ List symbols = query.getDerivedColumns();
DerivedColumn selectSymbol = (DerivedColumn) symbols.get(0);
Expression expr = selectSymbol.getExpression();
assertTrue(expr instanceof ColumnReference);
@@ -172,8 +166,7 @@
assertTrue(ParameterDescriptor.testForParam(element));
query = ProxyObjectFactory.getDefaultIQuery(vdbPath, falseQuery);
- select = query.getSelect();
- symbols = select.getDerivedColumns();
+ symbols = query.getDerivedColumns();
selectSymbol = (DerivedColumn) symbols.get(0);
expr = selectSymbol.getExpression();
assertTrue(expr instanceof ColumnReference);
@@ -182,9 +175,8 @@
}
private ParameterDescriptor getParameterDescriptor() throws Exception {
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
- Select select = query.getSelect();
- List symbols = select.getDerivedColumns();
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
+ List symbols = query.getDerivedColumns();
DerivedColumn selectSymbol = (DerivedColumn) symbols.get(0);
Expression expr = selectSymbol.getExpression();
assertTrue(expr instanceof ColumnReference);
Modified:
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestQueryAnalyzer.java
===================================================================
---
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestQueryAnalyzer.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-xml/src/test/java/com/metamatrix/connector/xml/base/TestQueryAnalyzer.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -27,7 +27,7 @@
import junit.framework.TestCase;
import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
/**
*
@@ -57,7 +57,7 @@
}
public void testQueryAnalyzer() {
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
try {
QueryAnalyzer analyzer = new QueryAnalyzer(query);
assertNotNull("analyzer is null", analyzer);
@@ -67,7 +67,7 @@
}
public void testAnalyze() {
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
try {
QueryAnalyzer analyzer = new QueryAnalyzer(query);
analyzer.analyze();
@@ -78,7 +78,7 @@
public void testAnalyzeSimpleSelect() {
String strQuery = "select SimpleOutput from SimpleTable";
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath,
strQuery);
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, strQuery);
try {
QueryAnalyzer analyzer = new QueryAnalyzer(query);
analyzer.analyze();
@@ -89,7 +89,7 @@
public void testAnalyzeLiteralSelect() {
String strQuery = "select SimpleOutput, 'foo' from SimpleTable";
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath,
strQuery);
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, strQuery);
try {
QueryAnalyzer analyzer = new QueryAnalyzer(query);
analyzer.analyze();
@@ -100,7 +100,7 @@
public void testAnalyzeFunctionSelect() {
String strQuery = "select concat(SimpleOutput, 'foo') from
SimpleTable";
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath,
strQuery);
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, strQuery);
try {
QueryAnalyzer analyzer = new QueryAnalyzer(query);
analyzer.analyze();
@@ -111,7 +111,7 @@
public void testAnalyzeParameterSelect() {
String strQuery = "select SimpleParam from SimpleInput where SimpleParam in
('foo')";
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath,
strQuery);
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, strQuery);
try {
QueryAnalyzer analyzer = new QueryAnalyzer(query);
analyzer.analyze();
@@ -122,7 +122,7 @@
public void testAnalyzeComplexQuery() {
String strQuery = "select SimpleOut from SimpleInput where SimpleParam in
('foo')";
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath,
strQuery);
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, strQuery);
try {
QueryAnalyzer analyzer = new QueryAnalyzer(query);
analyzer.analyze();
@@ -133,7 +133,7 @@
public void testAnalyzeComplexQuery2() {
String strQuery = "select SimpleOut from SimpleInput where SimpleParam in
('foo') and OtherOut in ('bar')";
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath,
strQuery);
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, strQuery);
try {
QueryAnalyzer analyzer = new QueryAnalyzer(query);
analyzer.analyze();
@@ -143,7 +143,7 @@
}
public void testGetExecutionInfo() {
- QuerySpecification query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
+ Select query = ProxyObjectFactory.getDefaultIQuery(vdbPath, QUERY);
try {
QueryAnalyzer analyzer = new QueryAnalyzer(query);
assertNotNull("analyzer is null", analyzer);
Modified:
branches/JCA/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/http/HTTPConnectionImpl.java
===================================================================
---
branches/JCA/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/http/HTTPConnectionImpl.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/http/HTTPConnectionImpl.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -3,7 +3,7 @@
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
import org.teiid.connector.api.ResultSetExecution;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.language.QueryExpression;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
import org.teiid.connector.xml.StatefulConnector;
@@ -23,7 +23,7 @@
public ResultSetExecution createResultSetExecution(QueryExpression command,
ExecutionContext executionContext, RuntimeMetadata metadata)
throws ConnectorException {
- return new HTTPExecution((QuerySpecification)command, this, metadata, executionContext,
getConnectorEnv());
+ return new HTTPExecution((Select)command, this, metadata, executionContext,
getConnectorEnv());
}
//End Connection API Implementation
Modified:
branches/JCA/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/http/HTTPExecution.java
===================================================================
---
branches/JCA/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/http/HTTPExecution.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-xml-http/src/main/java/org/teiid/connector/xml/http/HTTPExecution.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -25,7 +25,7 @@
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
import org.teiid.connector.xml.base.XMLConnectionImpl;
@@ -41,7 +41,7 @@
protected XMLConnectionImpl connection;
private ExecutionInfo executionInfo;
- public HTTPExecution(QuerySpecification query, XMLConnectionImpl conn, RuntimeMetadata
metadata, ExecutionContext exeContext, XMLBaseManagedConnectionFactory connectorEnv) {
+ public HTTPExecution(Select query, XMLConnectionImpl conn, RuntimeMetadata metadata,
ExecutionContext exeContext, XMLBaseManagedConnectionFactory connectorEnv) {
super(query, connectorEnv, metadata, exeContext);
this.connection = conn;
}
Modified:
branches/JCA/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SOAPConnectionImpl.java
===================================================================
---
branches/JCA/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SOAPConnectionImpl.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SOAPConnectionImpl.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -3,7 +3,7 @@
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
import org.teiid.connector.api.ResultSetExecution;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.language.QueryExpression;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
import org.teiid.connector.xml.StatefulConnector;
@@ -23,7 +23,7 @@
@Override
public ResultSetExecution createResultSetExecution(QueryExpression command,
ExecutionContext executionContext, RuntimeMetadata metadata)
throws ConnectorException {
- return new SOAPExecution((QuerySpecification)command, this, metadata, executionContext,
getConnectorEnv());
+ return new SOAPExecution((Select)command, this, metadata, executionContext,
getConnectorEnv());
}
//End Connection API Implementation
Modified:
branches/JCA/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SOAPExecution.java
===================================================================
---
branches/JCA/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SOAPExecution.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-xml-soap/src/main/java/org/teiid/connector/xml/soap/SOAPExecution.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -2,7 +2,7 @@
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
import org.teiid.connector.xml.SOAPConnectorState;
import org.teiid.connector.xml.base.XMLConnectionImpl;
@@ -13,7 +13,7 @@
public class SOAPExecution extends HTTPExecution {
- public SOAPExecution(QuerySpecification query, XMLConnectionImpl conn, RuntimeMetadata
metadata, ExecutionContext exeContext, XMLBaseManagedConnectionFactory connectorEnv) {
+ public SOAPExecution(Select query, XMLConnectionImpl conn, RuntimeMetadata metadata,
ExecutionContext exeContext, XMLBaseManagedConnectionFactory connectorEnv) {
super(query, conn, metadata, exeContext, connectorEnv);
}
Modified:
branches/JCA/connectors/connector-xmlsource-file/src/main/java/org/teiid/connector/xmlsource/file/FileConnection.java
===================================================================
---
branches/JCA/connectors/connector-xmlsource-file/src/main/java/org/teiid/connector/xmlsource/file/FileConnection.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-xmlsource-file/src/main/java/org/teiid/connector/xmlsource/file/FileConnection.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -32,7 +32,7 @@
import org.teiid.connector.basic.BasicManagedConnectionFactory;
import org.teiid.connector.language.Call;
import org.teiid.connector.language.QueryExpression;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
import com.metamatrix.connector.xml.IQueryPreprocessor;
@@ -62,10 +62,10 @@
public ResultSetExecution createResultSetExecution(QueryExpression command,
ExecutionContext executionContext, RuntimeMetadata metadata) throws ConnectorException {
IQueryPreprocessor preProcessor = getQueryPreProcessor();
if (preProcessor != null) {
- command = preProcessor.preprocessQuery((QuerySpecification)command, metadata,
executionContext, this.config);
+ command = preProcessor.preprocessQuery((Select)command, metadata, executionContext,
this.config);
this.config.getLogger().logTrace("XML Connector Framework: executing command:
" + command);
}
- return new FileResultSetExecution((QuerySpecification)command, this.config, metadata,
executionContext);
+ return new FileResultSetExecution((Select)command, this.config, metadata,
executionContext);
}
@Override
Modified:
branches/JCA/connectors/connector-xmlsource-file/src/main/java/org/teiid/connector/xmlsource/file/FileResultSetExecution.java
===================================================================
---
branches/JCA/connectors/connector-xmlsource-file/src/main/java/org/teiid/connector/xmlsource/file/FileResultSetExecution.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-xmlsource-file/src/main/java/org/teiid/connector/xmlsource/file/FileResultSetExecution.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -35,7 +35,7 @@
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
import com.metamatrix.common.types.InputStreamFactory;
@@ -55,7 +55,7 @@
private FileManagedConnectionFactory env;
private File content;
- public FileResultSetExecution(QuerySpecification command, FileManagedConnectionFactory
config, RuntimeMetadata metadata, ExecutionContext context) {
+ public FileResultSetExecution(Select command, FileManagedConnectionFactory config,
RuntimeMetadata metadata, ExecutionContext context) {
super(command, config, metadata, context);
this.env = config;
}
Modified:
branches/JCA/connectors/connector-xmlsource-soap/src/main/java/org/teiid/connector/xmlsource/soap/SOAPResultSetExecution.java
===================================================================
---
branches/JCA/connectors/connector-xmlsource-soap/src/main/java/org/teiid/connector/xmlsource/soap/SOAPResultSetExecution.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-xmlsource-soap/src/main/java/org/teiid/connector/xmlsource/soap/SOAPResultSetExecution.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -29,7 +29,7 @@
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
import com.metamatrix.connector.xml.Document;
@@ -44,7 +44,7 @@
private ExecutionInfo executionInfo;
private ArrayList<SOAPRequest> requests = new ArrayList<SOAPRequest>();
- public SOAPResultSetExecution(QuerySpecification query, RuntimeMetadata metadata,
ExecutionContext exeContext, SoapManagedConnectionFactory config) {
+ public SOAPResultSetExecution(Select query, RuntimeMetadata metadata, ExecutionContext
exeContext, SoapManagedConnectionFactory config) {
super(query, config, metadata, exeContext);
}
Modified:
branches/JCA/connectors/connector-xmlsource-soap/src/main/java/org/teiid/connector/xmlsource/soap/SoapConnection.java
===================================================================
---
branches/JCA/connectors/connector-xmlsource-soap/src/main/java/org/teiid/connector/xmlsource/soap/SoapConnection.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/connector-xmlsource-soap/src/main/java/org/teiid/connector/xmlsource/soap/SoapConnection.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -29,7 +29,7 @@
import org.teiid.connector.basic.BasicConnection;
import org.teiid.connector.basic.BasicManagedConnectionFactory;
import org.teiid.connector.language.Call;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.language.QueryExpression;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
@@ -68,10 +68,10 @@
throws ConnectorException {
IQueryPreprocessor preProcessor = getQueryPreProcessor();
if (preProcessor != null) {
- command = preProcessor.preprocessQuery((QuerySpecification)command, metadata,
executionContext, this.config);
+ command = preProcessor.preprocessQuery((Select)command, metadata, executionContext,
this.config);
this.config.getLogger().logTrace("XML Connector Framework: executing command:
" + command);
}
- return new SOAPResultSetExecution((QuerySpecification)command, metadata,
executionContext, this.config);
+ return new SOAPResultSetExecution((Select)command, metadata, executionContext,
this.config);
}
private IQueryPreprocessor getQueryPreProcessor() throws ConnectorException {
Modified:
branches/JCA/connectors/sandbox/connector-exec/src/main/java/com/metamatrix/connector/exec/ExecAntExecution.java
===================================================================
---
branches/JCA/connectors/sandbox/connector-exec/src/main/java/com/metamatrix/connector/exec/ExecAntExecution.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/sandbox/connector-exec/src/main/java/com/metamatrix/connector/exec/ExecAntExecution.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -45,7 +45,7 @@
import org.teiid.connector.api.DataNotAvailableException;
import org.teiid.connector.api.ResultSetExecution;
import org.teiid.connector.basic.BasicExecution;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
import com.metamatrix.common.util.OSPlatformUtil;
@@ -72,9 +72,9 @@
private Process p = null;
private List exclusionList;
- private QuerySpecification query;
+ private Select query;
- public ExecAntExecution(QuerySpecification query, ExecManagedConnectionFactory env,
RuntimeMetadata metadata, List exclusionThese) {
+ public ExecAntExecution(Select query, ExecManagedConnectionFactory env, RuntimeMetadata
metadata, List exclusionThese) {
this.config = env;
this.query = query;
if (exclusionThese != null)
Modified:
branches/JCA/connectors/sandbox/connector-exec/src/main/java/com/metamatrix/connector/exec/ExecConnection.java
===================================================================
---
branches/JCA/connectors/sandbox/connector-exec/src/main/java/com/metamatrix/connector/exec/ExecConnection.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/sandbox/connector-exec/src/main/java/com/metamatrix/connector/exec/ExecConnection.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -27,7 +27,7 @@
import org.teiid.connector.api.ExecutionContext;
import org.teiid.connector.api.ResultSetExecution;
import org.teiid.connector.basic.BasicConnection;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.language.QueryExpression;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
@@ -50,7 +50,7 @@
public ResultSetExecution createResultSetExecution(QueryExpression command,
ExecutionContext executionContext, RuntimeMetadata metadata)
throws ConnectorException {
- return new ExecAntExecution((QuerySpecification)command, this.config, metadata,
exclusionList);
+ return new ExecAntExecution((Select)command, this.config, metadata,
exclusionList);
}
@Override
Modified:
branches/JCA/connectors/sandbox/connector-yahoo/src/main/java/com/metamatrix/connector/yahoo/YahooConnection.java
===================================================================
---
branches/JCA/connectors/sandbox/connector-yahoo/src/main/java/com/metamatrix/connector/yahoo/YahooConnection.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/sandbox/connector-yahoo/src/main/java/com/metamatrix/connector/yahoo/YahooConnection.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -26,7 +26,7 @@
import org.teiid.connector.api.ExecutionContext;
import org.teiid.connector.api.ResultSetExecution;
import org.teiid.connector.basic.BasicConnection;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.language.QueryExpression;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
@@ -45,7 +45,7 @@
@Override
public ResultSetExecution createResultSetExecution(QueryExpression command,
ExecutionContext executionContext, RuntimeMetadata metadata)
throws ConnectorException {
- return new YahooExecution((QuerySpecification)command, config, metadata);
+ return new YahooExecution((Select)command, config, metadata);
}
public void close() {
Modified:
branches/JCA/connectors/sandbox/connector-yahoo/src/main/java/com/metamatrix/connector/yahoo/YahooExecution.java
===================================================================
---
branches/JCA/connectors/sandbox/connector-yahoo/src/main/java/com/metamatrix/connector/yahoo/YahooExecution.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/sandbox/connector-yahoo/src/main/java/com/metamatrix/connector/yahoo/YahooExecution.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -43,12 +43,11 @@
import org.teiid.connector.api.DataNotAvailableException;
import org.teiid.connector.api.ResultSetExecution;
import org.teiid.connector.basic.BasicExecution;
-import org.teiid.connector.language.Condition;
import org.teiid.connector.language.ColumnReference;
+import org.teiid.connector.language.Condition;
+import org.teiid.connector.language.DerivedColumn;
import org.teiid.connector.language.Expression;
-import org.teiid.connector.language.QuerySpecification;
import org.teiid.connector.language.Select;
-import org.teiid.connector.language.DerivedColumn;
import org.teiid.connector.metadata.runtime.Column;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
@@ -67,13 +66,13 @@
// Connector resources
private YahooManagedConnectionFactory config;
private RuntimeMetadata metadata;
- private QuerySpecification command;
+ private Select command;
// Execution state
List results;
int[] neededColumns;
int returnIndex = 0;
- private QuerySpecification query;
+ private Select query;
private String previousHttpProxyHost;
private String previousHttpProxyPort;
@@ -81,7 +80,7 @@
/**
*
*/
- public YahooExecution(QuerySpecification query, YahooManagedConnectionFactory env,
RuntimeMetadata metadata) {
+ public YahooExecution(Select query, YahooManagedConnectionFactory env,
RuntimeMetadata metadata) {
this.config = env;
this.metadata = metadata;
this.query = query;
@@ -102,10 +101,10 @@
this.results = executeUrl(yahooUrl, this.config.getLogger());
// Determine needed columns in results
- this.neededColumns = getNeededColumns(query.getSelect(), this.metadata);
+ this.neededColumns = getNeededColumns(query.getDerivedColumns(), this.metadata);
}
- static String translateIntoUrl(QuerySpecification query) throws ConnectorException {
+ static String translateIntoUrl(Select query) throws ConnectorException {
StringBuffer url = new StringBuffer();
url.append(YahooPlugin.Util.getString("YahooExecution.URL_BEGIN"));
//$NON-NLS-1$
@@ -128,7 +127,7 @@
/**
* @return
*/
- static Set getTickers(QuerySpecification query) throws ConnectorException {
+ static Set getTickers(Select query) throws ConnectorException {
Condition crit = query.getWhere();
if(crit == null) {
throw new
ConnectorException(YahooPlugin.Util.getString("YahooExecution.Must_have_criteria"));
//$NON-NLS-1$
@@ -244,9 +243,9 @@
* @param select
* @return
*/
- static int[] getNeededColumns(Select select, RuntimeMetadata metadata) throws
ConnectorException {
- int[] cols = new int[select.getDerivedColumns().size()];
- Iterator iter = select.getDerivedColumns().iterator();
+ static int[] getNeededColumns(List<DerivedColumn> select, RuntimeMetadata
metadata) throws ConnectorException {
+ int[] cols = new int[select.size()];
+ Iterator iter = select.iterator();
for(int i=0; iter.hasNext(); i++) {
DerivedColumn symbol = (DerivedColumn) iter.next();
Expression expr = symbol.getExpression();
Modified:
branches/JCA/connectors/sandbox/connector-yahoo/src/test/java/com/metamatrix/connector/yahoo/TestYahooTranslation.java
===================================================================
---
branches/JCA/connectors/sandbox/connector-yahoo/src/test/java/com/metamatrix/connector/yahoo/TestYahooTranslation.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/connectors/sandbox/connector-yahoo/src/test/java/com/metamatrix/connector/yahoo/TestYahooTranslation.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -23,7 +23,7 @@
package com.metamatrix.connector.yahoo;
import org.teiid.connector.language.Command;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import junit.framework.TestCase;
@@ -34,7 +34,7 @@
public void helpTestTranslation(String sql, String expectedUrl) throws Exception {
Command command =
FakeTranslationFactory.getInstance().getYahooTranslationUtility().parseCommand(sql);
- String url = YahooExecution.translateIntoUrl((QuerySpecification) command);
+ String url = YahooExecution.translateIntoUrl((Select) command);
assertEquals("Did not get expected url", expectedUrl, url);
//$NON-NLS-1$
}
Modified:
branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LanguageBridgeFactory.java
===================================================================
---
branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LanguageBridgeFactory.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/engine/src/main/java/org/teiid/dqp/internal/datamgr/language/LanguageBridgeFactory.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -47,7 +47,7 @@
import org.teiid.connector.language.NamedTable;
import org.teiid.connector.language.Not;
import org.teiid.connector.language.QueryExpression;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.language.SearchedCase;
import org.teiid.connector.language.SortSpecification;
import org.teiid.connector.language.SubqueryComparison;
@@ -75,7 +75,6 @@
import com.metamatrix.query.sql.lang.Criteria;
import com.metamatrix.query.sql.lang.Delete;
import com.metamatrix.query.sql.lang.ExistsCriteria;
-import com.metamatrix.query.sql.lang.From;
import com.metamatrix.query.sql.lang.FromClause;
import com.metamatrix.query.sql.lang.GroupBy;
import com.metamatrix.query.sql.lang.Insert;
@@ -89,7 +88,6 @@
import com.metamatrix.query.sql.lang.Query;
import com.metamatrix.query.sql.lang.QueryCommand;
import com.metamatrix.query.sql.lang.SPParameter;
-import com.metamatrix.query.sql.lang.Select;
import com.metamatrix.query.sql.lang.SetClause;
import com.metamatrix.query.sql.lang.SetClauseList;
import com.metamatrix.query.sql.lang.SetCriteria;
@@ -170,19 +168,8 @@
}
/* Query */
- QuerySpecification translate(Query query) throws MetaMatrixComponentException {
- QuerySpecification q = new QuerySpecification(translate(query.getSelect()),
- translate(query.getFrom()),
- translate(query.getCriteria()),
- translate(query.getGroupBy()),
- translate(query.getHaving()),
- translate(query.getOrderBy()));
- q.setLimit(translate(query.getLimit()));
- return q;
- }
-
- public org.teiid.connector.language.Select translate(Select select) throws
MetaMatrixComponentException {
- List symbols = select.getSymbols();
+ Select translate(Query query) throws MetaMatrixComponentException {
+ List symbols = query.getSelect().getSymbols();
List<DerivedColumn> translatedSymbols = new
ArrayList<DerivedColumn>(symbols.size());
for (Iterator i = symbols.iterator(); i.hasNext();) {
SingleElementSymbol symbol = (SingleElementSymbol)i.next();
@@ -204,17 +191,21 @@
DerivedColumn selectSymbol = new DerivedColumn(alias, iExp);
translatedSymbols.add(selectSymbol);
}
- return new org.teiid.connector.language.Select(translatedSymbols,
select.isDistinct());
+ List<TableReference> items = null;
+ if (query.getFrom() != null) {
+ List clauses = query.getFrom().getClauses();
+ items = new ArrayList<TableReference>(clauses.size());
+ for (Iterator i = clauses.iterator(); i.hasNext();) {
+ items.add(translate((FromClause)i.next()));
+ }
+ }
+ Select q = new Select(translatedSymbols, query
+ .getSelect().isDistinct(), items,
+ translate(query.getCriteria()), translate(query.getGroupBy()),
+ translate(query.getHaving()), translate(query.getOrderBy()));
+ q.setLimit(translate(query.getLimit()));
+ return q;
}
-
- public org.teiid.connector.language.From translate(From from) throws
MetaMatrixComponentException {
- List clauses = from.getClauses();
- List<TableReference> items = new ArrayList<TableReference>();
- for (Iterator i = clauses.iterator(); i.hasNext();) {
- items.add(translate((FromClause)i.next()));
- }
- return new org.teiid.connector.language.From(items);
- }
public TableReference translate(FromClause clause) throws
MetaMatrixComponentException {
if (clause == null) return null;
Modified:
branches/JCA/engine/src/test/java/com/metamatrix/dqp/message/TestAtomicRequestMessage.java
===================================================================
---
branches/JCA/engine/src/test/java/com/metamatrix/dqp/message/TestAtomicRequestMessage.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/engine/src/test/java/com/metamatrix/dqp/message/TestAtomicRequestMessage.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -45,7 +45,7 @@
DQPWorkContext workContext = new DQPWorkContext();
workContext.setSessionToken(new SessionToken(2, "foo")); //$NON-NLS-1$
AtomicRequestMessage message = new AtomicRequestMessage(rm, workContext, 1000);
- message.setCommand(TestQueryImpl.helpExample());
+ message.setCommand(TestQueryImpl.helpExample(true));
message.setFetchSize(100);
message.setPartialResults(true);
message.setRequestID(new RequestID(5000L));
@@ -59,7 +59,7 @@
AtomicRequestMessage example = example();
AtomicRequestMessage copy = UnitTestUtil.helpSerialize(example);
- assertEquals(TestQueryImpl.helpExample(), copy.getCommand());
+ assertEquals(TestQueryImpl.helpExample(true), copy.getCommand());
assertEquals(100, copy.getFetchSize());
assertEquals(example.getProcessingTimestamp(), copy.getProcessingTimestamp());
Modified:
branches/JCA/engine/src/test/java/com/metamatrix/query/unittest/RealMetadataFactory.java
===================================================================
---
branches/JCA/engine/src/test/java/com/metamatrix/query/unittest/RealMetadataFactory.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/engine/src/test/java/com/metamatrix/query/unittest/RealMetadataFactory.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -187,23 +187,20 @@
// Add stored procedure
Schema pm1 = createPhysicalModel("pm1", metadataStore); //$NON-NLS-1$
ProcedureParameter rs1p1 = createParameter("intkey", 2,
ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
- ColumnSet<Procedure> rs1 = createResultSet("pm1.rs1", pm1, new
String[] { "IntKey", "StringKey" }, new String[] {
DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ProcedureParameter rs1p2 = createParameter("ret", 1,
ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs1); //$NON-NLS-1$
- Procedure spTest5 = createStoredProcedure("spTest5", pm1,
Arrays.asList(rs1p1, rs1p2), "spTest5"); //$NON-NLS-1$ //$NON-NLS-2$
+ ColumnSet<Procedure> rs1 = createResultSet("rs1", pm1, new
String[] { "IntKey", "StringKey" }, new String[] {
DataTypeManager.DefaultDataTypes.INTEGER, DataTypeManager.DefaultDataTypes.STRING });
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Procedure spTest5 = createStoredProcedure("spTest5", pm1,
Arrays.asList(rs1p1), "spTest5"); //$NON-NLS-1$ //$NON-NLS-2$
spTest5.setResultSet(rs1);
Schema pm2 = createPhysicalModel("pm2", metadataStore); //$NON-NLS-1$
ProcedureParameter rs2p1 = createParameter("inkey", 2,
ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
ProcedureParameter rs2p2 = createParameter("outkey", 3,
ParameterInfo.OUT, DataTypeManager.DefaultDataTypes.INTEGER, null);
//$NON-NLS-1$
- ColumnSet<Procedure> rs2 = createResultSet("pm2.rs2", pm2, new
String[] { "IntKey", "StringKey"}, new String[] {
DataTypeManager.DefaultDataTypes.INTEGER , DataTypeManager.DefaultDataTypes.STRING });
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ProcedureParameter rs2p3 = createParameter("ret", 1,
ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- Procedure spTest8 = createStoredProcedure("spTest8", pm2,
Arrays.asList(rs2p1, rs2p2, rs2p3), "spTest8"); //$NON-NLS-1$ //$NON-NLS-2$
+ ColumnSet<Procedure> rs2 = createResultSet("rs2", pm2, new
String[] { "IntKey", "StringKey"}, new String[] {
DataTypeManager.DefaultDataTypes.INTEGER , DataTypeManager.DefaultDataTypes.STRING });
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Procedure spTest8 = createStoredProcedure("spTest8", pm2,
Arrays.asList(rs2p1, rs2p2), "spTest8"); //$NON-NLS-1$ //$NON-NLS-2$
spTest8.setResultSet(rs2);
ProcedureParameter rs2p2a = createParameter("outkey", 3,
ParameterInfo.OUT, DataTypeManager.DefaultDataTypes.INTEGER, null);
//$NON-NLS-1$
- ColumnSet<Procedure> rs2a = createResultSet("pm2.rs2", pm2, new
String[] { "IntKey", "StringKey"}, new String[] {
DataTypeManager.DefaultDataTypes.INTEGER , DataTypeManager.DefaultDataTypes.STRING });
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ProcedureParameter rs2p3a = createParameter("ret", 1,
ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs2); //$NON-NLS-1$
- Procedure spTest8a = createStoredProcedure("spTest8a", pm2,
Arrays.asList(rs2p2a, rs2p3a), "spTest8a"); //$NON-NLS-1$ //$NON-NLS-2$
+ ColumnSet<Procedure> rs2a = createResultSet("rs2", pm2, new
String[] { "IntKey", "StringKey"}, new String[] {
DataTypeManager.DefaultDataTypes.INTEGER , DataTypeManager.DefaultDataTypes.STRING });
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Procedure spTest8a = createStoredProcedure("spTest8a", pm2,
Arrays.asList(rs2p2a), "spTest8a"); //$NON-NLS-1$ //$NON-NLS-2$
spTest8a.setResultSet(rs2a);
Schema pm4 = createPhysicalModel("pm4", metadataStore); //$NON-NLS-1$
@@ -214,49 +211,42 @@
Schema pm3 = createPhysicalModel("pm3", metadataStore); //$NON-NLS-1$
ProcedureParameter rs3p1 = createParameter("inkey", 2,
ParameterInfo.IN, DataTypeManager.DefaultDataTypes.INTEGER, null); //$NON-NLS-1$
ProcedureParameter rs3p2 = createParameter("outkey", 3,
ParameterInfo.INOUT, DataTypeManager.DefaultDataTypes.INTEGER, null);
//$NON-NLS-1$
- ColumnSet<Procedure> rs3 = createResultSet("pm3.rs3", pm3, new
String[] { "IntKey", "StringKey"}, new String[] {
DataTypeManager.DefaultDataTypes.INTEGER , DataTypeManager.DefaultDataTypes.STRING });
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ProcedureParameter rs3p3 = createParameter("ret", 1,
ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, rs3); //$NON-NLS-1$
- Procedure spTest11 = createStoredProcedure("spTest11", pm3,
Arrays.asList(rs3p1, rs3p2, rs3p3), "spTest11"); //$NON-NLS-1$ //$NON-NLS-2$
+ ColumnSet<Procedure> rs3 = createResultSet("rs3", pm3, new
String[] { "IntKey", "StringKey"}, new String[] {
DataTypeManager.DefaultDataTypes.INTEGER , DataTypeManager.DefaultDataTypes.STRING });
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Procedure spTest11 = createStoredProcedure("spTest11", pm3,
Arrays.asList(rs3p1, rs3p2), "spTest11"); //$NON-NLS-1$ //$NON-NLS-2$
spTest11.setResultSet(rs3);
//add virtual stored procedures
Schema mmspTest1 = createVirtualModel("mmspTest1", metadataStore);
//$NON-NLS-1$
ColumnSet<Procedure> vsprs1 = createResultSet("mmspTest1.vsprs1",
mmspTest1, new String[] { "StringKey" }, new String[] {
DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- ProcedureParameter vspp1 = createParameter("ret", 1,
ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, vsprs1); //$NON-NLS-1$
QueryNode vspqn1 = new QueryNode("vsp1", "CREATE VIRTUAL PROCEDURE
BEGIN DECLARE integer x; LOOP ON (SELECT intkey FROM bqt1.smallA) AS intKeyCursor BEGIN x=
intKeyCursor.intkey - 1; END SELECT stringkey FROM bqt1.smalla where intkey=x; END");
//$NON-NLS-1$ //$NON-NLS-2$
- Procedure vsp1 = createVirtualProcedure("MMSP1", mmspTest1,
Arrays.asList(vspp1), vspqn1); //$NON-NLS-1$
+ Procedure vsp1 = createVirtualProcedure("MMSP1", mmspTest1, null,
vspqn1); //$NON-NLS-1$
vsp1.setResultSet(vsprs1);
ColumnSet<Procedure> vsprs2 = createResultSet("mmspTest1.vsprs1",
mmspTest1, new String[] { "StringKey" }, new String[] {
DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- ProcedureParameter vspp2 = createParameter("ret", 1,
ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, vsprs1); //$NON-NLS-1$
QueryNode vspqn2 = new QueryNode("vsp2", "CREATE VIRTUAL PROCEDURE
BEGIN DECLARE integer x; LOOP ON (SELECT intkey FROM bqt1.smallA) AS intKeyCursor1 BEGIN
LOOP ON (SELECT intkey FROM bqt1.smallB) AS intKeyCursor2 BEGIN x= intKeyCursor1.intkey -
intKeyCursor2.intkey; END END SELECT stringkey FROM bqt1.smalla where intkey=x;
END"); //$NON-NLS-1$ //$NON-NLS-2$
- Procedure vsp2 = createVirtualProcedure("MMSP2", mmspTest1,
Arrays.asList(vspp2), vspqn2); //$NON-NLS-1$
+ Procedure vsp2 = createVirtualProcedure("MMSP2", mmspTest1, null,
vspqn2); //$NON-NLS-1$
vsp2.setResultSet(vsprs2);
ColumnSet<Procedure> vsprs3 = createResultSet("mmspTest1.vsprs1",
mmspTest1, new String[] { "StringKey" }, new String[] {
DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- ProcedureParameter vspp3 = createParameter("ret", 1,
ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, vsprs1); //$NON-NLS-1$
QueryNode vspqn3 = new QueryNode("vsp3", "CREATE VIRTUAL PROCEDURE
BEGIN DECLARE integer x; LOOP ON (SELECT intkey FROM bqt1.smallA) AS intKeyCursor BEGIN x=
intKeyCursor.intkey - 1; if(x = 25) BEGIN BREAK; END ELSE BEGIN CONTINUE; END END SELECT
stringkey FROM bqt1.smalla where intkey=x; END"); //$NON-NLS-1$ //$NON-NLS-2$
- Procedure vsp3 = createVirtualProcedure("MMSP3", mmspTest1,
Arrays.asList(vspp3), vspqn3); //$NON-NLS-1$
+ Procedure vsp3 = createVirtualProcedure("MMSP3", mmspTest1, null,
vspqn3); //$NON-NLS-1$
vsp3.setResultSet(vsprs3);
ColumnSet<Procedure> vsprs4 = createResultSet("mmspTest1.vsprs1",
mmspTest1, new String[] { "StringKey" }, new String[] {
DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- ProcedureParameter vspp4 = createParameter("ret", 1,
ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, vsprs1); //$NON-NLS-1$
QueryNode vspqn4 = new QueryNode("vsp4", "CREATE VIRTUAL PROCEDURE
BEGIN DECLARE integer x; x=0; WHILE(x < 50) BEGIN x= x + 1; if(x = 25) BEGIN BREAK; END
ELSE BEGIN CONTINUE; END END SELECT stringkey FROM bqt1.smalla where intkey=x; END");
//$NON-NLS-1$ //$NON-NLS-2$
- Procedure vsp4 = createVirtualProcedure("MMSP4", mmspTest1,
Arrays.asList(vspp4), vspqn4); //$NON-NLS-1$
+ Procedure vsp4 = createVirtualProcedure("MMSP4", mmspTest1, null,
vspqn4); //$NON-NLS-1$
vsp4.setResultSet(vsprs4);
ColumnSet<Procedure> vsprs5 = createResultSet("mmspTest1.vsprs1",
mmspTest1, new String[] { "StringKey" }, new String[] {
DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- ProcedureParameter vspp5 = createParameter("ret", 1,
ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, vsprs1); //$NON-NLS-1$
ProcedureParameter vsp5p1 = createParameter("param1", 2,
ParameterInfo.IN, DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
QueryNode vspqn5 = new QueryNode("vsp5", "CREATE VIRTUAL PROCEDURE
BEGIN SELECT 0; END"); //$NON-NLS-1$ //$NON-NLS-2$
- Procedure vsp5 = createVirtualProcedure("MMSP5", mmspTest1,
Arrays.asList(vspp5, vsp5p1), vspqn5); //$NON-NLS-1$
+ Procedure vsp5 = createVirtualProcedure("MMSP5", mmspTest1,
Arrays.asList(vsp5p1), vspqn5); //$NON-NLS-1$
vsp5.setResultSet(vsprs5);
ColumnSet<Procedure> vsprs6 = createResultSet("mmspTest1.vsprs1",
mmspTest1, new String[] { "StringKey" }, new String[] {
DataTypeManager.DefaultDataTypes.STRING }); //$NON-NLS-1$ //$NON-NLS-2$
- ProcedureParameter vspp6 = createParameter("ret", 1,
ParameterInfo.RESULT_SET, DataTypeManager.DefaultDataTypes.OBJECT, vsprs1); //$NON-NLS-1$
ProcedureParameter vsp6p1 = createParameter("p1", 2, ParameterInfo.IN,
DataTypeManager.DefaultDataTypes.STRING, null); //$NON-NLS-1$
QueryNode vspqn6 = new QueryNode("vsp6", "CREATE VIRTUAL PROCEDURE
BEGIN SELECT 1; END"); //$NON-NLS-1$ //$NON-NLS-2$
- Procedure vsp6 = createVirtualProcedure("MMSP6", mmspTest1,
Arrays.asList(vspp6, vsp6p1), vspqn6); //$NON-NLS-1$
+ Procedure vsp6 = createVirtualProcedure("MMSP6", mmspTest1,
Arrays.asList(vsp6p1), vspqn6); //$NON-NLS-1$
vsp6.setResultSet(vsprs6);
CompositeMetadataStore store = new CompositeMetadataStore(metadataStore);
@@ -487,7 +477,6 @@
public static ProcedureParameter createParameter(String name, int index, int
direction, String type, Object rs) {
ProcedureParameter param = new ProcedureParameter();
param.setName(name);
- param.setPosition(index);
switch (direction) {
case SPParameter.IN:
param.setType(Type.In);
@@ -499,8 +488,7 @@
param.setType(Type.Out);
break;
case SPParameter.RESULT_SET:
- param.setType(Type.ResultSet);
- break;
+ throw new AssertionError("should not directly create a resultset
param"); //$NON-NLS-1$
case SPParameter.RETURN_VALUE:
param.setType(Type.ReturnValue);
break;
@@ -520,10 +508,14 @@
public static Procedure createStoredProcedure(String name, Schema model,
List<ProcedureParameter> params, String callableName) {
Procedure proc = new Procedure();
proc.setName(name);
- for (ProcedureParameter procedureParameter : params) {
- procedureParameter.setProcedure(proc);
- }
- proc.setParameters(params);
+ if (params != null) {
+ int index = 1;
+ for (ProcedureParameter procedureParameter : params) {
+ procedureParameter.setProcedure(proc);
+ procedureParameter.setPosition(index++);
+ }
+ proc.setParameters(params);
+ }
model.addProcedure(proc);
return proc;
}
Modified:
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestExistsCriteriaImpl.java
===================================================================
---
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestExistsCriteriaImpl.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestExistsCriteriaImpl.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -42,7 +42,7 @@
}
public static ExistsCriteria helpExample() {
- ExistsCriteria crit = new ExistsCriteria(TestQueryImpl.helpExample());
+ ExistsCriteria crit = new ExistsCriteria(TestQueryImpl.helpExample(true));
return crit;
}
Deleted:
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestFromImpl.java
===================================================================
---
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestFromImpl.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestFromImpl.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -1,69 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.dqp.internal.datamgr.language;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.teiid.connector.language.From;
-import org.teiid.connector.language.NamedTable;
-import org.teiid.connector.language.TableReference;
-
-import com.metamatrix.query.sql.lang.UnaryFromClause;
-
-public class TestFromImpl extends TestCase {
-
- /**
- * Constructor for TestFromImpl.
- * @param name
- */
- public TestFromImpl(String name) {
- super(name);
- }
-
- public static com.metamatrix.query.sql.lang.From helpExample() {
- List<UnaryFromClause> clauses = new ArrayList<UnaryFromClause>();
- clauses.add(new UnaryFromClause(TestGroupImpl.helpExample("vm1.g1")));
//$NON-NLS-1$
- clauses.add(new UnaryFromClause(TestGroupImpl.helpExample("myAlias",
"vm1.g2"))); //$NON-NLS-1$ //$NON-NLS-2$
- clauses.add(new UnaryFromClause(TestGroupImpl.helpExample("vm1.g3")));
//$NON-NLS-1$
- clauses.add(new UnaryFromClause(TestGroupImpl.helpExample("vm1.g4")));
//$NON-NLS-1$
- return new com.metamatrix.query.sql.lang.From(clauses);
- }
-
- public static From example() throws Exception {
- return TstLanguageBridgeFactory.factory.translate(helpExample());
- }
-
- public void testGetItems() throws Exception {
- From from = example();
- assertNotNull(from.getItems());
- assertEquals(4, from.getItems().size());
- for (Iterator<TableReference> i = from.getItems().iterator(); i.hasNext();)
{
- assertTrue(i.next() instanceof NamedTable);
- }
- }
-
-}
Modified:
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestInlineViewImpl.java
===================================================================
---
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestInlineViewImpl.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestInlineViewImpl.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -36,7 +36,7 @@
}
public static SubqueryFromClause helpExample() {
- return new SubqueryFromClause("xyz", TestQueryImpl.helpExample());
//$NON-NLS-1$
+ return new SubqueryFromClause("xyz", TestQueryImpl.helpExample(true));
//$NON-NLS-1$
}
public static DerivedTable example() throws Exception {
@@ -48,7 +48,7 @@
}
public void testGetQuery() throws Exception {
- assertEquals("SELECT DISTINCT vm1.g1.e1, vm1.g1.e2, vm1.g1.e3, vm1.g1.e4
FROM vm1.g1, vm1.g2 AS myAlias, vm1.g3, vm1.g4 WHERE 100 >= 200 AND 100 >= 200 GROUP
BY vm1.g1.e1, vm1.g1.e2, vm1.g1.e3, vm1.g1.e4 HAVING 100 >= 200 AND 100 >= 200 ORDER
BY e1, e2 DESC, e3, e4 DESC", example().getQuery().toString()); //$NON-NLS-1$
+ assertEquals("SELECT DISTINCT vm1.g1.e1, vm1.g1.e2, vm1.g1.e3, vm1.g1.e4
FROM vm1.g1, vm1.g2 AS myAlias, vm1.g3, vm1.g4 WHERE 100 >= 200 AND 500 < 600 GROUP
BY vm1.g1.e1, vm1.g1.e2, vm1.g1.e3, vm1.g1.e4 HAVING 100 >= 200 AND 500 < 600 ORDER
BY e1, e2 DESC, e3, e4 DESC", example().getQuery().toString()); //$NON-NLS-1$
}
}
Modified:
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestQueryImpl.java
===================================================================
---
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestQueryImpl.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestQueryImpl.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -23,13 +23,20 @@
package org.teiid.dqp.internal.datamgr.language;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
import junit.framework.TestCase;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.DerivedColumn;
+import org.teiid.connector.language.Select;
import com.metamatrix.core.util.EquivalenceUtil;
import com.metamatrix.query.sql.lang.CompoundCriteria;
import com.metamatrix.query.sql.lang.Query;
+import com.metamatrix.query.sql.lang.UnaryFromClause;
+import com.metamatrix.query.sql.symbol.ElementSymbol;
public class TestQueryImpl extends TestCase {
@@ -40,10 +47,21 @@
public TestQueryImpl(String name) {
super(name);
}
+
+ public static com.metamatrix.query.sql.lang.Select helpExampleSelect(boolean
distinct) {
+ ArrayList<ElementSymbol> symbols = new ArrayList<ElementSymbol>();
+ symbols.add(TestElementImpl.helpExample("vm1.g1", "e1"));
//$NON-NLS-1$ //$NON-NLS-2$
+ symbols.add(TestElementImpl.helpExample("vm1.g1", "e2"));
//$NON-NLS-1$ //$NON-NLS-2$
+ symbols.add(TestElementImpl.helpExample("vm1.g1", "e3"));
//$NON-NLS-1$ //$NON-NLS-2$
+ symbols.add(TestElementImpl.helpExample("vm1.g1", "e4"));
//$NON-NLS-1$ //$NON-NLS-2$
+ com.metamatrix.query.sql.lang.Select sel = new
com.metamatrix.query.sql.lang.Select(symbols);
+ sel.setDistinct(distinct);
+ return sel;
+ }
- public static Query helpExample() {
- return new Query(TestSelectImpl.helpExample(true),
- TestFromImpl.helpExample(),
+ public static Query helpExample(boolean distinct) {
+ return new Query(helpExampleSelect(distinct),
+ TestQueryImpl.helpExampleFrom(),
TestCompoundCriteriaImpl.helpExample(CompoundCriteria.AND),
TestGroupByImpl.helpExample(),
TestCompoundCriteriaImpl.helpExample(CompoundCriteria.AND),
@@ -51,44 +69,67 @@
null);
}
- public static QuerySpecification example() throws Exception {
- return TstLanguageBridgeFactory.factory.translate(helpExample());
+ public static Select example(boolean distinct) throws Exception {
+ return TstLanguageBridgeFactory.factory.translate(helpExample(distinct));
}
public void testGetSelect() throws Exception {
- assertNotNull(example().getSelect());
+ assertNotNull(example(true).getDerivedColumns());
}
public void testGetFrom() throws Exception {
- assertNotNull(example().getFrom());
+ assertNotNull(example(true).getFrom());
}
public void testGetWhere() throws Exception {
- assertNotNull(example().getWhere());
+ assertNotNull(example(true).getWhere());
}
public void testGetGroupBy() throws Exception {
- assertNotNull(example().getGroupBy());
+ assertNotNull(example(true).getGroupBy());
}
public void testGetHaving() throws Exception {
- assertNotNull(example().getHaving());
+ assertNotNull(example(true).getHaving());
}
public void testGetOrderBy() throws Exception {
- assertNotNull(example().getOrderBy());
+ assertNotNull(example(true).getOrderBy());
}
public void testGetColumnNames() throws Exception {
String[] expected = new String[4];
- String[] names = example().getColumnNames();
+ String[] names = example(true).getColumnNames();
assertTrue(EquivalenceUtil.areEquivalent(expected, names));
}
public void testGetColumnTypes() throws Exception {
Class[] expected = {String.class, String.class, String.class, String.class};
- Class[] types = example().getColumnTypes();
+ Class[] types = example(true).getColumnTypes();
assertTrue(EquivalenceUtil.areEquivalent(expected, types));
}
+ public static com.metamatrix.query.sql.lang.From helpExampleFrom() {
+ List<UnaryFromClause> clauses = new ArrayList<UnaryFromClause>();
+ clauses.add(new UnaryFromClause(TestGroupImpl.helpExample("vm1.g1")));
//$NON-NLS-1$
+ clauses.add(new UnaryFromClause(TestGroupImpl.helpExample("myAlias",
"vm1.g2"))); //$NON-NLS-1$ //$NON-NLS-2$
+ clauses.add(new UnaryFromClause(TestGroupImpl.helpExample("vm1.g3")));
//$NON-NLS-1$
+ clauses.add(new UnaryFromClause(TestGroupImpl.helpExample("vm1.g4")));
//$NON-NLS-1$
+ return new com.metamatrix.query.sql.lang.From(clauses);
+ }
+
+ public void testGetSelectSymbols() throws Exception {
+ List symbols = example(false).getDerivedColumns();
+ assertNotNull(symbols);
+ assertEquals(4, symbols.size());
+ for (Iterator i = symbols.iterator(); i.hasNext();) {
+ assertTrue(i.next() instanceof DerivedColumn);
+ }
+ }
+
+ public void testIsDistinct() throws Exception {
+ assertTrue(example(true).isDistinct());
+ assertFalse(example(false).isDistinct());
+ }
+
}
Modified:
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestScalarSubqueryImpl.java
===================================================================
---
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestScalarSubqueryImpl.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestScalarSubqueryImpl.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -24,7 +24,7 @@
import junit.framework.TestCase;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.language.ScalarSubquery;
import com.metamatrix.query.sql.lang.Query;
@@ -43,7 +43,7 @@
}
public static com.metamatrix.query.sql.symbol.ScalarSubquery helpExample() {
- Query query = TestQueryImpl.helpExample();
+ Query query = TestQueryImpl.helpExample(true);
com.metamatrix.query.sql.symbol.ScalarSubquery ss = new
com.metamatrix.query.sql.symbol.ScalarSubquery(query);
ss.setType(((SingleElementSymbol)query.getProjectedSymbols().get(0)).getType());
return ss;
@@ -57,8 +57,8 @@
assertNotNull(example().getSubquery()); }
public void testGetType() throws Exception {
- QuerySpecification query =
TstLanguageBridgeFactory.factory.translate(TestQueryImpl.helpExample());
- Class<?> firstSymbolType =
query.getSelect().getDerivedColumns().get(0).getExpression().getType();
+ Select query =
TstLanguageBridgeFactory.factory.translate(TestQueryImpl.helpExample(true));
+ Class<?> firstSymbolType =
query.getDerivedColumns().get(0).getExpression().getType();
assertEquals("Got incorrect type", firstSymbolType,
example().getType()); //$NON-NLS-1$
}
Deleted:
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSelectImpl.java
===================================================================
---
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSelectImpl.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSelectImpl.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -1,75 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package org.teiid.dqp.internal.datamgr.language;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.teiid.connector.language.DerivedColumn;
-import org.teiid.connector.language.Select;
-
-import com.metamatrix.query.sql.symbol.ElementSymbol;
-
-public class TestSelectImpl extends TestCase {
-
- /**
- * Constructor for TestSelectImpl.
- * @param name
- */
- public TestSelectImpl(String name) {
- super(name);
- }
-
- public static com.metamatrix.query.sql.lang.Select helpExample(boolean distinct) {
- ArrayList<ElementSymbol> symbols = new ArrayList<ElementSymbol>();
- symbols.add(TestElementImpl.helpExample("vm1.g1", "e1"));
//$NON-NLS-1$ //$NON-NLS-2$
- symbols.add(TestElementImpl.helpExample("vm1.g1", "e2"));
//$NON-NLS-1$ //$NON-NLS-2$
- symbols.add(TestElementImpl.helpExample("vm1.g1", "e3"));
//$NON-NLS-1$ //$NON-NLS-2$
- symbols.add(TestElementImpl.helpExample("vm1.g1", "e4"));
//$NON-NLS-1$ //$NON-NLS-2$
- com.metamatrix.query.sql.lang.Select sel = new
com.metamatrix.query.sql.lang.Select(symbols);
- sel.setDistinct(distinct);
- return sel;
- }
-
- public static Select example(boolean distinct) throws Exception {
- return TstLanguageBridgeFactory.factory.translate(helpExample(distinct));
- }
-
- public void testGetSelectSymbols() throws Exception {
- List symbols = example(false).getDerivedColumns();
- assertNotNull(symbols);
- assertEquals(4, symbols.size());
- for (Iterator i = symbols.iterator(); i.hasNext();) {
- assertTrue(i.next() instanceof DerivedColumn);
- }
- }
-
- public void testIsDistinct() throws Exception {
- assertTrue(example(true).isDistinct());
- assertFalse(example(false).isDistinct());
- }
-
-}
Modified:
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSelectSymbolImpl.java
===================================================================
---
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSelectSymbolImpl.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSelectSymbolImpl.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -22,13 +22,13 @@
package org.teiid.dqp.internal.datamgr.language;
-import org.teiid.connector.language.Expression;
+import junit.framework.TestCase;
+
+import org.teiid.connector.language.ColumnReference;
import org.teiid.connector.language.DerivedColumn;
-import com.metamatrix.query.sql.symbol.*;
+import com.metamatrix.common.types.DataTypeManager;
-import junit.framework.TestCase;
-
public class TestSelectSymbolImpl extends TestCase {
/**
@@ -39,23 +39,8 @@
super(name);
}
- public static com.metamatrix.query.sql.symbol.Expression helpExample(String name,
String alias) {
- SingleElementSymbol symbol = TestElementImpl.helpExample("vm1.g1",
name); //$NON-NLS-1$
-
- if (alias != null) {
- return new AliasSymbol(alias, symbol);
- }
- return symbol;
- }
-
public static DerivedColumn example(String symbolName, String alias) throws Exception
{
- com.metamatrix.query.sql.symbol.Expression expr = helpExample(symbolName,
alias);
- Expression iExp = TstLanguageBridgeFactory.factory.translate(expr);
- String name = null;
- if (expr instanceof AliasSymbol) {
- name = ((AliasSymbol)expr).getOutputName();
- }
- DerivedColumn selectSymbol = new DerivedColumn(name, iExp);
+ DerivedColumn selectSymbol = new DerivedColumn(alias, new ColumnReference(null,
symbolName, null, DataTypeManager.DefaultDataClasses.INTEGER));
return selectSymbol;
}
Modified:
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSetQueryImpl.java
===================================================================
---
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSetQueryImpl.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSetQueryImpl.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -29,17 +29,13 @@
import org.teiid.connector.language.ColumnReference;
import org.teiid.connector.language.DerivedColumn;
-import org.teiid.connector.language.From;
import org.teiid.connector.language.NamedTable;
import org.teiid.connector.language.OrderBy;
-import org.teiid.connector.language.QuerySpecification;
import org.teiid.connector.language.Select;
import org.teiid.connector.language.SetQuery;
import org.teiid.connector.language.SortSpecification;
import org.teiid.connector.language.SortSpecification.Ordering;
-import com.metamatrix.query.sql.lang.CompoundCriteria;
-import com.metamatrix.query.sql.lang.Query;
import com.metamatrix.query.sql.lang.SetQuery.Operation;
@@ -48,21 +44,11 @@
*/
public class TestSetQueryImpl extends TestCase {
- public static Query helpExampleQuery() {
- return new Query(TestSelectImpl.helpExample(true),
- TestFromImpl.helpExample(),
- TestCompoundCriteriaImpl.helpExample(CompoundCriteria.AND),
- TestGroupByImpl.helpExample(),
- TestCompoundCriteriaImpl.helpExample(CompoundCriteria.AND),
- TestOrderByImpl.helpExample(),
- null);
- }
-
public static com.metamatrix.query.sql.lang.SetQuery helpExampleSetQuery() {
com.metamatrix.query.sql.lang.SetQuery setQuery = new
com.metamatrix.query.sql.lang.SetQuery(Operation.UNION);
setQuery.setAll(false);
- setQuery.setLeftQuery(helpExampleQuery());
- setQuery.setRightQuery(helpExampleQuery());
+ setQuery.setLeftQuery(TestQueryImpl.helpExample(true));
+ setQuery.setRightQuery(TestQueryImpl.helpExample(true));
setQuery.setOrderBy(TestOrderByImpl.helpExample());
return setQuery;
}
@@ -77,25 +63,21 @@
DerivedColumn symbol = new DerivedColumn("nugent",element);
//$NON-NLS-1$
List symbols = new ArrayList();
symbols.add(symbol);
- Select select = new Select(symbols, false);
List items = new ArrayList();
items.add(group);
- From from = new From(items);
NamedTable group2 = new NamedTable("dave", null, null); //$NON-NLS-1$
ColumnReference element2 = new ColumnReference(group2, "barry", null,
String.class); //$NON-NLS-1$
DerivedColumn symbol2 = new DerivedColumn("barry", element2);
//$NON-NLS-1$
List symbols2 = new ArrayList();
symbols2.add(symbol2);
- Select select2 = new Select(symbols2, false);
List items2 = new ArrayList();
items2.add(group2);
- From from2 = new From(items2);
- QuerySpecification secondQuery = new QuerySpecification(select2, from2, null,
null, null, null);
+ Select secondQuery = new Select(symbols2, false, items2, null, null, null,
null);
- QuerySpecification query = new QuerySpecification(select, from, null, null, null,
null);
+ Select query = new Select(symbols, false, items, null, null, null, null);
SetQuery setQuery = new SetQuery();
setQuery.setOperation(SetQuery.Operation.UNION);
@@ -110,7 +92,7 @@
SetQuery union = example2();
List<SortSpecification> items = new ArrayList<SortSpecification>();
- ColumnReference element = (ColumnReference)
(union.getProjectedQuery().getSelect().getDerivedColumns().get(0)).getExpression();
+ ColumnReference element = (ColumnReference)
(union.getProjectedQuery().getDerivedColumns().get(0)).getExpression();
items.add(new SortSpecification(Ordering.ASC, element));
OrderBy orderBy = new OrderBy(items);
@@ -119,15 +101,15 @@
}
public void testNestedSetQuery() throws Exception {
- com.metamatrix.query.sql.lang.SetQuery query = new
com.metamatrix.query.sql.lang.SetQuery(com.metamatrix.query.sql.lang.SetQuery.Operation.EXCEPT,
true, helpExampleQuery(), helpExampleQuery());
+ com.metamatrix.query.sql.lang.SetQuery query = new
com.metamatrix.query.sql.lang.SetQuery(com.metamatrix.query.sql.lang.SetQuery.Operation.EXCEPT,
true, helpExampleSetQuery(), helpExampleSetQuery());
SetQuery setQuery = TstLanguageBridgeFactory.factory.translate(query);
- assertTrue(setQuery.getLeftQuery() instanceof QuerySpecification);
- assertTrue(setQuery.getRightQuery() instanceof QuerySpecification);
+ assertTrue(setQuery.getLeftQuery() instanceof SetQuery);
+ assertTrue(setQuery.getRightQuery() instanceof SetQuery);
}
public void testGetSelect() throws Exception {
- assertNotNull(example().getProjectedQuery().getSelect());
+ assertNotNull(example().getProjectedQuery().getDerivedColumns());
}
public void testGetFrom() throws Exception {
Modified:
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSubqueryCompareCriteriaImpl.java
===================================================================
---
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSubqueryCompareCriteriaImpl.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSubqueryCompareCriteriaImpl.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -47,7 +47,7 @@
public static SubqueryCompareCriteria helpExample() {
ElementSymbol element = TestElementImpl.helpExample("g1",
"e1"); //$NON-NLS-1$ //$NON-NLS-2$
- Query query = TestQueryImpl.helpExample();
+ Query query = TestQueryImpl.helpExample(true);
SubqueryCompareCriteria scc = new SubqueryCompareCriteria(element, query,
AbstractCompareCriteria.GT, SubqueryCompareCriteria.ANY);
return scc;
}
Modified:
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSubqueryInCriteriaImpl.java
===================================================================
---
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSubqueryInCriteriaImpl.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/engine/src/test/java/org/teiid/dqp/internal/datamgr/language/TestSubqueryInCriteriaImpl.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -45,7 +45,7 @@
public static SubquerySetCriteria helpExample() {
ElementSymbol element = TestElementImpl.helpExample("g1",
"e1"); //$NON-NLS-1$ //$NON-NLS-2$
- Query query = TestQueryImpl.helpExample();
+ Query query = TestQueryImpl.helpExample(true);
SubquerySetCriteria ssc = new SubquerySetCriteria(element, query);
ssc.setNegated(true);
return ssc;
Modified:
branches/JCA/test-integration/common/src/test/java/com/metamatrix/cdk/api/TestTranslationUtility.java
===================================================================
---
branches/JCA/test-integration/common/src/test/java/com/metamatrix/cdk/api/TestTranslationUtility.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/test-integration/common/src/test/java/com/metamatrix/cdk/api/TestTranslationUtility.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -26,7 +26,7 @@
import org.teiid.connector.language.Command;
import org.teiid.connector.language.NamedTable;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.metadata.runtime.AbstractMetadataRecord;
import com.metamatrix.core.util.UnitTestUtil;
@@ -79,8 +79,8 @@
TranslationUtility util = new TranslationUtility(getTestVDB());
// Translate command to get some ids
- QuerySpecification query = (QuerySpecification) util.parseCommand("select *
from partssupplier.parts"); //$NON-NLS-1$
- NamedTable group = (NamedTable) query.getFrom().getItems().get(0);
+ Select query = (Select) util.parseCommand("select * from
partssupplier.parts"); //$NON-NLS-1$
+ NamedTable group = (NamedTable) query.getFrom().get(0);
AbstractMetadataRecord mid = group.getMetadataObject();
assertEquals("PartsSupplier.PARTSSUPPLIER.PARTS", mid.getFullName());
//$NON-NLS-1$
Modified:
branches/JCA/test-integration/common/src/test/java/com/metamatrix/connector/jdbc/extension/TestSQLConversionVisitor.java
===================================================================
---
branches/JCA/test-integration/common/src/test/java/com/metamatrix/connector/jdbc/extension/TestSQLConversionVisitor.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/test-integration/common/src/test/java/com/metamatrix/connector/jdbc/extension/TestSQLConversionVisitor.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -38,7 +38,7 @@
import org.teiid.dqp.internal.datamgr.language.TestDeleteImpl;
import org.teiid.dqp.internal.datamgr.language.TestInsertImpl;
import org.teiid.dqp.internal.datamgr.language.TestProcedureImpl;
-import org.teiid.dqp.internal.datamgr.language.TestSelectImpl;
+import org.teiid.dqp.internal.datamgr.language.TestQueryImpl;
import org.teiid.dqp.internal.datamgr.language.TestUpdateImpl;
import org.teiid.dqp.internal.datamgr.language.TstLanguageBridgeFactory;
/**
@@ -383,9 +383,9 @@
@Test public void testVisitISelectWithComment() throws Exception {
String expected = "SELECT /*teiid sessionid:ConnectionID,
requestid:RequestID.PartID*/ g1.e1, g1.e2, g1.e3, g1.e4"; //$NON-NLS-1$
- assertEquals(expected, getStringWithContext(TestSelectImpl.example(false)));
+ assertEquals(expected, getStringWithContext(TestQueryImpl.example(false)));
expected = "SELECT /*teiid sessionid:ConnectionID,
requestid:RequestID.PartID*/ DISTINCT g1.e1, g1.e2, g1.e3, g1.e4"; //$NON-NLS-1$
- assertEquals(expected, getStringWithContext(TestSelectImpl.example(true)));
+ assertEquals(expected, getStringWithContext(TestQueryImpl.example(true)));
}
@Test public void testVisitIUpdateWithComment() throws Exception {
Modified:
branches/JCA/test-integration/common/src/test/java/com/metamatrix/connector/jdbc/util/TestJDBCExecutionHelper.java
===================================================================
---
branches/JCA/test-integration/common/src/test/java/com/metamatrix/connector/jdbc/util/TestJDBCExecutionHelper.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/test-integration/common/src/test/java/com/metamatrix/connector/jdbc/util/TestJDBCExecutionHelper.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -29,12 +29,9 @@
import junit.framework.TestCase;
-import org.teiid.connector.language.QuerySpecification;
-import org.teiid.connector.language.Select;
+import org.teiid.connector.language.DerivedColumn;
import org.teiid.connector.language.Literal;
-import org.teiid.connector.language.QuerySpecification;
import org.teiid.connector.language.Select;
-import org.teiid.connector.language.DerivedColumn;
import com.metamatrix.common.types.DataTypeManager;
@@ -52,8 +49,7 @@
expectedResults[0] = DataTypeManager.DefaultDataClasses.STRING;
symbols.add(new DerivedColumn("c2", new Literal(new Integer(5),
DataTypeManager.DefaultDataClasses.INTEGER))); //$NON-NLS-1$//$NON-NLS-2$
expectedResults[1] = DataTypeManager.DefaultDataClasses.INTEGER;
- Select select = new Select(symbols, false);
- QuerySpecification query = new QuerySpecification(select, null, null, null, null,
null);
+ Select query = new Select(symbols, false, null, null, null, null, null);
Class[] results = query.getColumnTypes();
assertEquals( results[0], expectedResults[0]);
assertEquals( results[1], expectedResults[1]);
Modified:
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/language/TestLanguageUtil.java
===================================================================
---
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/language/TestLanguageUtil.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/language/TestLanguageUtil.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -48,7 +48,7 @@
// Create ICriteria from criteriaStr
TranslationUtility util =
FakeTranslationFactory.getInstance().getBQTTranslationUtility();
String sql = "SELECT IntKey FROM BQT1.SmallA WHERE " + criteriaStr;
//$NON-NLS-1$
- QuerySpecification query = (QuerySpecification) util.parseCommand(sql);
+ Select query = (Select) util.parseCommand(sql);
Condition criteria = query.getWhere();
return criteria;
}
Modified:
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/MockConnector.java
===================================================================
---
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/MockConnector.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/MockConnector.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -61,12 +61,12 @@
RuntimeMetadata metadata) throws ConnectorException {
Properties groupProps = new Properties();
groupProps.setProperty("customName",
"CustomTableA");//$NON-NLS-1$ //$NON-NLS-2$
- NamedTable group =
(NamedTable)query.getProjectedQuery().getFrom().getItems().get(0);
+ NamedTable group = (NamedTable)query.getProjectedQuery().getFrom().get(0);
AbstractMetadataRecord groupMD = group.getMetadataObject();
TestCase.assertEquals(groupProps, groupMD.getProperties());
- DerivedColumn symbl =
query.getProjectedQuery().getSelect().getDerivedColumns().get(0);
+ DerivedColumn symbl = query.getProjectedQuery().getDerivedColumns().get(0);
ColumnReference element = (ColumnReference)symbl.getExpression();
Column elementMD = element.getMetadataObject();
@@ -94,7 +94,7 @@
TestCase.assertEquals(elementProps, elementMD.getProperties());
- DerivedColumn symbl2 =
query.getProjectedQuery().getSelect().getDerivedColumns().get(1);
+ DerivedColumn symbl2 = query.getProjectedQuery().getDerivedColumns().get(1);
ColumnReference element2 = (ColumnReference)symbl2.getExpression();
Column elementMD2 = element2.getMetadataObject();
Modified:
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestElement.java
===================================================================
---
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestElement.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestElement.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -29,7 +29,7 @@
import org.teiid.connector.language.ColumnReference;
import org.teiid.connector.language.DerivedColumn;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.metadata.runtime.BaseColumn.NullType;
import org.teiid.connector.metadata.runtime.Column.SearchType;
@@ -58,8 +58,8 @@
}
public Column getElement(String groupName, String elementName, TranslationUtility
transUtil) throws Exception {
- QuerySpecification query = (QuerySpecification)
transUtil.parseCommand("SELECT " + elementName + " FROM " +
groupName); //$NON-NLS-1$ //$NON-NLS-2$
- DerivedColumn symbol = query.getSelect().getDerivedColumns().get(0);
+ Select query = (Select) transUtil.parseCommand("SELECT " + elementName
+ " FROM " + groupName); //$NON-NLS-1$ //$NON-NLS-2$
+ DerivedColumn symbol = query.getDerivedColumns().get(0);
ColumnReference element = (ColumnReference) symbol.getExpression();
return element.getMetadataObject();
}
Modified:
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestGroup.java
===================================================================
---
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestGroup.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestGroup.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -28,7 +28,7 @@
import junit.framework.TestCase;
import org.teiid.connector.language.NamedTable;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import com.metamatrix.cdk.api.TranslationUtility;
import com.metamatrix.core.util.UnitTestUtil;
@@ -58,8 +58,8 @@
// ################ TEST GROUP METADATAID ######################
public Table getGroup(String groupName, TranslationUtility transUtil) throws
Exception {
- QuerySpecification query = (QuerySpecification)
transUtil.parseCommand("SELECT 1 FROM " + groupName); //$NON-NLS-1$
- NamedTable group = (NamedTable) query.getFrom().getItems().get(0);
+ Select query = (Select) transUtil.parseCommand("SELECT 1 FROM " +
groupName); //$NON-NLS-1$
+ NamedTable group = (NamedTable) query.getFrom().get(0);
return group.getMetadataObject();
}
Modified:
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestMetadataObject.java
===================================================================
---
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestMetadataObject.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/metadata/runtime/TestMetadataObject.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -30,7 +30,7 @@
import org.teiid.connector.language.ColumnReference;
import org.teiid.connector.language.NamedTable;
import org.teiid.connector.language.Call;
-import org.teiid.connector.language.QuerySpecification;
+import org.teiid.connector.language.Select;
import org.teiid.connector.language.DerivedColumn;
import org.teiid.connector.metadata.runtime.Procedure;
@@ -65,8 +65,8 @@
// ################ TEST GROUP METADATAID ######################
public Table getGroupID(String groupName, TranslationUtility transUtil) {
- QuerySpecification query = (QuerySpecification)
transUtil.parseCommand("SELECT 1 FROM " + groupName); //$NON-NLS-1$
- NamedTable group = (NamedTable) query.getFrom().getItems().get(0);
+ Select query = (Select) transUtil.parseCommand("SELECT 1 FROM " +
groupName); //$NON-NLS-1$
+ NamedTable group = (NamedTable) query.getFrom().get(0);
return group.getMetadataObject();
}
@@ -94,8 +94,8 @@
// ################ TEST ELEMENT METADATAID ######################
public Column getElementID(String groupName, String elementName, TranslationUtility
transUtil) {
- QuerySpecification query = (QuerySpecification)
transUtil.parseCommand("SELECT " + elementName + " FROM " +
groupName); //$NON-NLS-1$ //$NON-NLS-2$
- DerivedColumn symbol = query.getSelect().getDerivedColumns().get(0);
+ Select query = (Select) transUtil.parseCommand("SELECT " + elementName
+ " FROM " + groupName); //$NON-NLS-1$ //$NON-NLS-2$
+ DerivedColumn symbol = query.getDerivedColumns().get(0);
ColumnReference element = (ColumnReference) symbol.getExpression();
return element.getMetadataObject();
}
Modified:
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestCollectorVisitor.java
===================================================================
---
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestCollectorVisitor.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestCollectorVisitor.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -22,16 +22,25 @@
package org.teiid.connector.visitor.util;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
-import org.teiid.connector.language.*;
+import junit.framework.TestCase;
+
+import org.teiid.connector.language.ColumnReference;
+import org.teiid.connector.language.Comparison;
+import org.teiid.connector.language.Expression;
+import org.teiid.connector.language.Function;
+import org.teiid.connector.language.LanguageObject;
+import org.teiid.connector.language.NamedTable;
+import org.teiid.connector.language.Select;
import org.teiid.connector.language.Comparison.Operator;
-import org.teiid.connector.visitor.util.CollectorVisitor;
-import org.teiid.dqp.internal.datamgr.language.*;
-
-import junit.framework.TestCase;
-
/**
*/
public class TestCollectorVisitor extends TestCase {
@@ -73,11 +82,9 @@
symbols.add(new ColumnReference(g, "e1", null, String.class));
//$NON-NLS-1$
Function function = new Function("length", Arrays.asList(new
ColumnReference(g, "e2", null, String.class)), Integer.class); //$NON-NLS-1$
//$NON-NLS-2$
symbols.add(function);
- Select s = new Select(symbols, false);
List groups = new ArrayList();
groups.add(g);
- From f = new From(groups);
- QuerySpecification q = new QuerySpecification(s, f, null, null, null, null);
+ Select q = new Select(symbols, false, groups, null, null, null, null);
return q;
}
Modified:
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestSQLStringVisitor.java
===================================================================
---
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestSQLStringVisitor.java 2010-02-27
05:17:30 UTC (rev 1878)
+++
branches/JCA/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestSQLStringVisitor.java 2010-02-27
12:48:26 UTC (rev 1879)
@@ -33,24 +33,20 @@
import org.junit.Test;
import org.teiid.connector.language.AggregateFunction;
import org.teiid.connector.language.ColumnReference;
-import org.teiid.connector.language.Function;
-import org.teiid.connector.language.NamedTable;
import org.teiid.connector.language.Command;
-import org.teiid.connector.language.ColumnReference;
import org.teiid.connector.language.Expression;
import org.teiid.connector.language.Function;
-import org.teiid.connector.language.NamedTable;
import org.teiid.connector.language.Insert;
import org.teiid.connector.language.LanguageObject;
-import org.teiid.connector.language.QuerySpecification;
import org.teiid.connector.language.Literal;
+import org.teiid.connector.language.NamedTable;
+import org.teiid.connector.language.Select;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
import org.teiid.dqp.internal.datamgr.language.TestAggregateImpl;
import org.teiid.dqp.internal.datamgr.language.TestCompareCriteriaImpl;
import org.teiid.dqp.internal.datamgr.language.TestDeleteImpl;
import org.teiid.dqp.internal.datamgr.language.TestElementImpl;
import org.teiid.dqp.internal.datamgr.language.TestExistsCriteriaImpl;
-import org.teiid.dqp.internal.datamgr.language.TestFromImpl;
import org.teiid.dqp.internal.datamgr.language.TestFunctionImpl;
import org.teiid.dqp.internal.datamgr.language.TestGroupByImpl;
import org.teiid.dqp.internal.datamgr.language.TestGroupImpl;
@@ -66,7 +62,6 @@
import org.teiid.dqp.internal.datamgr.language.TestQueryImpl;
import org.teiid.dqp.internal.datamgr.language.TestScalarSubqueryImpl;
import org.teiid.dqp.internal.datamgr.language.TestSearchedCaseExpressionImpl;
-import org.teiid.dqp.internal.datamgr.language.TestSelectImpl;
import org.teiid.dqp.internal.datamgr.language.TestSelectSymbolImpl;
import org.teiid.dqp.internal.datamgr.language.TestSetQueryImpl;
import org.teiid.dqp.internal.datamgr.language.TestSubqueryCompareCriteriaImpl;
@@ -192,14 +187,6 @@
}
/*
- * Test for void visit(IFrom)
- */
- @Test public void testVisitIFrom() throws Exception {
- String expected = "FROM g1, g2 AS myAlias, g3, g4"; //$NON-NLS-1$
- assertEquals(expected, getString(TestFromImpl.example()));
- }
-
- /*
* Test for void visit(IFunction)
*/
@Test public void testVisitIFunction() throws Exception {
@@ -355,7 +342,7 @@
*/
@Test public void testVisitIQuery() throws Exception {
String expected = "SELECT DISTINCT g1.e1, g1.e2, g1.e3, g1.e4 FROM g1, g2 AS
myAlias, g3, g4 WHERE (100 >= 200) AND (500 < 600) GROUP BY g1.e1, g1.e2, g1.e3,
g1.e4 HAVING (100 >= 200) AND (500 < 600) ORDER BY e1, e2 DESC, e3, e4 DESC";
//$NON-NLS-1$
- assertEquals(expected, getString(TestQueryImpl.example()));
+ assertEquals(expected, getString(TestQueryImpl.example(true)));
}
/*
@@ -379,9 +366,9 @@
*/
@Test public void testVisitISelect() throws Exception {
String expected = "SELECT g1.e1, g1.e2, g1.e3, g1.e4"; //$NON-NLS-1$
- assertEquals(expected, getString(TestSelectImpl.example(false)));
+ assertEquals(expected, getString(TestQueryImpl.example(false)));
expected = "SELECT DISTINCT g1.e1, g1.e2, g1.e3, g1.e4"; //$NON-NLS-1$
- assertEquals(expected, getString(TestSelectImpl.example(true)));
+ assertEquals(expected, getString(TestQueryImpl.example(true)));
}
@@ -453,7 +440,7 @@
Insert insert =
(Insert)FakeTranslationFactory.getInstance().getExampleTranslationUtility().parseCommand(sql);
- QuerySpecification command =
(QuerySpecification)FakeTranslationFactory.getInstance().getExampleTranslationUtility().parseCommand("select
* from pm1.g2"); //$NON-NLS-1$
+ Select command =
(Select)FakeTranslationFactory.getInstance().getExampleTranslationUtility().parseCommand("select
* from pm1.g2"); //$NON-NLS-1$
insert.setValueSource(command);
assertEquals("INSERT INTO g1 (e1, e2, e3, e4) SELECT g2.e1, g2.e2, g2.e3, g2.e4
FROM g2", insert.toString()); //$NON-NLS-1$
}