teiid SVN: r2631 - branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-10-06 13:07:08 -0400 (Wed, 06 Oct 2010)
New Revision: 2631
Modified:
branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCBaseExecution.java
Log:
TEIID-1292 catching the sqlexception from setting the fetch size.
Modified: branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCBaseExecution.java
===================================================================
--- branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCBaseExecution.java 2010-10-06 15:30:16 UTC (rev 2630)
+++ branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCBaseExecution.java 2010-10-06 17:07:08 UTC (rev 2631)
@@ -134,8 +134,14 @@
}
}
- protected void setSizeContraints(Statement statement) throws SQLException {
- statement.setFetchSize(fetchSize);
+ protected void setSizeContraints(Statement statement) {
+ try {
+ statement.setFetchSize(fetchSize);
+ } catch (SQLException e) {
+ if (LogManager.isMessageToBeRecorded(LogConstants.CTX_CONNECTOR, MessageLevel.DETAIL)) {
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, context.getRequestIdentifier(), " could not set fetch size: ", fetchSize); //$NON-NLS-1$
+ }
+ }
}
protected synchronized Statement getStatement() throws SQLException {
@@ -185,7 +191,7 @@
warning = toAdd.getNextWarning();
toAdd.setNextException(null);
if (LogManager.isMessageToBeRecorded(LogConstants.CTX_CONNECTOR, MessageLevel.DETAIL)) {
- LogManager.logDetail(context.getRequestIdentifier() + " Warning: ", warning); //$NON-NLS-1$
+ LogManager.logDetail(LogConstants.CTX_CONNECTOR, context.getRequestIdentifier() + " Warning: ", warning); //$NON-NLS-1$
}
context.addWarning(toAdd);
}
14 years, 2 months
teiid SVN: r2630 - branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-10-06 11:30:16 -0400 (Wed, 06 Oct 2010)
New Revision: 2630
Modified:
branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java
Log:
TEIID-1270: updating the help text for "getAdmin()" method.
Modified: branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java
===================================================================
--- branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java 2010-10-05 20:36:57 UTC (rev 2629)
+++ branches/7.1.x/adminshell/src/main/java/org/teiid/adminshell/AdminShell.java 2010-10-06 15:30:16 UTC (rev 2630)
@@ -365,7 +365,7 @@
return getAdmin().getDataSourceTemplateNames();
}
- @Doc(text = "Get the current Admin connection")
+ @Doc(text = "Get the current org.teiid.adminapi.Admin instance for direct use. Note: Used for advanced usecases to bypass AdminShell methods")
public static Admin getAdmin() {
if (internalAdmin == null) {
throw new NullPointerException("Not connected. You must call a \"connectAsAdmin\" method or choose an active connection via \"useConnection\"."); //$NON-NLS-1$
14 years, 2 months
teiid SVN: r2629 - branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-10-05 16:36:57 -0400 (Tue, 05 Oct 2010)
New Revision: 2629
Modified:
branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
Log:
TEIID-982:Adding missing Managed Operation parameter description
Modified: branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java
===================================================================
--- branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-10-05 17:38:15 UTC (rev 2628)
+++ branches/7.1.x/jboss-integration/src/main/java/org/teiid/jboss/deployers/RuntimeEngineDeployer.java 2010-10-05 20:36:57 UTC (rev 2629)
@@ -478,7 +478,7 @@
}
@Override
- @ManagementOperation(description="Execute a sql query", params={@ManagementParameter(name="vdbName"),@ManagementParameter(name="vdbVersion"), @ManagementParameter(name="command")})
+ @ManagementOperation(description="Execute a sql query", params={@ManagementParameter(name="vdbName"),@ManagementParameter(name="vdbVersion"), @ManagementParameter(name="command"), @ManagementParameter(name="timoutInMilli")})
public List<List> executeQuery(final String vdbName, final int version, final String command, final long timoutInMilli) throws AdminException {
Properties properties = new Properties();
properties.setProperty(TeiidURL.JDBC.VDB_NAME, vdbName);
14 years, 2 months
teiid SVN: r2628 - in branches/7.1.x/client/src: test/java/org/teiid/adminapi/impl and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-10-05 13:38:15 -0400 (Tue, 05 Oct 2010)
New Revision: 2628
Modified:
branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java
branches/7.1.x/client/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java
Log:
TEIID-1290 fixing the mapping of session info
Modified: branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java 2010-10-05 16:19:47 UTC (rev 2627)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/SessionMetadataMapper.java 2010-10-05 17:38:15 UTC (rev 2628)
@@ -81,7 +81,7 @@
CompositeMetaType composite = (CompositeMetaType) metaType;
CompositeValueSupport session = new CompositeValueSupport(composite);
- session.set(APPLICATION_NAME, SimpleValueSupport.wrap(object.getName()));
+ session.set(APPLICATION_NAME, SimpleValueSupport.wrap(object.getApplicationName()));
session.set(CREATED_TIME, SimpleValueSupport.wrap(object.getCreatedTime()));
session.set(CLIENT_HOST_NAME, SimpleValueSupport.wrap(object.getClientHostName()));
session.set(IP_ADDRESS, SimpleValueSupport.wrap(object.getIPAddress()));
Modified: branches/7.1.x/client/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java
===================================================================
--- branches/7.1.x/client/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java 2010-10-05 16:19:47 UTC (rev 2627)
+++ branches/7.1.x/client/src/test/java/org/teiid/adminapi/impl/TestSessionMetadata.java 2010-10-05 17:38:15 UTC (rev 2628)
@@ -33,13 +33,14 @@
@Test public void testMapping() {
SessionMetadata session = new SessionMetadata();
session.setSessionId("test");
-
+ session.setApplicationName("foo");
SessionMetadataMapper smm = new SessionMetadataMapper();
MetaValue mv = smm.createMetaValue(smm.getMetaType(), session);
SessionMetadata session1 = smm.unwrapMetaValue(mv);
assertEquals(session.getSessionId(), session1.getSessionId());
+ assertEquals(session.getApplicationName(), session1.getApplicationName());
}
}
14 years, 3 months
teiid SVN: r2627 - in branches/7.1.x: common-core/src/main/java/org/teiid/core/util and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-10-05 12:19:47 -0400 (Tue, 05 Oct 2010)
New Revision: 2627
Modified:
branches/7.1.x/client/src/main/java/org/teiid/net/socket/Handshake.java
branches/7.1.x/common-core/src/main/java/org/teiid/core/util/ApplicationInfo.java
Log:
TEIID-1287 fix for client's use of version info that is safe for product builds as well
Modified: branches/7.1.x/client/src/main/java/org/teiid/net/socket/Handshake.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/net/socket/Handshake.java 2010-10-05 16:09:40 UTC (rev 2626)
+++ branches/7.1.x/client/src/main/java/org/teiid/net/socket/Handshake.java 2010-10-05 16:19:47 UTC (rev 2627)
@@ -37,7 +37,7 @@
private static final long serialVersionUID = 7839271224736355515L;
- private String version = ApplicationInfo.getInstance().getMajorReleaseNumber();
+ private String version = ApplicationInfo.getInstance().getReleaseNumber();
private byte[] publicKey;
/**
@@ -51,7 +51,7 @@
* @param version The version to set.
*/
public void setVersion() {
- this.version = ApplicationInfo.getInstance().getMajorReleaseNumber();
+ this.version = ApplicationInfo.getInstance().getReleaseNumber();
}
/**
Modified: branches/7.1.x/common-core/src/main/java/org/teiid/core/util/ApplicationInfo.java
===================================================================
--- branches/7.1.x/common-core/src/main/java/org/teiid/core/util/ApplicationInfo.java 2010-10-05 16:09:40 UTC (rev 2626)
+++ branches/7.1.x/common-core/src/main/java/org/teiid/core/util/ApplicationInfo.java 2010-10-05 16:19:47 UTC (rev 2627)
@@ -70,10 +70,6 @@
return props.getProperty("build.releaseNumber"); //$NON-NLS-1$
}
- public String getMajorReleaseNumber() {
- return getReleaseNumber().substring(0, getReleaseNumber().lastIndexOf('.'));
- }
-
public int getMajorReleaseVersion() {
String version = getReleaseNumber().substring(0, getReleaseNumber().indexOf('.'));
return Integer.parseInt(version);
14 years, 3 months
teiid SVN: r2626 - in branches/7.1.x: connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape and 5 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-10-05 12:09:40 -0400 (Tue, 05 Oct 2010)
New Revision: 2626
Added:
branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/IdentifierFunctionModifier.java
branches/7.1.x/connectors/translator-jdbc/src/main/resources/JCRFunctions.xmi
Removed:
branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeSQLVisitor.java
branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeUtil.java
branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/PathFunctionModifier.java
branches/7.1.x/connectors/translator-jdbc/src/test/resources/ModeShape.vdb
Modified:
branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeExecutionFactory.java
branches/7.1.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/TranslationHelper.java
branches/7.1.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/modeshape/TestModeShapeSqlTranslator.java
branches/7.1.x/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
Log:
TEIID-1106 updating support for modeshape's modified jcr2 sql over jdbc
Modified: branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
===================================================================
--- branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2010-10-04 21:04:24 UTC (rev 2625)
+++ branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2010-10-05 16:09:40 UTC (rev 2626)
@@ -563,7 +563,7 @@
* @param modifier
*/
public void registerFunctionModifier(String name, FunctionModifier modifier) {
- this.functionModifiers.put(name, modifier);
+ this.functionModifiers.put(name.toLowerCase(), modifier);
}
/**
Copied: branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/IdentifierFunctionModifier.java (from rev 2611, branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/PathFunctionModifier.java)
===================================================================
--- branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/IdentifierFunctionModifier.java (rev 0)
+++ branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/IdentifierFunctionModifier.java 2010-10-05 16:09:40 UTC (rev 2626)
@@ -0,0 +1,94 @@
+/*
+ * 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.translator.jdbc.modeshape;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.teiid.language.ColumnReference;
+import org.teiid.language.Expression;
+import org.teiid.language.Function;
+import org.teiid.language.NamedTable;
+import org.teiid.language.SQLConstants;
+import org.teiid.metadata.Column;
+import org.teiid.translator.jdbc.FunctionModifier;
+
+
+/**
+ * Function to translate ColumnReferences to selector names
+ * @since 7.1
+ */
+public class IdentifierFunctionModifier extends FunctionModifier {
+
+ public List<?> translate(Function function) {
+
+ List<Object> objs = new ArrayList<Object>();
+
+ List<Expression> parms = function.getParameters();
+
+ objs.add(function.getName().substring(function.getName().indexOf('_') + 1));
+ objs.add(SQLConstants.Tokens.LPAREN);
+
+ for (Iterator<Expression> iter = parms.iterator(); iter.hasNext();)
+ {
+ Expression expr = iter.next();
+ if (expr instanceof ColumnReference) {
+ boolean dotAll = false;
+ boolean useSelector = false;
+ ColumnReference cr = (ColumnReference)expr;
+ Column c = cr.getMetadataObject();
+ if (c != null) {
+ if ("\"mode:properties\"".equalsIgnoreCase(c.getNameInSource())) { //$NON-NLS-1$
+ dotAll = true;
+ useSelector = true;
+ } else if ("\"mode:path\"".equalsIgnoreCase(c.getNameInSource())) { //$NON-NLS-1$
+ useSelector = true;
+ }
+ }
+ if (useSelector) {
+ NamedTable nt = ((ColumnReference)expr).getTable();
+ if (nt.getCorrelationName() != null) {
+ objs.add(nt.getCorrelationName());
+ } else {
+ objs.add(nt);
+ }
+ } else {
+ objs.add(expr);
+ }
+ if (dotAll) {
+ objs.add(".*"); //$NON-NLS-1$
+ }
+ } else {
+ objs.add(expr);
+ }
+ if (iter.hasNext()) {
+ objs.add(", "); //$NON-NLS-1$
+ }
+ }
+
+ objs.add(SQLConstants.Tokens.RPAREN);
+ return objs;
+ }
+
+}
Property changes on: branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/IdentifierFunctionModifier.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeExecutionFactory.java
===================================================================
--- branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeExecutionFactory.java 2010-10-04 21:04:24 UTC (rev 2625)
+++ branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeExecutionFactory.java 2010-10-05 16:09:40 UTC (rev 2626)
@@ -29,174 +29,219 @@
import java.util.Arrays;
import java.util.List;
-import org.teiid.language.ColumnReference;
-import org.teiid.language.Expression;
+import org.teiid.language.Comparison;
import org.teiid.language.Function;
import org.teiid.language.LanguageObject;
import org.teiid.language.Literal;
-import org.teiid.language.NamedTable;
+import org.teiid.language.Not;
+import org.teiid.language.Comparison.Operator;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.translator.ExecutionContext;
import org.teiid.translator.SourceSystemFunctions;
import org.teiid.translator.Translator;
import org.teiid.translator.TranslatorException;
-import org.teiid.translator.jdbc.ConvertModifier;
-import org.teiid.translator.jdbc.FunctionModifier;
+import org.teiid.translator.TypeFacility;
+import org.teiid.translator.jdbc.AliasModifier;
import org.teiid.translator.jdbc.JDBCExecutionFactory;
-import org.teiid.translator.jdbc.SQLConversionVisitor;
-
-
/**
* Translator class for accessing the ModeShape JCR repository.
*/
-@Translator(name="modeshape", description="A translator for open source Modeshape JCA repository")
+@Translator(name="modeshape", description="A translator for the open source Modeshape JCR Repository")
public class ModeShapeExecutionFactory extends JDBCExecutionFactory {
public ModeShapeExecutionFactory() {
setDatabaseVersion("2.0"); //$NON-NLS-1$
+ setUseBindVariables(false);
}
@Override
public void start() throws TranslatorException {
super.start();
- registerFunctionModifier("PATH", new PathFunctionModifier());
-
- //add in type conversion
- ConvertModifier convertModifier = new ConvertModifier();
-
+ registerFunctionModifier(SourceSystemFunctions.UCASE, new AliasModifier("UpperCase")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.LCASE,new AliasModifier("LowerCase")); //$NON-NLS-1$
- convertModifier.addTypeMapping("boolean", FunctionModifier.BOOLEAN); //$NON-NLS-1$
- convertModifier.addTypeMapping("smallint", FunctionModifier.BYTE, FunctionModifier.SHORT); //$NON-NLS-1$
- convertModifier.addTypeMapping("integer", FunctionModifier.INTEGER); //$NON-NLS-1$
- convertModifier.addTypeMapping("bigint", FunctionModifier.LONG); //$NON-NLS-1$
- convertModifier.addTypeMapping("real", FunctionModifier.FLOAT); //$NON-NLS-1$
- convertModifier.addTypeMapping("float8", FunctionModifier.DOUBLE); //$NON-NLS-1$
- convertModifier.addTypeMapping("numeric(38)", FunctionModifier.BIGINTEGER); //$NON-NLS-1$
- convertModifier.addTypeMapping("decimal", FunctionModifier.BIGDECIMAL); //$NON-NLS-1$
- convertModifier.addTypeMapping("char(1)", FunctionModifier.CHAR); //$NON-NLS-1$
- convertModifier.addTypeMapping("varchar(4000)", FunctionModifier.STRING); //$NON-NLS-1$
- convertModifier.addTypeMapping("date", FunctionModifier.DATE); //$NON-NLS-1$
- convertModifier.addTypeMapping("time", FunctionModifier.TIME); //$NON-NLS-1$
- convertModifier.addTypeMapping("timestamp", FunctionModifier.TIMESTAMP); //$NON-NLS-1$
- convertModifier.addConvert(FunctionModifier.TIME, FunctionModifier.TIMESTAMP, new FunctionModifier() {
- @Override
- public List<?> translate(Function function) {
- return Arrays.asList(function.getParameters().get(0), " + TIMESTAMP '1970-01-01'"); //$NON-NLS-1$
- }
- });
- convertModifier.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.TIME, new FunctionModifier() {
- @Override
- public List<?> translate(Function function) {
- return Arrays.asList("cast(date_trunc('second', ", function.getParameters().get(0), ") AS time)"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- });
- convertModifier.addConvert(FunctionModifier.DATE, FunctionModifier.STRING, new ConvertModifier.FormatModifier("to_char", "YYYY-MM-DD")); //$NON-NLS-1$ //$NON-NLS-2$
- convertModifier.addConvert(FunctionModifier.TIME, FunctionModifier.STRING, new ConvertModifier.FormatModifier("to_char", "HH24:MI:SS")); //$NON-NLS-1$ //$NON-NLS-2$
- convertModifier.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.STRING, new ConvertModifier.FormatModifier("to_char", "YYYY-MM-DD HH24:MI:SS.UF")); //$NON-NLS-1$ //$NON-NLS-2$
- convertModifier.addConvert(FunctionModifier.BOOLEAN, FunctionModifier.STRING, new FunctionModifier() {
- @Override
- public List<?> translate(Function function) {
- Expression stringValue = function.getParameters().get(0);
- return Arrays.asList("CASE WHEN ", stringValue, " THEN 'true' WHEN not(", stringValue, ") THEN 'false' END"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- });
- convertModifier.addSourceConversion(new FunctionModifier() {
- @Override
- public List<?> translate(Function function) {
- ((Literal)function.getParameters().get(1)).setValue("integer"); //$NON-NLS-1$
- return null;
- }
- }, FunctionModifier.BOOLEAN);
-
- registerFunctionModifier(SourceSystemFunctions.CONVERT, convertModifier);
-
-
- LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Started"); //$NON-NLS-1$
-
+ registerFunctionModifier("JCR_ISCHILDNODE", new IdentifierFunctionModifier()); //$NON-NLS-1$
+ registerFunctionModifier("JCR_ISDESCENDANTNODE", new IdentifierFunctionModifier()); //$NON-NLS-1$
+ registerFunctionModifier("JCR_ISSAMENODE", new IdentifierFunctionModifier()); //$NON-NLS-1$
+ registerFunctionModifier("JCR_REFERENCE", new IdentifierFunctionModifier()); //$NON-NLS-1$
+ registerFunctionModifier("JCR_CONTAINS", new IdentifierFunctionModifier()); //$NON-NLS-1$
+
+ LogManager.logTrace(LogConstants.CTX_CONNECTOR, "ModeShape Translator Started"); //$NON-NLS-1$
}
- /**
- * Create the {@link SQLConversionVisitor} that will perform translation. Typical custom
- * JDBC connectors will not need to create custom conversion visitors, rather implementors
- * should override existing {@link JDBCExecutionFactory} methods.
- * @return the {@link SQLConversionVisitor}
- */
- public SQLConversionVisitor getSQLConversionVisitor() {
- return new ModeShapeSQLVisitor(this);
- }
-
-
- @Override
- public List<?> translate(LanguageObject obj, ExecutionContext context) {
- if (obj instanceof NamedTable) {
- NamedTable nt = (NamedTable) obj;
- List<String> ntlist = new ArrayList<String>(1);
- ntlist.add(ModeShapeUtil.createJCRName(nt.getMetadataObject().getNameInSource()));
- return ntlist;
- } else if (obj instanceof ColumnReference) {
- ColumnReference elem = (ColumnReference) obj;
-
- String nameInSource = "NoNameInSource";
- if (elem.getMetadataObject() != null) {
- nameInSource = elem.getMetadataObject().getNameInSource();
-
- List<String> ntlist = new ArrayList<String>(1);
- ntlist.add(ModeShapeUtil.createJCRName(nameInSource));
-
- return ntlist;
- }
- }
-
- return super.translate(obj, context);
- }
-
-
- @Override
- public String translateLiteralBoolean(Boolean booleanValue) {
- if(booleanValue.booleanValue()) {
- return "TRUE"; //$NON-NLS-1$
- }
- return "FALSE"; //$NON-NLS-1$
- }
-
@Override
public String translateLiteralDate(Date dateValue) {
- return "DATE '" + formatDateValue(dateValue) + "'"; //$NON-NLS-1$//$NON-NLS-2$
+ return "CAST('" + formatDateValue(dateValue) + "' AS DATE)"; //$NON-NLS-1$//$NON-NLS-2$
}
@Override
public String translateLiteralTime(Time timeValue) {
- return "TIME '" + formatDateValue(timeValue) + "'"; //$NON-NLS-1$//$NON-NLS-2$
+ return "CAST('" + formatDateValue(timeValue) + "' AS DATE)"; //$NON-NLS-1$//$NON-NLS-2$
}
@Override
public String translateLiteralTimestamp(Timestamp timestampValue) {
- return "TIMESTAMP '" + formatDateValue(timestampValue) + "'"; //$NON-NLS-1$//$NON-NLS-2$
+ return "CAST('" + formatDateValue(timestampValue) + "' AS DATE)"; //$NON-NLS-1$//$NON-NLS-2$
}
@Override
- public int getTimestampNanoPrecision() {
- return 6;
+ public String translateLiteralBoolean(Boolean booleanValue) {
+ return "CAST('" + booleanValue.toString() + "' AS BOOLEAN)"; //$NON-NLS-1$//$NON-NLS-2$
}
@Override
public List<String> getSupportedFunctions() {
List<String> supportedFunctions = new ArrayList<String>();
supportedFunctions.addAll(super.getSupportedFunctions());
- supportedFunctions.add("PATH"); //$NON-NLS-1$
- supportedFunctions.add("NAME"); //$NON-NLS-1$
- supportedFunctions.add("ISCHILDNODE"); //$NON-NLS-1$
-
+ supportedFunctions.add(SourceSystemFunctions.UCASE);
+ supportedFunctions.add(SourceSystemFunctions.LCASE);
+ supportedFunctions.add(SourceSystemFunctions.LENGTH);
+ supportedFunctions.add("JCR_ISCHILDNODE"); //$NON-NLS-1$
+ supportedFunctions.add("JCR_ISDESCENDANTNODE"); //$NON-NLS-1$
+ supportedFunctions.add("JCR_ISSAMENODE"); //$NON-NLS-1$
+ supportedFunctions.add("JCR_REFERENCE"); //$NON-NLS-1$
+ supportedFunctions.add("JCR_CONTAINS"); //$NON-NLS-1$
return supportedFunctions;
-
}
+
+ @Override
+ public List<?> translate(LanguageObject obj, ExecutionContext context) {
+ if (obj instanceof Comparison) {
+ Comparison compare = (Comparison)obj;
+ if (compare.getLeftExpression().getType() == TypeFacility.RUNTIME_TYPES.BOOLEAN
+ && compare.getLeftExpression() instanceof Function
+ && compare.getRightExpression() instanceof Literal) {
+ boolean isTrue = Boolean.TRUE.equals(((Literal)compare.getRightExpression()).getValue());
+ if ((isTrue && compare.getOperator() == Operator.EQ) || (!isTrue && compare.getOperator() == Operator.NE)) {
+ return Arrays.asList(compare.getLeftExpression());
+ }
+ if ((!isTrue && compare.getOperator() == Operator.EQ) || (isTrue && compare.getOperator() == Operator.NE)) {
+ return Arrays.asList("NOT ", compare.getLeftExpression()); //$NON-NLS-1$
+ }
+ }
+ } else if (obj instanceof Not) {
+ Not not = (Not)obj;
+ return Arrays.asList("NOT ", not.getCriteria()); //$NON-NLS-1$
+ }
+ return super.translate(obj, context);
+ }
@Override
public boolean useBindVariables() {
return false;
}
+ @Override
+ public boolean supportsAggregatesAvg() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsAggregatesCountStar() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsAggregatesCount() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsAggregatesEnhancedNumeric() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsAggregatesMax() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsAggregatesMin() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsAggregatesSum() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsGroupBy() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsHaving() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsSelectExpression() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsCaseExpressions() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsCorrelatedSubqueries() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsExistsCriteria() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsInCriteriaSubquery() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsInlineViews() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsOrderByNullOrdering() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsQuantifiedCompareCriteriaAll() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsQuantifiedCompareCriteriaSome() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsScalarSubqueries() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsSearchedCaseExpressions() {
+ return false;
+ }
+
+ @Override
+ public boolean supportsExcept() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsIntersect() {
+ return true;
+ }
+
}
Deleted: branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeSQLVisitor.java
===================================================================
--- branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeSQLVisitor.java 2010-10-04 21:04:24 UTC (rev 2625)
+++ branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeSQLVisitor.java 2010-10-05 16:09:40 UTC (rev 2626)
@@ -1,95 +0,0 @@
-package org.teiid.translator.jdbc.modeshape;
-
-import static org.teiid.language.SQLConstants.Reserved.BY;
-import static org.teiid.language.SQLConstants.Reserved.ORDER;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.teiid.language.ColumnReference;
-import org.teiid.language.DerivedColumn;
-import org.teiid.language.Expression;
-import org.teiid.language.OrderBy;
-import org.teiid.language.Select;
-import org.teiid.language.SortSpecification;
-import org.teiid.language.SQLConstants.Tokens;
-import org.teiid.metadata.Column;
-import org.teiid.translator.jdbc.JDBCExecutionFactory;
-import org.teiid.translator.jdbc.SQLConversionVisitor;
-
-public class ModeShapeSQLVisitor extends SQLConversionVisitor {
-
- private Map<String, Column> columnMap = new HashMap<String, Column>();
- private Map<String, Column> aliasMap = new HashMap<String, Column>();
-
- public ModeShapeSQLVisitor(JDBCExecutionFactory ef) {
- super(ef);
-
- }
-
- public void visit(Select query) {
-
- // if the query has an order by, then
- // need to cache the columns so that the
- // order by column name can be replaced by its
- // correlating select column that has the nameInSource
- if (query.getOrderBy() == null) {
- super.visit(query);
- return;
- }
-
- List<DerivedColumn> selectSymbols = query.getDerivedColumns();
- Iterator<DerivedColumn> symbolIter = selectSymbols.iterator();
- while (symbolIter.hasNext()) {
- DerivedColumn symbol = symbolIter.next();
- Expression expression = symbol.getExpression();
-
- if (symbol.getAlias() != null) {
-
- }
- // cache the columns so that order by
- if (expression instanceof ColumnReference) {
- ColumnReference colRef = (ColumnReference) expression;
- if (colRef.getMetadataObject() != null) {
- Column element = colRef.getMetadataObject();
- if (symbol.getAlias() != null) {
- aliasMap.put(symbol.getAlias(), element);
- }
- columnMap.put(element.getName(), element);
- }
- }
- }
-
- super.visit(query);
- }
-
- public void visit(OrderBy obj) {
- buffer.append(ORDER)
- .append(Tokens.SPACE)
- .append(BY)
- .append(Tokens.SPACE);
-
- List<SortSpecification> specs = obj.getSortSpecifications();
- for (SortSpecification spec : specs) {
- String specName = spec.getExpression().toString();
- Column col = null;
-
- col = aliasMap.get(specName);
- if (col == null) {
- col = columnMap.get(specName);
- }
- if (col != null) {
- buffer.append(ModeShapeUtil.createJCRName(col.getNameInSource()))
- .append(" ")
- .append(spec.getOrdering().toString());
-
- } else {
- buffer.append(obj.getSortSpecifications());
- }
- }
-
- }
-
-}
Deleted: branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeUtil.java
===================================================================
--- branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeUtil.java 2010-10-04 21:04:24 UTC (rev 2625)
+++ branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeUtil.java 2010-10-05 16:09:40 UTC (rev 2626)
@@ -1,27 +0,0 @@
-package org.teiid.translator.jdbc.modeshape;
-
-public class ModeShapeUtil {
-
- public static final String createJCRName(String name) {
- return "[" + ModeShapeUtil.trimTics(name) + "]";
- }
-
- /**
- * Because the Teiid Designer Import from JDBC adds tic's to a nameInSource that has special characters,
- * they have to be removed when building the sql syntax
- * @param name
- * @return
- */
- public static final String trimTics(String name) {
- String rtn = name;
- if (rtn.startsWith("'")) {
- rtn = rtn.substring(1);
- }
-
- if (rtn.endsWith("'")) {
- rtn = rtn.substring(0, rtn.indexOf("'"));
- }
- return rtn;
- }
-
-}
Deleted: branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/PathFunctionModifier.java
===================================================================
--- branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/PathFunctionModifier.java 2010-10-04 21:04:24 UTC (rev 2625)
+++ branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/PathFunctionModifier.java 2010-10-05 16:09:40 UTC (rev 2626)
@@ -1,58 +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.translator.jdbc.modeshape;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.teiid.language.Expression;
-import org.teiid.language.Function;
-import org.teiid.translator.jdbc.FunctionModifier;
-
-
-/**
- * Function to translate the PATH function
- * @since 7.1
- */
-public class PathFunctionModifier extends FunctionModifier {
-
- public PathFunctionModifier() {
- super();
- }
-
- public List<?> translate(Function function) {
- List<Object> objs = new ArrayList<Object>();
-
- List<Expression> parms = function.getParameters();
-
- for (Expression s : parms)
- {
- String v = s.toString();
- v.replace('\'', ' ');
- objs.add(v);
- }
-
- return objs;
- }
-
-}
Added: branches/7.1.x/connectors/translator-jdbc/src/main/resources/JCRFunctions.xmi
===================================================================
--- branches/7.1.x/connectors/translator-jdbc/src/main/resources/JCRFunctions.xmi (rev 0)
+++ branches/7.1.x/connectors/translator-jdbc/src/main/resources/JCRFunctions.xmi 2010-10-05 16:09:40 UTC (rev 2626)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="ASCII"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:diagram="http://www.metamatrix.com/metamodels/Diagram" xmlns:mmcore="http://www.metamatrix.com/metamodels/Core" xmlns:mmfunction="http://www.metamatrix.com/metamodels/MetaMatrixFunction">
+ <mmcore:ModelAnnotation xmi:uuid="mmuuid:ab62e724-42e6-4dc3-a79b-b232e388b2a4" primaryMetamodelUri="http://www.metamatrix.com/metamodels/MetaMatrixFunction" modelType="FUNCTION" ProducerName="Teiid Designer" ProducerVersion="7.1.0.v20100829-1858-H223-M2"/>
+ <diagram:DiagramContainer xmi:uuid="mmuuid:e34ae0e1-b34f-4889-9a64-3bdcc9d82411">
+ <diagram xmi:uuid="mmuuid:f4269ae0-b411-4b34-b051-5186948278af" type="packageDiagramType" target="mmuuid/ab62e724-42e6-4dc3-a79b-b232e388b2a4">
+ <diagramEntity xmi:uuid="mmuuid:056149af-ef62-4a02-9497-430ec4748dc5" name="JCR_ISCHILDNODE" modelObject="mmuuid/ecf2b4a4-40fe-4cab-b84a-93a26c0560c7" xPosition="20" yPosition="20"/>
+ <diagramEntity xmi:uuid="mmuuid:540e49b4-9034-4de6-bcb6-8c30f2bc6fd6" name="JCR_ISDESCENDANTNODE" modelObject="mmuuid/6387763f-0397-4abc-a2ca-46c9c0f793bd" xPosition="40" yPosition="30"/>
+ <diagramEntity xmi:uuid="mmuuid:87c6912c-78eb-4e60-a0b5-1b0cb0c2a368" name="JCR_ISSAMENODE" modelObject="mmuuid/4ecc9ba6-a383-4196-a261-1860cc3ee88c" xPosition="60" yPosition="40"/>
+ <diagramEntity xmi:uuid="mmuuid:12901a36-f796-4ed1-8dba-68a4493abffb" name="JCR_CONTAINS" modelObject="mmuuid/a84444b6-79b4-45bc-97bf-745503dabc03" xPosition="80" yPosition="50"/>
+ <diagramEntity xmi:uuid="mmuuid:e3725579-e657-455f-845b-ddd1c5690ff8" name="JCR_REFERENCE" modelObject="mmuuid/c562c350-eaf8-4992-a9c0-5450ef188761" xPosition="100" yPosition="60"/>
+ </diagram>
+ </diagram:DiagramContainer>
+ <mmcore:AnnotationContainer xmi:uuid="mmuuid:c3c82dbf-1339-4354-b23d-7135aa430b21"/>
+ <mmfunction:ScalarFunction xmi:uuid="mmuuid:ecf2b4a4-40fe-4cab-b84a-93a26c0560c7" name="JCR_ISCHILDNODE" category="JCR" pushDown="REQUIRED">
+ <inputParameters xmi:uuid="mmuuid:23fd3fce-de13-4b11-957d-a44c2ac6da43" name="path" type="string"/>
+ <inputParameters xmi:uuid="mmuuid:68bafab4-98f7-472d-81cb-38e6bf2aa096" name="path" type="string"/>
+ <returnParameter xmi:uuid="mmuuid:151394ed-8654-4e9a-a081-f3bf02b71b2d" type="boolean"/>
+ </mmfunction:ScalarFunction>
+ <mmfunction:ScalarFunction xmi:uuid="mmuuid:6387763f-0397-4abc-a2ca-46c9c0f793bd" name="JCR_ISDESCENDANTNODE" category="JCR" pushDown="REQUIRED">
+ <inputParameters xmi:uuid="mmuuid:c3a1f10b-58a5-4c5b-a94f-bac009b31284" name="path" type="string"/>
+ <inputParameters xmi:uuid="mmuuid:403500a9-f48b-4603-8d92-2011944baa9d" name="path" type="string"/>
+ <returnParameter xmi:uuid="mmuuid:ae90df19-106a-481d-b905-68a9c2493316" type="boolean"/>
+ </mmfunction:ScalarFunction>
+ <mmfunction:ScalarFunction xmi:uuid="mmuuid:4ecc9ba6-a383-4196-a261-1860cc3ee88c" name="JCR_ISSAMENODE" category="JCR" pushDown="REQUIRED">
+ <inputParameters xmi:uuid="mmuuid:94a8a68c-4744-4cdb-9ad8-23417e5aff56" name="path" type="string"/>
+ <inputParameters xmi:uuid="mmuuid:004473ae-2199-43d0-b4bd-fd996fa18b7b" name="path" type="string"/>
+ <returnParameter xmi:uuid="mmuuid:8ab20d78-fd6a-400a-9e03-70be996b4cc6" type="boolean"/>
+ </mmfunction:ScalarFunction>
+ <mmfunction:ScalarFunction xmi:uuid="mmuuid:a84444b6-79b4-45bc-97bf-745503dabc03" name="JCR_CONTAINS" category="JCR" pushDown="REQUIRED">
+ <inputParameters xmi:uuid="mmuuid:ae2e922c-bd03-4f02-9e23-2f50fc88c497" name="selectorOrProperty" type="string"/>
+ <inputParameters xmi:uuid="mmuuid:10e90221-2ffc-4145-ae3b-494384b823d3" name="searchExpr" type="string"/>
+ <returnParameter xmi:uuid="mmuuid:dab3ded9-9fbf-458f-ade5-4e77b010022b" type="boolean"/>
+ </mmfunction:ScalarFunction>
+ <mmfunction:ScalarFunction xmi:uuid="mmuuid:c562c350-eaf8-4992-a9c0-5450ef188761" name="JCR_REFERENCE" category="JCR" pushDown="REQUIRED">
+ <inputParameters xmi:uuid="mmuuid:aa8e27e8-3fc9-46b9-9c1a-c407af6ee5a6" name="selectorOrProperty" type="string"/>
+ <returnParameter xmi:uuid="mmuuid:d9de7a7d-a84e-4775-9931-5516f4a1a940" type="string"/>
+ </mmfunction:ScalarFunction>
+</xmi:XMI>
Property changes on: branches/7.1.x/connectors/translator-jdbc/src/main/resources/JCRFunctions.xmi
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/7.1.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/TranslationHelper.java
===================================================================
--- branches/7.1.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/TranslationHelper.java 2010-10-04 21:04:24 UTC (rev 2625)
+++ branches/7.1.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/TranslationHelper.java 2010-10-05 16:09:40 UTC (rev 2626)
@@ -51,7 +51,7 @@
return helpTranslate(vdbFileName, null, sql);
}
- public static Command helpTranslate(String vdbFileName, String udf, String sql) {
+ public static TranslationUtility getTranslationUtility(String vdbFileName, String udf) {
TranslationUtility util = null;
if (PARTS_VDB.equals(vdbFileName)) {
util = new TranslationUtility(TranslationHelper.class.getResource(vdbFileName));
@@ -62,16 +62,24 @@
}
if (udf != null) {
- try {
- Collection <FunctionMethod> methods = FunctionMetadataReader.loadFunctionMethods(TranslationHelper.class.getResource(udf).openStream());
- util.setUDF(methods);
- } catch (IOException e) {
- throw new TeiidRuntimeException("failed to load UDF"); //$NON-NLS-1$
- } catch (JAXBException e) {
- throw new TeiidRuntimeException("failed to load UDF"); //$NON-NLS-1$
- }
+ loadUDFs(udf, util);
}
- return util.parseCommand(sql);
+ return util;
+ }
+
+ public static void loadUDFs(String udf, TranslationUtility util) {
+ try {
+ Collection <FunctionMethod> methods = FunctionMetadataReader.loadFunctionMethods(TranslationHelper.class.getResource(udf).openStream());
+ util.setUDF(methods);
+ } catch (IOException e) {
+ throw new TeiidRuntimeException("failed to load UDF"); //$NON-NLS-1$
+ } catch (JAXBException e) {
+ throw new TeiidRuntimeException("failed to load UDF"); //$NON-NLS-1$
+ }
+ }
+
+ public static Command helpTranslate(String vdbFileName, String udf, String sql) {
+ return getTranslationUtility(vdbFileName, udf).parseCommand(sql);
}
public static void helpTestVisitor(String vdb, String input, String expectedOutput, JDBCExecutionFactory translator) throws TranslatorException {
Modified: branches/7.1.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/modeshape/TestModeShapeSqlTranslator.java
===================================================================
--- branches/7.1.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/modeshape/TestModeShapeSqlTranslator.java 2010-10-04 21:04:24 UTC (rev 2625)
+++ branches/7.1.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/modeshape/TestModeShapeSqlTranslator.java 2010-10-05 16:09:40 UTC (rev 2626)
@@ -22,18 +22,21 @@
package org.teiid.translator.jdbc.modeshape;
-import static org.junit.Assert.assertEquals;
+import java.util.List;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.mockito.Mockito;
import org.teiid.cdk.api.TranslationUtility;
-import org.teiid.core.util.UnitTestUtil;
import org.teiid.language.Command;
-import org.teiid.language.LanguageFactory;
-import org.teiid.translator.ExecutionContext;
+import org.teiid.metadata.Column;
+import org.teiid.metadata.MetadataStore;
+import org.teiid.metadata.Schema;
+import org.teiid.metadata.Table;
+import org.teiid.query.metadata.TransformationMetadata;
+import org.teiid.query.unittest.RealMetadataFactory;
import org.teiid.translator.TranslatorException;
-import org.teiid.translator.jdbc.TranslatedCommand;
+import org.teiid.translator.TypeFacility;
+import org.teiid.translator.jdbc.TranslationHelper;
/**
*/
@@ -41,67 +44,66 @@
public class TestModeShapeSqlTranslator {
private static ModeShapeExecutionFactory TRANSLATOR;
+ private static TranslationUtility UTIL;
+ private static String UDF = "/JCRFunctions.xmi"; //$NON-NLS-1$;
- private static String MODESHAPE_VDB = (UnitTestUtil.getTestDataPath() != null ? UnitTestUtil
- .getTestDataPath()
- : "src/test/resources")
- + "/ModeShape.vdb";
-
-
@BeforeClass
public static void setUp() throws TranslatorException {
TRANSLATOR = new ModeShapeExecutionFactory();
TRANSLATOR.setUseBindVariables(false);
TRANSLATOR.start();
-
+ UTIL = new TranslationUtility(getMetadata());
+ TranslationHelper.loadUDFs(UDF, UTIL);
}
+
+ public static TransformationMetadata getMetadata() {
+ MetadataStore store = new MetadataStore();
+ Schema modeshape = RealMetadataFactory.createPhysicalModel("modeshape", store);
+ Table nt_base = RealMetadataFactory.createPhysicalGroup("nt_base", modeshape);
+ nt_base.setNameInSource("\"nt:base\"");
+ List<Column> cols = RealMetadataFactory.createElements(nt_base, new String[] { "mode_path",
+ "mode_properties", "jcr_primaryType", "prop" }, new String[] {
+ TypeFacility.RUNTIME_NAMES.STRING,
+ TypeFacility.RUNTIME_NAMES.STRING,
+ TypeFacility.RUNTIME_NAMES.STRING,
+ TypeFacility.RUNTIME_NAMES.STRING });
+ cols.get(0).setNameInSource("\"mode:path\"");
+ cols.get(1).setNameInSource("\"mode:properties\"");
+ cols.get(2).setNameInSource("\"jcr:primaryType\"");
+ return RealMetadataFactory.createTransformationMetadata(store, "modeshape");
+ }
- public void helpTestVisitor(TranslationUtility util, String input,
- String expectedOutput) throws TranslatorException {
- // Convert from sql to objects
- Command obj = util.parseCommand(input);
-
- TranslatedCommand tc = new TranslatedCommand(Mockito
- .mock(ExecutionContext.class), TRANSLATOR);
- tc.translateCommand(obj);
- assertEquals("Did not get correct sql", expectedOutput, tc.getSql()); //$NON-NLS-1$
+ public void helpTestVisitor(String input, String expectedOutput) throws TranslatorException {
+ Command obj = UTIL.parseCommand(input, true, true);
+ TranslationHelper.helpTestVisitor(expectedOutput, TRANSLATOR, obj);
}
@Test
public void testSelectAllFromBase() throws Exception {
String input = "select * from nt_base"; //$NON-NLS-1$
- String output = "SELECT [jcr:primaryType] FROM [nt:base]"; //$NON-NLS-1$
+ String output = "SELECT g_0.\"mode:path\", g_0.\"mode:properties\", g_0.\"jcr:primaryType\", g_0.prop FROM \"nt:base\" AS g_0"; //$NON-NLS-1$
- helpTestVisitor(new TranslationUtility(MODESHAPE_VDB), input, output);
+ helpTestVisitor(input, output);
}
@Test
- public void testSelectColumnFromBase() throws Exception {
- String input = "select jcr_primaryType from nt_base"; //$NON-NLS-1$
- String output = "SELECT [jcr:primaryType] FROM [nt:base]"; //$NON-NLS-1$
+ public void testPredicate() throws Exception {
- helpTestVisitor(new TranslationUtility(MODESHAPE_VDB), input, output);
+ String input = "SELECT x.jcr_primaryType from nt_base inner join nt_base as x on jcr_issamenode(nt_base.mode_path, x.mode_path) = true where jcr_isdescendantnode(nt_base.mode_path, 'x/y/z') = true and jcr_reference(nt_base.mode_properties) = 'x'"; //$NON-NLS-1$
+ String output = "SELECT g_1.\"jcr:primaryType\" FROM \"nt:base\" AS g_0 INNER JOIN \"nt:base\" AS g_1 ON issamenode(g_0, g_1) WHERE isdescendantnode(g_0, 'x/y/z') AND reference(g_0.*) = 'x'"; //$NON-NLS-1$
- }
+ helpTestVisitor(input, output);
- @Test
- public void testWhereClause() throws Exception {
-
- String input = "SELECT jcr_primaryType from nt_base WHERE jcr_primaryType = 'relational:column'"; //$NON-NLS-1$
- String output = "SELECT [jcr:primaryType] FROM [nt:base] WHERE [jcr:primaryType] = 'relational:column'"; //$NON-NLS-1$
-
- helpTestVisitor(new TranslationUtility(MODESHAPE_VDB), input, output);
-
}
@Test
public void testOrderBy() throws Exception {
String input = "SELECT jcr_primaryType from nt_base ORDER BY jcr_primaryType"; //$NON-NLS-1$
- String output = "SELECT [jcr:primaryType] FROM [nt:base] ORDER BY [jcr:primaryType] ASC"; //$NON-NLS-1$
+ String output = "SELECT g_0.\"jcr:primaryType\" AS c_0 FROM \"nt:base\" AS g_0 ORDER BY c_0"; //$NON-NLS-1$
- helpTestVisitor(new TranslationUtility(MODESHAPE_VDB), input, output);
+ helpTestVisitor(input, output);
}
@@ -109,12 +111,10 @@
public void testUsingLike() throws Exception {
String input = "SELECT jcr_primaryType from nt_base WHERE jcr_primaryType LIKE '%relational%'"; //$NON-NLS-1$
- String output = "SELECT [jcr:primaryType] FROM [nt:base] WHERE [jcr:primaryType] LIKE '%relational%'"; //$NON-NLS-1$
+ String output = "SELECT g_0.\"jcr:primaryType\" FROM \"nt:base\" AS g_0 WHERE g_0.\"jcr:primaryType\" LIKE '%relational%'"; //$NON-NLS-1$
- helpTestVisitor(new TranslationUtility(MODESHAPE_VDB), input, output);
+ helpTestVisitor(input, output);
}
-
-
}
Deleted: branches/7.1.x/connectors/translator-jdbc/src/test/resources/ModeShape.vdb
===================================================================
(Binary files differ)
Modified: branches/7.1.x/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java 2010-10-04 21:04:24 UTC (rev 2625)
+++ branches/7.1.x/engine/src/test/java/org/teiid/query/unittest/RealMetadataFactory.java 2010-10-05 16:09:40 UTC (rev 2626)
@@ -260,7 +260,7 @@
return createTransformationMetadata(metadataStore, "bqt");
}
- private static TransformationMetadata createTransformationMetadata(
+ public static TransformationMetadata createTransformationMetadata(
MetadataStore metadataStore, String vdbName) {
CompositeMetadataStore store = new CompositeMetadataStore(metadataStore);
VDBMetaData vdbMetaData = new VDBMetaData();
14 years, 3 months
teiid SVN: r2625 - in trunk: api/src/main/java/org/teiid/language/visitor and 32 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-10-04 17:04:24 -0400 (Mon, 04 Oct 2010)
New Revision: 2625
Added:
trunk/api/src/main/java/org/teiid/language/With.java
trunk/api/src/main/java/org/teiid/language/WithItem.java
trunk/engine/src/main/java/org/teiid/query/sql/lang/WithQueryCommand.java
trunk/engine/src/test/java/org/teiid/query/processor/TestWithClauseProcessing.java
Removed:
trunk/engine/src/main/java/org/teiid/query/execution/
Modified:
trunk/api/src/main/java/org/teiid/language/QueryExpression.java
trunk/api/src/main/java/org/teiid/language/visitor/CollectorVisitor.java
trunk/api/src/main/java/org/teiid/language/visitor/DelegatingHierarchyVisitor.java
trunk/api/src/main/java/org/teiid/language/visitor/HierarchyVisitor.java
trunk/api/src/main/java/org/teiid/language/visitor/LanguageObjectVisitor.java
trunk/api/src/main/java/org/teiid/language/visitor/SQLStringVisitor.java
trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java
trunk/build/kits/jboss-container/teiid-releasenotes.html
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/db2/DB2ExecutionFactory.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/postgresql/PostgreSQLExecutionFactory.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/sqlserver/SQLServerExecutionFactory.java
trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml
trunk/documentation/reference/src/main/docbook/en-US/content/grammar.xml
trunk/documentation/reference/src/main/docbook/en-US/content/sql_support.xml
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java
trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
trunk/engine/src/main/java/org/teiid/query/analysis/AnalysisRecord.java
trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java
trunk/engine/src/main/java/org/teiid/query/optimizer/capabilities/SourceCapabilities.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/NodeConstants.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlaceAccess.java
trunk/engine/src/main/java/org/teiid/query/processor/BatchIterator.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/JoinStrategy.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/PartitionedSortJoin.java
trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalPlan.java
trunk/engine/src/main/java/org/teiid/query/resolver/ProcedureContainerResolver.java
trunk/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java
trunk/engine/src/main/java/org/teiid/query/resolver/command/SetQueryResolver.java
trunk/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java
trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java
trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
trunk/engine/src/main/java/org/teiid/query/sql/LanguageObject.java
trunk/engine/src/main/java/org/teiid/query/sql/LanguageVisitor.java
trunk/engine/src/main/java/org/teiid/query/sql/lang/Insert.java
trunk/engine/src/main/java/org/teiid/query/sql/lang/Query.java
trunk/engine/src/main/java/org/teiid/query/sql/lang/QueryCommand.java
trunk/engine/src/main/java/org/teiid/query/sql/lang/SetQuery.java
trunk/engine/src/main/java/org/teiid/query/sql/lang/SubqueryContainer.java
trunk/engine/src/main/java/org/teiid/query/sql/navigator/DeepPostOrderNavigator.java
trunk/engine/src/main/java/org/teiid/query/sql/navigator/DeepPreOrderNavigator.java
trunk/engine/src/main/java/org/teiid/query/sql/navigator/PostOrderNavigator.java
trunk/engine/src/main/java/org/teiid/query/sql/navigator/PreOrPostOrderNavigator.java
trunk/engine/src/main/java/org/teiid/query/sql/navigator/PreOrderNavigator.java
trunk/engine/src/main/java/org/teiid/query/sql/symbol/GroupSymbol.java
trunk/engine/src/main/java/org/teiid/query/sql/visitor/AggregateSymbolCollectorVisitor.java
trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
trunk/engine/src/main/java/org/teiid/query/sql/visitor/ValueIteratorProviderCollectorVisitor.java
trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java
trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java
trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java
Log:
TEIID-1288 TEIID-1171 adding support for explicit table syntax and for non-recursive common table expressions.
Modified: trunk/api/src/main/java/org/teiid/language/QueryExpression.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/QueryExpression.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/api/src/main/java/org/teiid/language/QueryExpression.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -28,6 +28,7 @@
private OrderBy orderBy;
private Limit limit;
+ private With with;
public abstract Select getProjectedQuery();
@@ -93,4 +94,12 @@
public void setLimit(Limit limit) {
this.limit = limit;
}
+
+ public With getWith() {
+ return with;
+ }
+
+ public void setWith(With with) {
+ this.with = with;
+ }
}
Added: trunk/api/src/main/java/org/teiid/language/With.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/With.java (rev 0)
+++ trunk/api/src/main/java/org/teiid/language/With.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -0,0 +1,46 @@
+/*
+ * 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.language;
+
+import java.util.List;
+
+import org.teiid.language.visitor.LanguageObjectVisitor;
+
+public class With extends BaseLanguageObject {
+
+ private List<WithItem> items;
+
+ public List<WithItem> getItems() {
+ return items;
+ }
+
+ public void setItems(List<WithItem> items) {
+ this.items = items;
+ }
+
+ @Override
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+}
Property changes on: trunk/api/src/main/java/org/teiid/language/With.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/api/src/main/java/org/teiid/language/WithItem.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/WithItem.java (rev 0)
+++ trunk/api/src/main/java/org/teiid/language/WithItem.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -0,0 +1,66 @@
+/*
+ * 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.language;
+
+import java.util.List;
+
+import org.teiid.language.visitor.LanguageObjectVisitor;
+
+public class WithItem extends BaseLanguageObject implements SubqueryContainer {
+
+ private NamedTable table;
+ private List<ColumnReference> columns;
+ private QueryExpression queryExpression;
+
+ public NamedTable getTable() {
+ return table;
+ }
+
+ public void setTable(NamedTable table) {
+ this.table = table;
+ }
+
+ public List<ColumnReference> getColumns() {
+ return columns;
+ }
+
+ public void setColumns(List<ColumnReference> columns) {
+ this.columns = columns;
+ }
+
+ @Override
+ public QueryExpression getSubquery() {
+ return queryExpression;
+ }
+
+ @Override
+ public void setSubquery(QueryExpression query) {
+ this.queryExpression = query;
+ }
+
+ @Override
+ public void acceptVisitor(LanguageObjectVisitor visitor) {
+ visitor.visit(this);
+ }
+
+}
Property changes on: trunk/api/src/main/java/org/teiid/language/WithItem.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/api/src/main/java/org/teiid/language/visitor/CollectorVisitor.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/visitor/CollectorVisitor.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/api/src/main/java/org/teiid/language/visitor/CollectorVisitor.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -63,6 +63,8 @@
import org.teiid.language.SubqueryComparison;
import org.teiid.language.SubqueryIn;
import org.teiid.language.Update;
+import org.teiid.language.With;
+import org.teiid.language.WithItem;
/**
@@ -232,6 +234,16 @@
public void visit(IteratorValueSource obj) {
checkInstance(obj);
}
+
+ @Override
+ public void visit(With obj) {
+ checkInstance(obj);
+ }
+
+ @Override
+ public void visit(WithItem obj) {
+ checkInstance(obj);
+ }
/**
* This is a utility method to instantiate and run the visitor in conjunction
@@ -244,7 +256,7 @@
public static <T> Collection<T> collectObjects(Class<T> type, LanguageObject object) {
CollectorVisitor<T> visitor = new CollectorVisitor<T>(type);
DelegatingHierarchyVisitor hierarchyVisitor = new DelegatingHierarchyVisitor(visitor, null);
- object.acceptVisitor(hierarchyVisitor);
+ hierarchyVisitor.visitNode(object);
return visitor.getCollectedObjects();
}
Modified: trunk/api/src/main/java/org/teiid/language/visitor/DelegatingHierarchyVisitor.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/visitor/DelegatingHierarchyVisitor.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/api/src/main/java/org/teiid/language/visitor/DelegatingHierarchyVisitor.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -23,40 +23,7 @@
package org.teiid.language.visitor;
import org.teiid.connector.DataPlugin;
-import org.teiid.language.AggregateFunction;
-import org.teiid.language.AndOr;
-import org.teiid.language.Argument;
-import org.teiid.language.BatchedUpdates;
-import org.teiid.language.Call;
-import org.teiid.language.ColumnReference;
-import org.teiid.language.Comparison;
-import org.teiid.language.Delete;
-import org.teiid.language.DerivedColumn;
-import org.teiid.language.DerivedTable;
-import org.teiid.language.Exists;
-import org.teiid.language.Function;
-import org.teiid.language.GroupBy;
-import org.teiid.language.In;
-import org.teiid.language.Insert;
-import org.teiid.language.IsNull;
-import org.teiid.language.Join;
import org.teiid.language.LanguageObject;
-import org.teiid.language.Like;
-import org.teiid.language.Limit;
-import org.teiid.language.Literal;
-import org.teiid.language.NamedTable;
-import org.teiid.language.Not;
-import org.teiid.language.OrderBy;
-import org.teiid.language.ScalarSubquery;
-import org.teiid.language.SearchedCase;
-import org.teiid.language.SearchedWhenClause;
-import org.teiid.language.Select;
-import org.teiid.language.SetClause;
-import org.teiid.language.SetQuery;
-import org.teiid.language.SortSpecification;
-import org.teiid.language.SubqueryComparison;
-import org.teiid.language.SubqueryIn;
-import org.teiid.language.Update;
/**
* Delegates pre- and post-processing for each node in the hierarchy to
@@ -84,313 +51,17 @@
return preVisitor;
}
- public void visit(AggregateFunction obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
-
- public void visit(BatchedUpdates obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
-
- public void visit(Comparison obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
- public void visit(AndOr obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
- public void visit(Delete obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
- public void visit(ColumnReference obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
- public void visit(Call obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
-
- public void visit(Exists 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);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
- public void visit(NamedTable obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
- public void visit(GroupBy obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
- public void visit(In obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
-
- public void visit(DerivedTable obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
-
- public void visit(Insert obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
- public void visit(IsNull obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
- public void visit(Join obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
- public void visit(Like obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
- public void visit(Limit obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
- public void visit(Literal obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
- public void visit(Not obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
- public void visit(OrderBy obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
- public void visit(SortSpecification obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
- public void visit(Argument obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- 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(ScalarSubquery obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
- public void visit(SearchedCase 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);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
- public void visit(SubqueryComparison obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
- public void visit(SubqueryIn obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
-
- public void visit(SetQuery obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
-
- public void visit(Update obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
-
@Override
- public void visit(SetClause obj) {
- if (preVisitor != null) {
- preVisitor.visit(obj);
- }
- super.visit(obj);
- if (postVisitor != null) {
- postVisitor.visit(obj);
- }
- }
-
- @Override
- public void visit(SearchedWhenClause obj) {
+ public void visitNode(LanguageObject obj) {
+ if (obj == null) {
+ return;
+ }
if (preVisitor != null) {
- preVisitor.visit(obj);
+ obj.acceptVisitor(preVisitor);
}
- super.visit(obj);
+ super.visitNode(obj);
if (postVisitor != null) {
- postVisitor.visit(obj);
+ obj.acceptVisitor(postVisitor);
}
}
Modified: trunk/api/src/main/java/org/teiid/language/visitor/HierarchyVisitor.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/visitor/HierarchyVisitor.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/api/src/main/java/org/teiid/language/visitor/HierarchyVisitor.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -51,6 +51,8 @@
import org.teiid.language.SubqueryComparison;
import org.teiid.language.SubqueryIn;
import org.teiid.language.Update;
+import org.teiid.language.With;
+import org.teiid.language.WithItem;
/**
* Visits each node in a hierarchy of ILanguageObjects. The default
@@ -158,6 +160,7 @@
}
public void visit(Select obj) {
+ visitNode(obj.getWith());
visitNodes(obj.getDerivedColumns());
visitNodes(obj.getFrom());
visitNode(obj.getWhere());
@@ -203,6 +206,7 @@
}
public void visit(SetQuery obj) {
+ visitNode(obj.getWith());
if (visitSubcommands) {
visitNode(obj.getLeftQuery());
visitNode(obj.getRightQuery());
@@ -229,5 +233,20 @@
visitNode(obj.getSymbol());
visitNode(obj.getValue());
}
+
+ @Override
+ public void visit(With obj) {
+ visitNodes(obj.getItems());
+ }
+
+ @Override
+ public void visit(WithItem obj) {
+ visitNode(obj.getTable());
+ visitNodes(obj.getColumns());
+ if (visitSubcommands) {
+ visitNode(obj.getSubquery());
+ }
+ }
+
}
Modified: trunk/api/src/main/java/org/teiid/language/visitor/LanguageObjectVisitor.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/visitor/LanguageObjectVisitor.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/api/src/main/java/org/teiid/language/visitor/LanguageObjectVisitor.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -62,4 +62,6 @@
public void visit(SetClause obj);
public void visit(SearchedWhenClause obj);
public void visit(IteratorValueSource obj);
+ public void visit(With obj);
+ public void visit(WithItem obj);
}
Modified: trunk/api/src/main/java/org/teiid/language/visitor/SQLStringVisitor.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/visitor/SQLStringVisitor.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/api/src/main/java/org/teiid/language/visitor/SQLStringVisitor.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -71,6 +71,8 @@
import org.teiid.language.SubqueryIn;
import org.teiid.language.TableReference;
import org.teiid.language.Update;
+import org.teiid.language.With;
+import org.teiid.language.WithItem;
import org.teiid.language.Argument.Direction;
import org.teiid.language.SQLConstants.NonReserved;
import org.teiid.language.SQLConstants.Tokens;
@@ -676,6 +678,9 @@
}
public void visit(Select obj) {
+ if (obj.getWith() != null) {
+ append(obj.getWith());
+ }
buffer.append(SELECT).append(Tokens.SPACE);
buffer.append(getSourceComment(obj));
if (obj.isDistinct()) {
@@ -824,6 +829,9 @@
}
public void visit(SetQuery obj) {
+ if (obj.getWith() != null) {
+ append(obj.getWith());
+ }
appendSetQuery(obj, obj.getLeftQuery(), false);
buffer.append(Tokens.SPACE);
@@ -874,6 +882,29 @@
append(obj);
}
}
+
+ @Override
+ public void visit(With obj) {
+ buffer.append(WITH);
+ buffer.append(Tokens.SPACE);
+ append(obj.getItems());
+ }
+
+ @Override
+ public void visit(WithItem obj) {
+ append(obj.getTable());
+ buffer.append(Tokens.SPACE);
+ if (obj.getColumns() != null) {
+ buffer.append(Tokens.LPAREN);
+ append(obj.getColumns());
+ buffer.append(Tokens.RPAREN);
+ buffer.append(Tokens.SPACE);
+ }
+ buffer.append(AS);
+ buffer.append(Tokens.LPAREN);
+ append(obj.getSubquery());
+ buffer.append(Tokens.RPAREN);
+ }
/**
* Gets the SQL string representation for a given ILanguageObject.
Modified: trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java
===================================================================
--- trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/api/src/main/java/org/teiid/translator/ExecutionFactory.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -785,4 +785,8 @@
public boolean areLobsUsableAfterClose() {
return false;
}
+
+ public boolean supportsCommonTableExpressions() {
+ return false;
+ }
}
Modified: trunk/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- trunk/build/kits/jboss-container/teiid-releasenotes.html 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/build/kits/jboss-container/teiid-releasenotes.html 2010-10-04 21:04:24 UTC (rev 2625)
@@ -26,6 +26,11 @@
</UL>
<H2><A NAME="Highlights"></A>Highlights</H2>
<UL>
+ <LI><B>SQL Support</B>
+ <UL>
+ <LI><B>Non-Recursive Common Table Expressions</B> - The WITH clause (and associated pushdown) for non-recursive queries is now supported.
+ <LI><B>Explicit Table Syntax</B> - TABLE x can now be used as a shortcut for SELECT * FROM x
+ </UL>
<LI><B>Transaction Statements</B> - JDBC/ODBC now accepts START TRANSACTION, COMMIT, and ROLLBACK statements to control local transactions.
<LI><B>Procedure Result Caching</B> - virtual procedure definitions may use a cache hint to cache results in the result set cache.
<LI><B>Improved Plan Caching</B> - plans used by internal materialization and stored procedure plans will be automatically cached in the prepared plan cache. Improvements were also made to reduce the memory footprint of the plans.
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/db2/DB2ExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/db2/DB2ExecutionFactory.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/db2/DB2ExecutionFactory.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -249,5 +249,10 @@
@Override
public boolean supportsAggregatesEnhancedNumeric() {
return true;
+ }
+
+ @Override
+ public boolean supportsCommonTableExpressions() {
+ return true;
}
}
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -62,7 +62,7 @@
import org.teiid.translator.jdbc.LocateFunctionModifier;
-@Translator(name="oracle", description="A translator for Oracle Database")
+@Translator(name="oracle", description="A translator for Oracle 9i Database or later")
public class OracleExecutionFactory extends JDBCExecutionFactory {
private static final String TIME_FORMAT = "HH24:MI:SS"; //$NON-NLS-1$
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/postgresql/PostgreSQLExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/postgresql/PostgreSQLExecutionFactory.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/postgresql/PostgreSQLExecutionFactory.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -462,4 +462,9 @@
return getDatabaseVersion().compareTo(EIGHT_2) >= 0;
}
+ @Override
+ public boolean supportsCommonTableExpressions() {
+ return getDatabaseVersion().compareTo(EIGHT_4) >= 0;
+ }
+
}
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/sqlserver/SQLServerExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/sqlserver/SQLServerExecutionFactory.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/sqlserver/SQLServerExecutionFactory.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -204,5 +204,10 @@
public boolean booleanNullable() {
return true;
}
+
+ @Override
+ public boolean supportsCommonTableExpressions() {
+ return true;
+ }
}
Modified: trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml
===================================================================
--- trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml 2010-10-04 21:04:24 UTC (rev 2625)
@@ -438,7 +438,7 @@
<section>
<title>QueryExpression Structure</title>
<para><code>QueryExpression</code> is the base for both SELECT queries and set queries. It may optionally take an
- <code>OrderBy</code> (representing a SQL ORDER BY clause) and a <code>Limit</code> (represent a SQL LIMIT clause)</para>
+ <code>OrderBy</code> (representing a SQL ORDER BY clause), a <code>Limit</code> (represent a SQL LIMIT clause), or a <code>With</code> (represents a SQL WITH clause).</para>
</section>
<section>
@@ -459,6 +459,14 @@
INTERSECT, EXCEPT) on two <code>QueryExpression</code>. The all flag may be set to
indicate UNION ALL (currently INTERSECT and EXCEPT ALL are not allowed in Teiid)</para>
</section>
+
+ <section>
+ <title>With Structure</title>
+
+ <para>A <code>With</code> clause contains named <code>QueryExpressions</code> held by <code>WithItem</code>s that can be
+ referenced as tables in the main <code>QueryExpression</code>.</para>
+
+ </section>
<section>
<title>Insert Structure</title>
@@ -1265,6 +1273,17 @@
<para>Translator supports inserts with an iterator of values. The values would typically be from an evaluated QueryExpression.</para>
</entry>
</row>
+ <row>
+ <entry>
+ <para>CommonTableExpressions</para>
+ </entry>
+ <entry>
+ <para/>
+ </entry>
+ <entry>
+ <para>Translator supports the WITH clause.</para>
+ </entry>
+ </row>
</tbody>
</tgroup>
</table>
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/grammar.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/grammar.xml 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/grammar.xml 2010-10-04 21:04:24 UTC (rev 2625)
@@ -503,7 +503,7 @@
<row>
<entry align="right" valign="top"><para><anchor id="prod8" xreflabel="storedProcedure"/>storedProcedure</para></entry>
<entry align="left" valign="top"><para>::=
-( ( ( <EXEC> ) | ( <EXECUTE> ) | ( <CALL> ) ) <link linkend="prod2">id</link> <LPAREN> ( <link linkend="prod39">executeNamedParams</link> | <link linkend="prod37">executeUnnamedParams</link> ) <RPAREN> ) ( <link linkend="prod38">option</link> )?</para></entry></row>
+( ( <EXEC> | <EXECUTE> | <CALL> ) <link linkend="prod2">id</link> <LPAREN> ( <link linkend="prod39">executeNamedParams</link> | <link linkend="prod37">executeUnnamedParams</link> ) <RPAREN> ) ( <link linkend="prod38">option</link> )?</para></entry></row>
<row>
<entry align="right" valign="top"><para><anchor id="prod37" xreflabel="executeUnnamedParams"/>executeUnnamedParams</para></entry>
<entry align="left" valign="top"><para>::=
@@ -515,97 +515,105 @@
<row>
<entry align="right" valign="top"><para><anchor id="prod9" xreflabel="insert"/>insert</para></entry>
<entry align="left" valign="top"><para>::=
-<INSERT> <INTO> <link linkend="prod2">id</link> ( <LPAREN> <link linkend="prod2">id</link> ( <COMMA> <link linkend="prod2">id</link> )* <RPAREN> )? ( ( <VALUES> <link linkend="prod40">rowValues</link> ) | ( <link linkend="prod7">queryExpression</link> ) ) ( <link linkend="prod38">option</link> )?</para></entry></row>
+<INSERT> <INTO> <link linkend="prod2">id</link> ( <link linkend="prod40">columnList</link> )? ( ( <VALUES> <link linkend="prod41">rowValues</link> ) | ( <link linkend="prod7">queryExpression</link> ) ) ( <link linkend="prod38">option</link> )?</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod40" xreflabel="rowValues"/>rowValues</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod40" xreflabel="columnList"/>columnList</para></entry>
<entry align="left" valign="top"><para>::=
+<LPAREN> <link linkend="prod2">id</link> ( <COMMA> <link linkend="prod2">id</link> )* <RPAREN></para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod41" xreflabel="rowValues"/>rowValues</para></entry>
+<entry align="left" valign="top"><para>::=
<LPAREN> <link linkend="prod17">expression</link> ( <COMMA> <link linkend="prod17">expression</link> )* <RPAREN></para></entry></row>
<row>
<entry align="right" valign="top"><para><anchor id="prod10" xreflabel="update"/>update</para></entry>
<entry align="left" valign="top"><para>::=
-<UPDATE> <link linkend="prod2">id</link> <SET> <link linkend="prod36">setClauseList</link> ( <link linkend="prod41">where</link> )? ( <link linkend="prod38">option</link> )?</para></entry></row>
+<UPDATE> <link linkend="prod2">id</link> <SET> <link linkend="prod36">setClauseList</link> ( <link linkend="prod42">where</link> )? ( <link linkend="prod38">option</link> )?</para></entry></row>
<row>
<entry align="right" valign="top"><para><anchor id="prod11" xreflabel="delete"/>delete</para></entry>
<entry align="left" valign="top"><para>::=
-<DELETE> <FROM> <link linkend="prod2">id</link> ( <link linkend="prod41">where</link> )? ( <link linkend="prod38">option</link> )?</para></entry></row>
+<DELETE> <FROM> <link linkend="prod2">id</link> ( <link linkend="prod42">where</link> )? ( <link linkend="prod38">option</link> )?</para></entry></row>
<row>
<entry align="right" valign="top"><para><anchor id="prod7" xreflabel="queryExpression"/>queryExpression</para></entry>
<entry align="left" valign="top"><para>::=
-<link linkend="prod42">queryExpressionBody</link></para></entry></row>
+( <WITH> <link linkend="prod43">withListElement</link> ( <COMMA> <link linkend="prod43">withListElement</link> )* )? <link linkend="prod44">queryExpressionBody</link></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod42" xreflabel="queryExpressionBody"/>queryExpressionBody</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod43" xreflabel="withListElement"/>withListElement</para></entry>
<entry align="left" valign="top"><para>::=
-<link linkend="prod43">queryTerm</link> ( ( <UNION> | <EXCEPT> ) ( <ALL> | <DISTINCT> )? <link linkend="prod43">queryTerm</link> )* ( <link linkend="prod44">orderby</link> )? ( <link linkend="prod45">limit</link> )? ( <link linkend="prod38">option</link> )?</para></entry></row>
+<link linkend="prod2">id</link> ( <link linkend="prod40">columnList</link> )? <AS> <LPAREN> <link linkend="prod7">queryExpression</link> <RPAREN></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod43" xreflabel="queryTerm"/>queryTerm</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod44" xreflabel="queryExpressionBody"/>queryExpressionBody</para></entry>
<entry align="left" valign="top"><para>::=
-<link linkend="prod46">queryPrimary</link> ( <INTERSECT> ( <ALL> | <DISTINCT> )? <link linkend="prod46">queryPrimary</link> )*</para></entry></row>
+<link linkend="prod45">queryTerm</link> ( ( <UNION> | <EXCEPT> ) ( <ALL> | <DISTINCT> )? <link linkend="prod45">queryTerm</link> )* ( <link linkend="prod46">orderby</link> )? ( <link linkend="prod47">limit</link> )? ( <link linkend="prod38">option</link> )?</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod46" xreflabel="queryPrimary"/>queryPrimary</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod45" xreflabel="queryTerm"/>queryTerm</para></entry>
<entry align="left" valign="top"><para>::=
-( <link linkend="prod47">query</link> | ( <LPAREN> <link linkend="prod42">queryExpressionBody</link> <RPAREN> ) )</para></entry></row>
+<link linkend="prod48">queryPrimary</link> ( <INTERSECT> ( <ALL> | <DISTINCT> )? <link linkend="prod48">queryPrimary</link> )*</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod47" xreflabel="query"/>query</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod48" xreflabel="queryPrimary"/>queryPrimary</para></entry>
<entry align="left" valign="top"><para>::=
-<link linkend="prod48">select</link> ( <link linkend="prod49">into</link> )? ( <link linkend="prod50">from</link> ( <link linkend="prod41">where</link> )? ( <link linkend="prod51">groupBy</link> )? ( <link linkend="prod52">having</link> )? )?</para></entry></row>
+( <link linkend="prod49">query</link> | ( <TABLE> <link linkend="prod2">id</link> ) | ( <LPAREN> <link linkend="prod44">queryExpressionBody</link> <RPAREN> ) )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod49" xreflabel="into"/>into</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod49" xreflabel="query"/>query</para></entry>
<entry align="left" valign="top"><para>::=
+<link linkend="prod50">select</link> ( <link linkend="prod51">into</link> )? ( <link linkend="prod52">from</link> ( <link linkend="prod42">where</link> )? ( <link linkend="prod53">groupBy</link> )? ( <link linkend="prod54">having</link> )? )?</para></entry></row>
+<row>
+<entry align="right" valign="top"><para><anchor id="prod51" xreflabel="into"/>into</para></entry>
+<entry align="left" valign="top"><para>::=
<INTO> ( <link linkend="prod2">id</link> )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod48" xreflabel="select"/>select</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod50" xreflabel="select"/>select</para></entry>
<entry align="left" valign="top"><para>::=
-<SELECT> ( <ALL> | ( <DISTINCT> ) )? ( <STAR> | ( <link linkend="prod53">selectSymbol</link> ( <COMMA> <link linkend="prod53">selectSymbol</link> )* ) )</para></entry></row>
+<SELECT> ( <ALL> | ( <DISTINCT> ) )? ( <STAR> | ( <link linkend="prod55">selectSymbol</link> ( <COMMA> <link linkend="prod55">selectSymbol</link> )* ) )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod53" xreflabel="selectSymbol"/>selectSymbol</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod55" xreflabel="selectSymbol"/>selectSymbol</para></entry>
<entry align="left" valign="top"><para>::=
-( <link linkend="prod54">selectExpression</link> | <link linkend="prod55">allInGroupSymbol</link> )</para></entry></row>
+( <link linkend="prod56">selectExpression</link> | <link linkend="prod57">allInGroupSymbol</link> )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod54" xreflabel="selectExpression"/>selectExpression</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod56" xreflabel="selectExpression"/>selectExpression</para></entry>
<entry align="left" valign="top"><para>::=
( <link linkend="prod17">expression</link> ( ( <AS> )? <link linkend="prod2">id</link> )? )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod56" xreflabel="derivedColumn"/>derivedColumn</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod58" xreflabel="derivedColumn"/>derivedColumn</para></entry>
<entry align="left" valign="top"><para>::=
( <link linkend="prod17">expression</link> ( <AS> <link linkend="prod2">id</link> )? )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod55" xreflabel="allInGroupSymbol"/>allInGroupSymbol</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod57" xreflabel="allInGroupSymbol"/>allInGroupSymbol</para></entry>
<entry align="left" valign="top"><para>::=
<ALL_IN_GROUP></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod57" xreflabel="xmlAgg"/>xmlAgg</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod59" xreflabel="xmlAgg"/>xmlAgg</para></entry>
<entry align="left" valign="top"><para>::=
-<XMLAGG> <LPAREN> <link linkend="prod17">expression</link> ( <link linkend="prod44">orderby</link> )? <RPAREN></para></entry></row>
+<XMLAGG> <LPAREN> <link linkend="prod17">expression</link> ( <link linkend="prod46">orderby</link> )? <RPAREN></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod58" xreflabel="aggregateSymbol"/>aggregateSymbol</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod60" xreflabel="aggregateSymbol"/>aggregateSymbol</para></entry>
<entry align="left" valign="top"><para>::=
( ( <link linkend="prod15">nonReserved</link> <LPAREN> <STAR> <RPAREN> ) | ( ( <link linkend="prod15">nonReserved</link> | <ANY> | <SOME> ) <LPAREN> ( <DISTINCT> | <ALL> )? <link linkend="prod17">expression</link> <RPAREN> ) )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod50" xreflabel="from"/>from</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod52" xreflabel="from"/>from</para></entry>
<entry align="left" valign="top"><para>::=
-<FROM> ( <link linkend="prod59">tableReference</link> ( <COMMA> <link linkend="prod59">tableReference</link> )* )</para></entry></row>
+<FROM> ( <link linkend="prod61">tableReference</link> ( <COMMA> <link linkend="prod61">tableReference</link> )* )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod59" xreflabel="tableReference"/>tableReference</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod61" xreflabel="tableReference"/>tableReference</para></entry>
<entry align="left" valign="top"><para>::=
-( ( <LBRACE> <link linkend="prod15">nonReserved</link> <link linkend="prod60">joinedTable</link> <RBRACE> ) | <link linkend="prod60">joinedTable</link> )</para></entry></row>
+( ( <LBRACE> <link linkend="prod15">nonReserved</link> <link linkend="prod62">joinedTable</link> <RBRACE> ) | <link linkend="prod62">joinedTable</link> )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod60" xreflabel="joinedTable"/>joinedTable</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod62" xreflabel="joinedTable"/>joinedTable</para></entry>
<entry align="left" valign="top"><para>::=
-<link linkend="prod61">tablePrimary</link> ( ( <link linkend="prod62">crossJoin</link> | <link linkend="prod63">qualifiedJoin</link> ) )*</para></entry></row>
+<link linkend="prod63">tablePrimary</link> ( ( <link linkend="prod64">crossJoin</link> | <link linkend="prod65">qualifiedJoin</link> ) )*</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod62" xreflabel="crossJoin"/>crossJoin</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod64" xreflabel="crossJoin"/>crossJoin</para></entry>
<entry align="left" valign="top"><para>::=
-( ( <CROSS> | <UNION> ) <JOIN> <link linkend="prod61">tablePrimary</link> )</para></entry></row>
+( ( <CROSS> | <UNION> ) <JOIN> <link linkend="prod63">tablePrimary</link> )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod63" xreflabel="qualifiedJoin"/>qualifiedJoin</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod65" xreflabel="qualifiedJoin"/>qualifiedJoin</para></entry>
<entry align="left" valign="top"><para>::=
-( ( ( <RIGHT> ( <OUTER> )? ) | ( <LEFT> ( <OUTER> )? ) | ( <FULL> ( <OUTER> )? ) | <INNER> )? <JOIN> <link linkend="prod59">tableReference</link> <ON> <link linkend="prod29">criteria</link> )</para></entry></row>
+( ( ( <RIGHT> ( <OUTER> )? ) | ( <LEFT> ( <OUTER> )? ) | ( <FULL> ( <OUTER> )? ) | <INNER> )? <JOIN> <link linkend="prod61">tableReference</link> <ON> <link linkend="prod29">criteria</link> )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod61" xreflabel="tablePrimary"/>tablePrimary</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod63" xreflabel="tablePrimary"/>tablePrimary</para></entry>
<entry align="left" valign="top"><para>::=
-( <link linkend="prod64">textTable</link> | <link linkend="prod65">xmlTable</link> | <link linkend="prod66">unaryFromClause</link> | <link linkend="prod67">subqueryFromClause</link> | ( <LPAREN> <link linkend="prod60">joinedTable</link> <RPAREN> ) ) ( ( <MAKEDEP> ) | ( <MAKENOTDEP> ) )?</para></entry></row>
+( <link linkend="prod66">textTable</link> | <link linkend="prod67">xmlTable</link> | <link linkend="prod68">unaryFromClause</link> | <link linkend="prod69">subqueryFromClause</link> | ( <LPAREN> <link linkend="prod62">joinedTable</link> <RPAREN> ) ) ( ( <MAKEDEP> ) | ( <MAKENOTDEP> ) )?</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod68" xreflabel="xmlSerialize"/>xmlSerialize</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod70" xreflabel="xmlSerialize"/>xmlSerialize</para></entry>
<entry align="left" valign="top"><para>::=
<XMLSERIALIZE> <LPAREN> ( <link linkend="prod15">nonReserved</link> )? <link linkend="prod17">expression</link> ( <AS> ( <STRING> | <VARCHAR> | <CLOB> ) )? <RPAREN></para></entry></row>
<row>
@@ -613,127 +621,127 @@
<entry align="left" valign="top"><para>::=
<ID></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod64" xreflabel="textTable"/>textTable</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod66" xreflabel="textTable"/>textTable</para></entry>
<entry align="left" valign="top"><para>::=
-<ID> <LPAREN> <link linkend="prod17">expression</link> <link linkend="prod15">nonReserved</link> <link linkend="prod69">textColumn</link> ( <COMMA> <link linkend="prod69">textColumn</link> )* ( <ID> <link linkend="prod70">charVal</link> )? ( ( <ESCAPE> <link linkend="prod70">charVal</link> ) | ( <ID> <link linkend="prod70">charVal</link> ) )? ( <ID> ( <link linkend="prod71">intVal</link> )? )? ( <ID> <link linkend="prod71">intVal</link> )? <RPAREN> ( <AS> )? <link linkend="prod2">id</link></para></entry></row>
+<ID> <LPAREN> <link linkend="prod17">expression</link> <link linkend="prod15">nonReserved</link> <link linkend="prod71">textColumn</link> ( <COMMA> <link linkend="prod71">textColumn</link> )* ( <ID> <link linkend="prod72">charVal</link> )? ( ( <ESCAPE> <link linkend="prod72">charVal</link> ) | ( <ID> <link linkend="prod72">charVal</link> ) )? ( <ID> ( <link linkend="prod73">intVal</link> )? )? ( <ID> <link linkend="prod73">intVal</link> )? <RPAREN> ( <AS> )? <link linkend="prod2">id</link></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod69" xreflabel="textColumn"/>textColumn</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod71" xreflabel="textColumn"/>textColumn</para></entry>
<entry align="left" valign="top"><para>::=
-<link linkend="prod2">id</link> <link linkend="prod32">dataType</link> ( <ID> <link linkend="prod71">intVal</link> )?</para></entry></row>
+<link linkend="prod2">id</link> <link linkend="prod32">dataType</link> ( <ID> <link linkend="prod73">intVal</link> )?</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod72" xreflabel="xmlQuery"/>xmlQuery</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod74" xreflabel="xmlQuery"/>xmlQuery</para></entry>
<entry align="left" valign="top"><para>::=
-<XMLQUERY> <LPAREN> ( <link linkend="prod73">xmlNamespaces</link> <COMMA> )? <link linkend="prod1">stringVal</link> ( <ID> <link linkend="prod56">derivedColumn</link> ( <COMMA> <link linkend="prod56">derivedColumn</link> )* )? ( ( <NULL> | <link linkend="prod15">nonReserved</link> ) <ON> <link linkend="prod15">nonReserved</link> )? <RPAREN></para></entry></row>
+<XMLQUERY> <LPAREN> ( <link linkend="prod75">xmlNamespaces</link> <COMMA> )? <link linkend="prod1">stringVal</link> ( <ID> <link linkend="prod58">derivedColumn</link> ( <COMMA> <link linkend="prod58">derivedColumn</link> )* )? ( ( <NULL> | <link linkend="prod15">nonReserved</link> ) <ON> <link linkend="prod15">nonReserved</link> )? <RPAREN></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod65" xreflabel="xmlTable"/>xmlTable</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod67" xreflabel="xmlTable"/>xmlTable</para></entry>
<entry align="left" valign="top"><para>::=
-<XMLTABLE> <LPAREN> ( <link linkend="prod73">xmlNamespaces</link> <COMMA> )? <link linkend="prod1">stringVal</link> ( <ID> <link linkend="prod56">derivedColumn</link> ( <COMMA> <link linkend="prod56">derivedColumn</link> )* )? ( <ID> <link linkend="prod74">xmlColumn</link> ( <COMMA> <link linkend="prod74">xmlColumn</link> )* )? <RPAREN> ( <AS> )? <link linkend="prod2">id</link></para></entry></row>
+<XMLTABLE> <LPAREN> ( <link linkend="prod75">xmlNamespaces</link> <COMMA> )? <link linkend="prod1">stringVal</link> ( <ID> <link linkend="prod58">derivedColumn</link> ( <COMMA> <link linkend="prod58">derivedColumn</link> )* )? ( <ID> <link linkend="prod76">xmlColumn</link> ( <COMMA> <link linkend="prod76">xmlColumn</link> )* )? <RPAREN> ( <AS> )? <link linkend="prod2">id</link></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod74" xreflabel="xmlColumn"/>xmlColumn</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod76" xreflabel="xmlColumn"/>xmlColumn</para></entry>
<entry align="left" valign="top"><para>::=
<link linkend="prod2">id</link> ( ( <FOR> <link linkend="prod15">nonReserved</link> ) | ( <link linkend="prod32">dataType</link> ( <DEFAULT_KEYWORD> <link linkend="prod17">expression</link> )? ( <link linkend="prod15">nonReserved</link> <link linkend="prod1">stringVal</link> )? ) )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod71" xreflabel="intVal"/>intVal</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod73" xreflabel="intVal"/>intVal</para></entry>
<entry align="left" valign="top"><para>::=
<INTEGERVAL></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod67" xreflabel="subqueryFromClause"/>subqueryFromClause</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod69" xreflabel="subqueryFromClause"/>subqueryFromClause</para></entry>
<entry align="left" valign="top"><para>::=
( <TABLE> )? <LPAREN> ( <link linkend="prod7">queryExpression</link> | <link linkend="prod8">storedProcedure</link> ) <RPAREN> ( <AS> )? <link linkend="prod2">id</link></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod66" xreflabel="unaryFromClause"/>unaryFromClause</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod68" xreflabel="unaryFromClause"/>unaryFromClause</para></entry>
<entry align="left" valign="top"><para>::=
( <ID> ( ( <AS> )? <link linkend="prod2">id</link> )? )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod41" xreflabel="where"/>where</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod42" xreflabel="where"/>where</para></entry>
<entry align="left" valign="top"><para>::=
<WHERE> <link linkend="prod29">criteria</link></para></entry></row>
<row>
<entry align="right" valign="top"><para><anchor id="prod29" xreflabel="criteria"/>criteria</para></entry>
<entry align="left" valign="top"><para>::=
-<link linkend="prod75">compoundCritOr</link></para></entry></row>
+<link linkend="prod77">compoundCritOr</link></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod75" xreflabel="compoundCritOr"/>compoundCritOr</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod77" xreflabel="compoundCritOr"/>compoundCritOr</para></entry>
<entry align="left" valign="top"><para>::=
-<link linkend="prod76">compoundCritAnd</link> ( <OR> <link linkend="prod76">compoundCritAnd</link> )*</para></entry></row>
+<link linkend="prod78">compoundCritAnd</link> ( <OR> <link linkend="prod78">compoundCritAnd</link> )*</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod76" xreflabel="compoundCritAnd"/>compoundCritAnd</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod78" xreflabel="compoundCritAnd"/>compoundCritAnd</para></entry>
<entry align="left" valign="top"><para>::=
-<link linkend="prod77">notCrit</link> ( <AND> <link linkend="prod77">notCrit</link> )*</para></entry></row>
+<link linkend="prod79">notCrit</link> ( <AND> <link linkend="prod79">notCrit</link> )*</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod77" xreflabel="notCrit"/>notCrit</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod79" xreflabel="notCrit"/>notCrit</para></entry>
<entry align="left" valign="top"><para>::=
-( <NOT> )? <link linkend="prod78">booleanPrimary</link></para></entry></row>
+( <NOT> )? <link linkend="prod80">booleanPrimary</link></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod78" xreflabel="booleanPrimary"/>booleanPrimary</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod80" xreflabel="booleanPrimary"/>booleanPrimary</para></entry>
<entry align="left" valign="top"><para>::=
-( <link linkend="prod35">translateCriteria</link> | ( <link linkend="prod79">commonValueExpression</link> ( ( <link linkend="prod80">betweenCrit</link> | <link linkend="prod81">matchCrit</link> | <link linkend="prod82">setCrit</link> | <link linkend="prod83">isNullCrit</link> | <link linkend="prod84">subqueryCompareCriteria</link> | <link linkend="prod85">compareCrit</link> ) )? ) | <link linkend="prod86">existsCriteria</link> | <link linkend="prod31">hasCriteria</link> )</para></entry></row>
+( <link linkend="prod35">translateCriteria</link> | ( <link linkend="prod81">commonValueExpression</link> ( ( <link linkend="prod82">betweenCrit</link> | <link linkend="prod83">matchCrit</link> | <link linkend="prod84">setCrit</link> | <link linkend="prod85">isNullCrit</link> | <link linkend="prod86">subqueryCompareCriteria</link> | <link linkend="prod87">compareCrit</link> ) )? ) | <link linkend="prod88">existsCriteria</link> | <link linkend="prod31">hasCriteria</link> )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod87" xreflabel="operator"/>operator</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod89" xreflabel="operator"/>operator</para></entry>
<entry align="left" valign="top"><para>::=
( <EQ> | <NE> | <NE2> | <LT> | <LE> | <GT> | <GE> )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod85" xreflabel="compareCrit"/>compareCrit</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod87" xreflabel="compareCrit"/>compareCrit</para></entry>
<entry align="left" valign="top"><para>::=
-<link linkend="prod87">operator</link> <link linkend="prod79">commonValueExpression</link></para></entry></row>
+<link linkend="prod89">operator</link> <link linkend="prod81">commonValueExpression</link></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod88" xreflabel="subquery"/>subquery</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod90" xreflabel="subquery"/>subquery</para></entry>
<entry align="left" valign="top"><para>::=
<LPAREN> ( <link linkend="prod7">queryExpression</link> | <link linkend="prod8">storedProcedure</link> ) <RPAREN></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod84" xreflabel="subqueryCompareCriteria"/>subqueryCompareCriteria</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod86" xreflabel="subqueryCompareCriteria"/>subqueryCompareCriteria</para></entry>
<entry align="left" valign="top"><para>::=
-<link linkend="prod87">operator</link> ( <ANY> | <SOME> | <ALL> ) <link linkend="prod88">subquery</link></para></entry></row>
+<link linkend="prod89">operator</link> ( <ANY> | <SOME> | <ALL> ) <link linkend="prod90">subquery</link></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod81" xreflabel="matchCrit"/>matchCrit</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod83" xreflabel="matchCrit"/>matchCrit</para></entry>
<entry align="left" valign="top"><para>::=
-( <NOT> )? <LIKE> <link linkend="prod79">commonValueExpression</link> ( <ESCAPE> <link linkend="prod70">charVal</link> | ( <LBRACE> <ESCAPE> <link linkend="prod70">charVal</link> <RBRACE> ) )?</para></entry></row>
+( <NOT> )? <LIKE> <link linkend="prod81">commonValueExpression</link> ( <ESCAPE> <link linkend="prod72">charVal</link> | ( <LBRACE> <ESCAPE> <link linkend="prod72">charVal</link> <RBRACE> ) )?</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod70" xreflabel="charVal"/>charVal</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod72" xreflabel="charVal"/>charVal</para></entry>
<entry align="left" valign="top"><para>::=
<link linkend="prod1">stringVal</link></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod80" xreflabel="betweenCrit"/>betweenCrit</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod82" xreflabel="betweenCrit"/>betweenCrit</para></entry>
<entry align="left" valign="top"><para>::=
-( <NOT> )? <BETWEEN> <link linkend="prod79">commonValueExpression</link> <AND> <link linkend="prod79">commonValueExpression</link></para></entry></row>
+( <NOT> )? <BETWEEN> <link linkend="prod81">commonValueExpression</link> <AND> <link linkend="prod81">commonValueExpression</link></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod83" xreflabel="isNullCrit"/>isNullCrit</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod85" xreflabel="isNullCrit"/>isNullCrit</para></entry>
<entry align="left" valign="top"><para>::=
<IS> ( <NOT> )? <NULL></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod82" xreflabel="setCrit"/>setCrit</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod84" xreflabel="setCrit"/>setCrit</para></entry>
<entry align="left" valign="top"><para>::=
-( <NOT> )? <IN> ( ( <link linkend="prod88">subquery</link> ) | ( <LPAREN> <link linkend="prod79">commonValueExpression</link> ( <COMMA> <link linkend="prod79">commonValueExpression</link> )* <RPAREN> ) )</para></entry></row>
+( <NOT> )? <IN> ( ( <link linkend="prod90">subquery</link> ) | ( <LPAREN> <link linkend="prod81">commonValueExpression</link> ( <COMMA> <link linkend="prod81">commonValueExpression</link> )* <RPAREN> ) )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod86" xreflabel="existsCriteria"/>existsCriteria</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod88" xreflabel="existsCriteria"/>existsCriteria</para></entry>
<entry align="left" valign="top"><para>::=
-<EXISTS> <link linkend="prod88">subquery</link></para></entry></row>
+<EXISTS> <link linkend="prod90">subquery</link></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod51" xreflabel="groupBy"/>groupBy</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod53" xreflabel="groupBy"/>groupBy</para></entry>
<entry align="left" valign="top"><para>::=
-<GROUP> <BY> ( <link linkend="prod89">groupByItem</link> ( <COMMA> <link linkend="prod89">groupByItem</link> )* )</para></entry></row>
+<GROUP> <BY> ( <link linkend="prod91">groupByItem</link> ( <COMMA> <link linkend="prod91">groupByItem</link> )* )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod89" xreflabel="groupByItem"/>groupByItem</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod91" xreflabel="groupByItem"/>groupByItem</para></entry>
<entry align="left" valign="top"><para>::=
<link linkend="prod17">expression</link></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod52" xreflabel="having"/>having</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod54" xreflabel="having"/>having</para></entry>
<entry align="left" valign="top"><para>::=
<HAVING> <link linkend="prod29">criteria</link></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod44" xreflabel="orderby"/>orderby</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod46" xreflabel="orderby"/>orderby</para></entry>
<entry align="left" valign="top"><para>::=
-<ORDER> <BY> <link linkend="prod90">sortSpecification</link> ( <COMMA> <link linkend="prod90">sortSpecification</link> )*</para></entry></row>
+<ORDER> <BY> <link linkend="prod92">sortSpecification</link> ( <COMMA> <link linkend="prod92">sortSpecification</link> )*</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod90" xreflabel="sortSpecification"/>sortSpecification</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod92" xreflabel="sortSpecification"/>sortSpecification</para></entry>
<entry align="left" valign="top"><para>::=
-<link linkend="prod91">sortKey</link> ( <ASC> | <DESC> )? ( <link linkend="prod15">nonReserved</link> <link linkend="prod15">nonReserved</link> )?</para></entry></row>
+<link linkend="prod93">sortKey</link> ( <ASC> | <DESC> )? ( <link linkend="prod15">nonReserved</link> <link linkend="prod15">nonReserved</link> )?</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod91" xreflabel="sortKey"/>sortKey</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod93" xreflabel="sortKey"/>sortKey</para></entry>
<entry align="left" valign="top"><para>::=
<link linkend="prod17">expression</link></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod45" xreflabel="limit"/>limit</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod47" xreflabel="limit"/>limit</para></entry>
<entry align="left" valign="top"><para>::=
<LIMIT> ( <INTEGERVAL> | <QMARK> ) ( <COMMA> ( <INTEGERVAL> | <QMARK> ) )?</para></entry></row>
<row>
@@ -745,71 +753,71 @@
<entry align="left" valign="top"><para>::=
<link linkend="prod29">criteria</link></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod79" xreflabel="commonValueExpression"/>commonValueExpression</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod81" xreflabel="commonValueExpression"/>commonValueExpression</para></entry>
<entry align="left" valign="top"><para>::=
-( <link linkend="prod92">plusExpression</link> ( <CONCAT_OP> <link linkend="prod92">plusExpression</link> )* )</para></entry></row>
+( <link linkend="prod94">plusExpression</link> ( <CONCAT_OP> <link linkend="prod94">plusExpression</link> )* )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod92" xreflabel="plusExpression"/>plusExpression</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod94" xreflabel="plusExpression"/>plusExpression</para></entry>
<entry align="left" valign="top"><para>::=
-( <link linkend="prod93">timesExpression</link> ( <link linkend="prod94">plusOperator</link> <link linkend="prod93">timesExpression</link> )* )</para></entry></row>
+( <link linkend="prod95">timesExpression</link> ( <link linkend="prod96">plusOperator</link> <link linkend="prod95">timesExpression</link> )* )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod94" xreflabel="plusOperator"/>plusOperator</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod96" xreflabel="plusOperator"/>plusOperator</para></entry>
<entry align="left" valign="top"><para>::=
( <PLUS> | <MINUS> )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod93" xreflabel="timesExpression"/>timesExpression</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod95" xreflabel="timesExpression"/>timesExpression</para></entry>
<entry align="left" valign="top"><para>::=
-( <link linkend="prod95">valueExpressionPrimary</link> ( <link linkend="prod96">timesOperator</link> <link linkend="prod95">valueExpressionPrimary</link> )* )</para></entry></row>
+( <link linkend="prod97">valueExpressionPrimary</link> ( <link linkend="prod98">timesOperator</link> <link linkend="prod97">valueExpressionPrimary</link> )* )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod96" xreflabel="timesOperator"/>timesOperator</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod98" xreflabel="timesOperator"/>timesOperator</para></entry>
<entry align="left" valign="top"><para>::=
( <STAR> | <SLASH> )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod95" xreflabel="valueExpressionPrimary"/>valueExpressionPrimary</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod97" xreflabel="valueExpressionPrimary"/>valueExpressionPrimary</para></entry>
<entry align="left" valign="top"><para>::=
-( <QMARK> | <link linkend="prod97">literal</link> | ( <LBRACE> <link linkend="prod15">nonReserved</link> <link linkend="prod98">function</link> <RBRACE> ) | ( <link linkend="prod58">aggregateSymbol</link> ) | ( <link linkend="prod58">aggregateSymbol</link> ) | ( <link linkend="prod58">aggregateSymbol</link> ) | ( <link linkend="prod57">xmlAgg</link> ) | ( <link linkend="prod98">function</link> ) | ( <ID> ) | <link linkend="prod88">subquery</link> | ( <LPAREN> <link linkend="prod17">expression</link> <RPAREN> ) | <link linkend="prod99">searchedCaseExpression</link> | <link linkend="prod100">caseExpression</link> )</para></entry></row>
+( <QMARK> | <link linkend="prod99">literal</link> | ( <LBRACE> <link linkend="prod15">nonReserved</link> <link linkend="prod100">function</link> <RBRACE> ) | ( <link linkend="prod60">aggregateSymbol</link> ) | ( <link linkend="prod60">aggregateSymbol</link> ) | ( <link linkend="prod60">aggregateSymbol</link> ) | ( <link linkend="prod59">xmlAgg</link> ) | ( <link linkend="prod100">function</link> ) | ( <ID> ) | <link linkend="prod90">subquery</link> | ( <LPAREN> <link linkend="prod17">expression</link> <RPAREN> ) | <link linkend="prod101">searchedCaseExpression</link> | <link linkend="prod102">caseExpression</link> )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod100" xreflabel="caseExpression"/>caseExpression</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod102" xreflabel="caseExpression"/>caseExpression</para></entry>
<entry align="left" valign="top"><para>::=
<CASE> <link linkend="prod17">expression</link> ( <WHEN> <link linkend="prod17">expression</link> <THEN> <link linkend="prod17">expression</link> )+ ( <ELSE> <link linkend="prod17">expression</link> )? <END></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod99" xreflabel="searchedCaseExpression"/>searchedCaseExpression</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod101" xreflabel="searchedCaseExpression"/>searchedCaseExpression</para></entry>
<entry align="left" valign="top"><para>::=
<CASE> ( <WHEN> <link linkend="prod29">criteria</link> <THEN> <link linkend="prod17">expression</link> )+ ( <ELSE> <link linkend="prod17">expression</link> )? <END></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod98" xreflabel="function"/>function</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod100" xreflabel="function"/>function</para></entry>
<entry align="left" valign="top"><para>::=
-( ( <CONVERT> <LPAREN> <link linkend="prod17">expression</link> <COMMA> <link linkend="prod32">dataType</link> <RPAREN> ) | ( <CAST> <LPAREN> <link linkend="prod17">expression</link> <AS> <link linkend="prod32">dataType</link> <RPAREN> ) | ( <link linkend="prod15">nonReserved</link> <LPAREN> <link linkend="prod17">expression</link> <COMMA> <link linkend="prod101">stringConstant</link> <RPAREN> ) | ( <link linkend="prod15">nonReserved</link> <LPAREN> <link linkend="prod102">intervalType</link> <COMMA> <link linkend="prod17">expression</link> <COMMA> <link linkend="prod17">expression</link> <RPAREN> ) | <link linkend="prod103">queryString</link> | ( ( <LEFT> | <RIGHT> | <CHAR> | <USER> | <YEAR> | <MONTH> | <HOUR> | <MINUTE> | <SECOND> | <XMLCONCAT> | <XMLCOMMENT> ) <LPAREN> ( <link linkend="prod17">expression</link> !
( <COMMA> <link linkend="prod17">expression</link> )* )? <RPAREN> ) | ( ( <INSERT> ) <LPAREN> ( <link linkend="prod17">expression</link> ( <COMMA> <link linkend="prod17">expression</link> )* )? <RPAREN> ) | ( ( <TRANSLATE> ) <LPAREN> ( <link linkend="prod17">expression</link> ( <COMMA> <link linkend="prod17">expression</link> )* )? <RPAREN> ) | <link linkend="prod104">xmlParse</link> | <link linkend="prod105">xmlElement</link> | ( <XMLPI> <LPAREN> ( <ID> <link linkend="prod106">idExpression</link> | <link linkend="prod106">idExpression</link> ) ( <COMMA> <link linkend="prod17">expression</link> )? <RPAREN> ) | <link linkend="prod107">xmlForest</link> | <link linkend="prod68">xmlSerialize</link> | <link linkend="prod72">xmlQuery</link> | ( <link linkend="prod2">id</link> <LPAREN> ( <link linkend="prod17">expression</link> ( <COMMA> <link linkend="prod17">expression</link> )*!
)? <RPAREN> ) )</para></entry></row>
+( ( <CONVERT> <LPAREN> <link linkend="prod17">expression</link> <COMMA> <link linkend="prod32">dataType</link> <RPAREN> ) | ( <CAST> <LPAREN> <link linkend="prod17">expression</link> <AS> <link linkend="prod32">dataType</link> <RPAREN> ) | ( <link linkend="prod15">nonReserved</link> <LPAREN> <link linkend="prod17">expression</link> <COMMA> <link linkend="prod103">stringConstant</link> <RPAREN> ) | ( <link linkend="prod15">nonReserved</link> <LPAREN> <link linkend="prod104">intervalType</link> <COMMA> <link linkend="prod17">expression</link> <COMMA> <link linkend="prod17">expression</link> <RPAREN> ) | <link linkend="prod105">queryString</link> | ( ( <LEFT> | <RIGHT> | <CHAR> | <USER> | <YEAR> | <MONTH> | <HOUR> | <MINUTE> | <SECOND> | <XMLCONCAT> | <XMLCOMMENT> ) <LPAREN> ( <link linkend="prod17">expression</link> !
( <COMMA> <link linkend="prod17">expression</link> )* )? <RPAREN> ) | ( ( <INSERT> ) <LPAREN> ( <link linkend="prod17">expression</link> ( <COMMA> <link linkend="prod17">expression</link> )* )? <RPAREN> ) | ( ( <TRANSLATE> ) <LPAREN> ( <link linkend="prod17">expression</link> ( <COMMA> <link linkend="prod17">expression</link> )* )? <RPAREN> ) | <link linkend="prod106">xmlParse</link> | <link linkend="prod107">xmlElement</link> | ( <XMLPI> <LPAREN> ( <ID> <link linkend="prod108">idExpression</link> | <link linkend="prod108">idExpression</link> ) ( <COMMA> <link linkend="prod17">expression</link> )? <RPAREN> ) | <link linkend="prod109">xmlForest</link> | <link linkend="prod70">xmlSerialize</link> | <link linkend="prod74">xmlQuery</link> | ( <link linkend="prod2">id</link> <LPAREN> ( <link linkend="prod17">expression</link> ( <COMMA> <link linkend="prod17">expression</link> )*!
)? <RPAREN> ) )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod101" xreflabel="stringConstant"/>stringConstant</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod103" xreflabel="stringConstant"/>stringConstant</para></entry>
<entry align="left" valign="top"><para>::=
<link linkend="prod1">stringVal</link></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod104" xreflabel="xmlParse"/>xmlParse</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod106" xreflabel="xmlParse"/>xmlParse</para></entry>
<entry align="left" valign="top"><para>::=
<XMLPARSE> <LPAREN> <link linkend="prod15">nonReserved</link> <link linkend="prod17">expression</link> ( <link linkend="prod15">nonReserved</link> )? <RPAREN></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod103" xreflabel="queryString"/>queryString</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod105" xreflabel="queryString"/>queryString</para></entry>
<entry align="left" valign="top"><para>::=
-<link linkend="prod15">nonReserved</link> <LPAREN> <link linkend="prod17">expression</link> ( <COMMA> <link linkend="prod56">derivedColumn</link> )* <RPAREN></para></entry></row>
+<link linkend="prod15">nonReserved</link> <LPAREN> <link linkend="prod17">expression</link> ( <COMMA> <link linkend="prod58">derivedColumn</link> )* <RPAREN></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod105" xreflabel="xmlElement"/>xmlElement</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod107" xreflabel="xmlElement"/>xmlElement</para></entry>
<entry align="left" valign="top"><para>::=
-<XMLELEMENT> <LPAREN> ( <ID> <link linkend="prod2">id</link> | <link linkend="prod2">id</link> ) ( <COMMA> <link linkend="prod73">xmlNamespaces</link> )? ( <COMMA> <link linkend="prod108">xmlAttributes</link> )? ( <COMMA> <link linkend="prod17">expression</link> )* <RPAREN></para></entry></row>
+<XMLELEMENT> <LPAREN> ( <ID> <link linkend="prod2">id</link> | <link linkend="prod2">id</link> ) ( <COMMA> <link linkend="prod75">xmlNamespaces</link> )? ( <COMMA> <link linkend="prod110">xmlAttributes</link> )? ( <COMMA> <link linkend="prod17">expression</link> )* <RPAREN></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod108" xreflabel="xmlAttributes"/>xmlAttributes</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod110" xreflabel="xmlAttributes"/>xmlAttributes</para></entry>
<entry align="left" valign="top"><para>::=
-<XMLATTRIBUTES> <LPAREN> <link linkend="prod56">derivedColumn</link> ( <COMMA> <link linkend="prod56">derivedColumn</link> )* <RPAREN></para></entry></row>
+<XMLATTRIBUTES> <LPAREN> <link linkend="prod58">derivedColumn</link> ( <COMMA> <link linkend="prod58">derivedColumn</link> )* <RPAREN></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod107" xreflabel="xmlForest"/>xmlForest</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod109" xreflabel="xmlForest"/>xmlForest</para></entry>
<entry align="left" valign="top"><para>::=
-<XMLFOREST> <LPAREN> ( <link linkend="prod73">xmlNamespaces</link> <COMMA> )? <link linkend="prod56">derivedColumn</link> ( <COMMA> <link linkend="prod56">derivedColumn</link> )* <RPAREN></para></entry></row>
+<XMLFOREST> <LPAREN> ( <link linkend="prod75">xmlNamespaces</link> <COMMA> )? <link linkend="prod58">derivedColumn</link> ( <COMMA> <link linkend="prod58">derivedColumn</link> )* <RPAREN></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod73" xreflabel="xmlNamespaces"/>xmlNamespaces</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod75" xreflabel="xmlNamespaces"/>xmlNamespaces</para></entry>
<entry align="left" valign="top"><para>::=
-<XMLNAMESPACES> <LPAREN> <link linkend="prod109">namespaceItem</link> ( <COMMA> <link linkend="prod109">namespaceItem</link> )* <RPAREN></para></entry></row>
+<XMLNAMESPACES> <LPAREN> <link linkend="prod111">namespaceItem</link> ( <COMMA> <link linkend="prod111">namespaceItem</link> )* <RPAREN></para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod109" xreflabel="namespaceItem"/>namespaceItem</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod111" xreflabel="namespaceItem"/>namespaceItem</para></entry>
<entry align="left" valign="top"><para>::=
( <link linkend="prod1">stringVal</link> <AS> <link linkend="prod2">id</link> )</para></entry></row>
<row>
@@ -821,7 +829,7 @@
<entry align="left" valign="top"><para>::=
( <DEFAULT_KEYWORD> <link linkend="prod1">stringVal</link> )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod106" xreflabel="idExpression"/>idExpression</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod108" xreflabel="idExpression"/>idExpression</para></entry>
<entry align="left" valign="top"><para>::=
<link linkend="prod2">id</link></para></entry></row>
<row>
@@ -829,11 +837,11 @@
<entry align="left" valign="top"><para>::=
( <STRING> | <VARCHAR> | <BOOLEAN> | <BYTE> | <TINYINT> | <SHORT> | <SMALLINT> | <CHAR> | <INTEGER> | <LONG> | <BIGINT> | <BIGINTEGER> | <FLOAT> | <REAL> | <DOUBLE> | <BIGDECIMAL> | <DECIMAL> | <DATE> | <TIME> | <TIMESTAMP> | <OBJECT> | <BLOB> | <CLOB> | <XML> )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod102" xreflabel="intervalType"/>intervalType</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod104" xreflabel="intervalType"/>intervalType</para></entry>
<entry align="left" valign="top"><para>::=
( <link linkend="prod15">nonReserved</link> )</para></entry></row>
<row>
-<entry align="right" valign="top"><para><anchor id="prod97" xreflabel="literal"/>literal</para></entry>
+<entry align="right" valign="top"><para><anchor id="prod99" xreflabel="literal"/>literal</para></entry>
<entry align="left" valign="top"><para>::=
( <link linkend="prod1">stringVal</link> | <INTEGERVAL> | <FLOATVAL> | <FALSE> | <TRUE> | <UNKNOWN> | <NULL> | ( ( <BOOLEANTYPE> | <TIMESTAMPTYPE> | <DATETYPE> | <TIMETYPE> ) <link linkend="prod1">stringVal</link> <RBRACE> ) )</para></entry></row>
</tbody>
Modified: trunk/documentation/reference/src/main/docbook/en-US/content/sql_support.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/sql_support.xml 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/sql_support.xml 2010-10-04 21:04:24 UTC (rev 2625)
@@ -401,6 +401,11 @@
<para>A SELECT command has a number of clauses:</para>
<listitem>
<para>
+ <link linkend="with_clause">WITH ...</link>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
<link linkend="select_clause">SELECT ...</link>
</para>
</listitem>
@@ -445,6 +450,10 @@
</para>
<itemizedlist>
<listitem>
+ <para>WITH stage - gathers all rows from all with items in the order listed. Subsequent with items and the main query can reference the a with item as if it is a table.
+ </para>
+ </listitem>
+ <listitem>
<para>FROM stage - gathers all rows from all tables involved in the query and logically joins them with a Cartesian product, producing a single large table with all columns from all tables. Joins and join criteria are then applied to filter rows that do not match the join structure.
</para>
</listitem>
@@ -482,6 +491,11 @@
named. Because the WHERE clause is processed before the SELECT, the
columns have not yet been named and the aliases are not yet known.
</para>
+ <note>
+ <para>
+ The explicit table syntax <code>TABLE x</code> may be used as a shortcut for <code>SELECT * FROM x</code>.
+ </para>
+ </note>
</section>
<section id="insert_command">
<title>INSERT Command</title>
@@ -725,10 +739,26 @@
<section>
<title>SQL Clauses</title>
<para>This section describes the clauses that are used in the various <link linkend="sql_commands">SQL commands</link> described in the previous section. Nearly all these features follow standard SQL syntax and functionality, so any SQL reference can be used for more information.</para>
+ <section id="with_clause">
+ <title>WITH Clause</title>
+ <para>
+ Teiid supports non-recursive common table expressions via the WITH clause. With clause items may be referenced as tables in subsequent with clause items and in the main query. The WITH clause can be thought of as providing query scoped temporary tables.
+ </para>
+ <para>
+ Usage:
+ <synopsis label="Usage">WITH name [(column, ...)] AS (query expression) ... </synopsis>
+ </para>
+ <itemizedlist>
+ <para>Syntax Rules:</para>
+ <listitem><para>All of the projected column names must be unique. If they are not unique, then the column name list must be provided.</para></listitem>
+ <listitem><para>If the columns of the WITH clause item are declared, then they must match the number of columns projected by the query expression.</para></listitem>
+ <listitem><para>Each with clause item must have a unique name.</para></listitem>
+ </itemizedlist>
+ </section>
<section id="select_clause">
<title>SELECT Clause</title>
<para>
- SQL queries start with the SELECT keyword and are often referred to as "SELECT statements". Teiid supports most of the standard SQL query constructs.
+ SQL queries that start with the SELECT keyword and are often referred to as "SELECT statements". Teiid supports most of the standard SQL query constructs.
</para>
<para>
Usage:
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/CapabilitiesConverter.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -97,6 +97,7 @@
tgtCaps.setCapabilitySupport(Capability.QUERY_AGGREGATES_ENHANCED_NUMERIC, srcCaps.supportsAggregatesEnhancedNumeric());
tgtCaps.setCapabilitySupport(Capability.QUERY_ORDERBY_NULL_ORDERING, srcCaps.supportsOrderByNullOrdering());
tgtCaps.setCapabilitySupport(Capability.INSERT_WITH_ITERATOR, srcCaps.supportsInsertWithIterator());
+ tgtCaps.setCapabilitySupport(Capability.COMMON_TABLE_EXPRESSIONS, srcCaps.supportsCommonTableExpressions());
List functions = srcCaps.getSupportedFunctions();
if(functions != null && functions.size() > 0) {
Iterator iter = functions.iterator();
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -62,6 +62,8 @@
import org.teiid.language.SubqueryComparison;
import org.teiid.language.SubqueryIn;
import org.teiid.language.TableReference;
+import org.teiid.language.With;
+import org.teiid.language.WithItem;
import org.teiid.language.Argument.Direction;
import org.teiid.language.Comparison.Operator;
import org.teiid.language.SortSpecification.Ordering;
@@ -101,6 +103,7 @@
import org.teiid.query.sql.lang.SubquerySetCriteria;
import org.teiid.query.sql.lang.UnaryFromClause;
import org.teiid.query.sql.lang.Update;
+import org.teiid.query.sql.lang.WithQueryCommand;
import org.teiid.query.sql.symbol.AggregateSymbol;
import org.teiid.query.sql.symbol.AliasSymbol;
import org.teiid.query.sql.symbol.Constant;
@@ -169,6 +172,7 @@
result.setRightQuery(translate(union.getRightQuery()));
result.setOrderBy(translate(union.getOrderBy()));
result.setLimit(translate(union.getLimit()));
+ result.setWith(translate(union.getWith()));
return result;
}
@@ -209,8 +213,30 @@
translate(query.getCriteria()), translate(query.getGroupBy()),
translate(query.getHaving()), translate(query.getOrderBy()));
q.setLimit(translate(query.getLimit()));
+ q.setWith(translate(query.getWith()));
return q;
}
+
+ public With translate(List<WithQueryCommand> with) {
+ if (with == null || with.isEmpty()) {
+ return null;
+ }
+ With result = new With();
+ ArrayList<WithItem> items = new ArrayList<WithItem>(with.size());
+ for (WithQueryCommand withQueryCommand : with) {
+ WithItem item = new WithItem();
+ item.setTable(translate(withQueryCommand.getGroupSymbol()));
+ if (withQueryCommand.getColumns() != null) {
+ List<ColumnReference> translatedElements = new ArrayList<ColumnReference>(withQueryCommand.getColumns().size());
+ for (ElementSymbol es: withQueryCommand.getColumns()) {
+ translatedElements.add(translate(es));
+ }
+ }
+ item.setSubquery(translate(withQueryCommand.getCommand()));
+ }
+ result.setItems(items);
+ return result;
+ }
public TableReference translate(FromClause clause) {
if (clause == null) return null;
Modified: trunk/engine/src/main/java/org/teiid/query/analysis/AnalysisRecord.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/analysis/AnalysisRecord.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/analysis/AnalysisRecord.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -76,6 +76,7 @@
public static final String PROP_NODE_COST_ESTIMATES = "Cost Estimates"; //$NON-NLS-1$
public static final String PROP_ROW_OFFSET = "Row Offset"; //$NON-NLS-1$
public static final String PROP_ROW_LIMIT = "Row Limit"; //$NON-NLS-1$
+ public static final String PROP_WITH = "With"; //$NON-NLS-1$
// XML
public static final String PROP_MESSAGE = "Message"; //$NON-NLS-1$
Modified: trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/metadata/TempMetadataID.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -266,9 +266,9 @@
public boolean isScalarGroup() {
return this.metadataType == Type.SCALAR;
}
-
- public void setScalarGroup() {
- this.metadataType = Type.SCALAR;
+
+ public void setMetadataType(Type metadataType) {
+ this.metadataType = metadataType;
}
public List<TempMetadataID> getPrimaryKey() {
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/capabilities/SourceCapabilities.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/capabilities/SourceCapabilities.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/capabilities/SourceCapabilities.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -318,7 +318,8 @@
*/
REQUIRES_CRITERIA,
INSERT_WITH_QUERYEXPRESSION,
- INSERT_WITH_ITERATOR
+ INSERT_WITH_ITERATOR,
+ COMMON_TABLE_EXPRESSIONS
}
public enum Scope {
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/RelationalPlanner.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -53,11 +53,14 @@
import org.teiid.query.metadata.TempMetadataStore;
import org.teiid.query.optimizer.QueryOptimizer;
import org.teiid.query.optimizer.capabilities.CapabilitiesFinder;
+import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
import org.teiid.query.optimizer.relational.plantree.NodeConstants;
import org.teiid.query.optimizer.relational.plantree.NodeEditor;
import org.teiid.query.optimizer.relational.plantree.NodeFactory;
import org.teiid.query.optimizer.relational.plantree.PlanNode;
import org.teiid.query.optimizer.relational.plantree.NodeConstants.Info;
+import org.teiid.query.optimizer.relational.rules.CapabilitiesUtil;
+import org.teiid.query.optimizer.relational.rules.CriteriaCapabilityValidatorVisitor;
import org.teiid.query.optimizer.relational.rules.RuleConstants;
import org.teiid.query.parser.QueryParser;
import org.teiid.query.processor.ProcessorPlan;
@@ -68,6 +71,7 @@
import org.teiid.query.resolver.util.ResolverUtil;
import org.teiid.query.rewriter.QueryRewriter;
import org.teiid.query.sql.LanguageObject;
+import org.teiid.query.sql.LanguageVisitor;
import org.teiid.query.sql.LanguageObject.Util;
import org.teiid.query.sql.lang.CacheHint;
import org.teiid.query.sql.lang.Command;
@@ -91,6 +95,8 @@
import org.teiid.query.sql.lang.SubqueryFromClause;
import org.teiid.query.sql.lang.TableFunctionReference;
import org.teiid.query.sql.lang.UnaryFromClause;
+import org.teiid.query.sql.lang.WithQueryCommand;
+import org.teiid.query.sql.navigator.PreOrPostOrderNavigator;
import org.teiid.query.sql.proc.CreateUpdateProcedureCommand;
import org.teiid.query.sql.symbol.AllSymbol;
import org.teiid.query.sql.symbol.GroupSymbol;
@@ -140,6 +146,53 @@
analysisRecord.println("\n----------------------------------------------------------------------------"); //$NON-NLS-1$
analysisRecord.println("GENERATE CANONICAL: \n" + command); //$NON-NLS-1$
}
+
+ PlanToProcessConverter planToProcessConverter = null;
+ if (context != null) {
+ planToProcessConverter = context.getPlanToProcessConverter();
+ }
+ if (planToProcessConverter == null) {
+ planToProcessConverter = new PlanToProcessConverter(metadata, idGenerator, analysisRecord, capFinder);
+ }
+
+ //plan with
+ List<WithQueryCommand> withList = null;
+ Object modelID = null;
+ boolean supportsWithPushdown = true;
+ List<WithQueryCommand> pushDownWith = null;
+ if (command instanceof QueryCommand) {
+ QueryCommand queryCommand = (QueryCommand)command;
+ final HashSet<String> names = new HashSet<String>();
+ if (queryCommand.getWith() != null && !queryCommand.getWith().isEmpty()) {
+ withList = queryCommand.getWith();
+ for (WithQueryCommand with : queryCommand.getWith()) {
+ Command subCommand = with.getCommand();
+ ProcessorPlan procPlan = QueryOptimizer.optimizePlan(subCommand, metadata, idGenerator, capFinder, analysisRecord, context);
+ subCommand.setProcessorPlan(procPlan);
+ QueryCommand withCommand = CriteriaCapabilityValidatorVisitor.getQueryCommand(procPlan);
+ if (withCommand != null && supportsWithPushdown) {
+ modelID = CriteriaCapabilityValidatorVisitor.validateCommandPushdown(modelID, metadata, capFinder, withCommand);
+ }
+ if (modelID == null) {
+ supportsWithPushdown = false;
+ } else {
+ if (pushDownWith == null) {
+ pushDownWith = new ArrayList<WithQueryCommand>();
+ }
+ WithQueryCommand wqc = new WithQueryCommand(with.getGroupSymbol(), with.getColumns(), withCommand);
+ pushDownWith.add(wqc);
+ }
+ names.add(with.getGroupSymbol().getCanonicalName());
+ }
+ if (modelID != null && supportsWithPushdown) {
+ supportsWithPushdown = CapabilitiesUtil.supports(Capability.COMMON_TABLE_EXPRESSIONS, modelID, metadata, capFinder);
+ }
+ if (supportsWithPushdown) {
+ addModelIds(command, modelID, names);
+ }
+ }
+ }
+
PlanNode plan;
try {
plan = generatePlan(command);
@@ -163,21 +216,46 @@
// Run rule-based optimizer
plan = executeRules(rules, plan);
- PlanToProcessConverter planToProcessConverter = null;
- if (context != null) {
- planToProcessConverter = context.getPlanToProcessConverter();
+ RelationalPlan result = planToProcessConverter.convert(plan);
+ if (withList != null && supportsWithPushdown) {
+ QueryCommand queryCommand = CriteriaCapabilityValidatorVisitor.getQueryCommand(result);
+ if (queryCommand != null) {
+ if (CriteriaCapabilityValidatorVisitor.validateCommandPushdown(modelID, metadata, capFinder, queryCommand) == null) {
+ supportsWithPushdown = false;
+ } else {
+ queryCommand.setWith(pushDownWith);
+ }
+ } else {
+ supportsWithPushdown = false;
+ }
}
- if (planToProcessConverter == null) {
- planToProcessConverter = new PlanToProcessConverter(metadata, idGenerator, analysisRecord, capFinder);
+ if (!supportsWithPushdown) {
+ result.setWith(withList);
}
-
- RelationalPlan result = planToProcessConverter.convert(plan);
-
result.setOutputElements(topCols);
return result;
}
+ /**
+ * mark all relevant group symbols as being from the modelid
+ * @param command
+ * @param modelID
+ * @param names
+ */
+ private void addModelIds(Command command, final Object modelID,
+ final HashSet<String> names) {
+ PreOrPostOrderNavigator.doVisit(command, new LanguageVisitor() {
+ @Override
+ public void visit(UnaryFromClause obj) {
+ GroupSymbol group = obj.getGroup();
+ if (names.contains(group.getNonCorrelationName().toUpperCase())) {
+ group.setModelMetadataId(modelID);
+ }
+ }
+ }, PreOrPostOrderNavigator.POST_ORDER, true);
+ }
+
public void initialize(Command command, IDGenerator idGenerator,
QueryMetadataInterface metadata, CapabilitiesFinder capFinder,
AnalysisRecord analysisRecord, CommandContext context) {
@@ -651,6 +729,9 @@
nestedCommand = resolveVirtualGroup(group);
}
node = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
+ if (group.getModelMetadataId() != null) {
+ node.setProperty(Info.MODEL_ID, group.getModelMetadataId());
+ }
node.addGroup(group);
if (nestedCommand != null) {
addNestedCommand(node, group, nestedCommand, nestedCommand, true);
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/NodeConstants.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/NodeConstants.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/plantree/NodeConstants.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -32,17 +32,18 @@
private Types() {}
static final int NO_TYPE = 0;
- public static final int ACCESS = 2<<0;
- public static final int DUP_REMOVE = 2<<1;
- public static final int JOIN = 2<<2;
- public static final int PROJECT = 2<<3;
- public static final int SELECT = 2<<4;
- public static final int SORT = 2<<5;
- public static final int SOURCE = 2<<6;
- public static final int GROUP = 2<<7;
- public static final int SET_OP = 2<<8;
- public static final int NULL = 2<<9;
- public static final int TUPLE_LIMIT = 2<<10;
+ public static final int ACCESS = 1<<0;
+ public static final int DUP_REMOVE = 1<<1;
+ public static final int JOIN = 1<<2;
+ public static final int PROJECT = 1<<3;
+ public static final int SELECT = 1<<4;
+ public static final int SORT = 1<<5;
+ public static final int SOURCE = 1<<6;
+ public static final int GROUP = 1<<7;
+ public static final int SET_OP = 1<<8;
+ public static final int NULL = 1<<9;
+ public static final int TUPLE_LIMIT = 1<<10;
+ public static final int WITH = 1<<11;
}
/**
@@ -63,6 +64,7 @@
case NodeConstants.Types.SET_OP: return "SetOperation"; //$NON-NLS-1$
case NodeConstants.Types.NULL: return "Null"; //$NON-NLS-1$
case NodeConstants.Types.TUPLE_LIMIT: return "TupleLimit"; //$NON-NLS-1$
+ case NodeConstants.Types.WITH: return "With"; //$NON-NLS-1$
default: return "Unknown: " + type; //$NON-NLS-1$
}
}
@@ -71,6 +73,7 @@
public enum Info {
ATOMIC_REQUEST, // Command
MODEL_ID, // Object (model ID)
+ IS_COMMON_TABLE,
PROCEDURE_CRITERIA,
PROCEDURE_INPUTS,
PROCEDURE_DEFAULTS,
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/CriteriaCapabilityValidatorVisitor.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -52,6 +52,7 @@
import org.teiid.query.sql.lang.MatchCriteria;
import org.teiid.query.sql.lang.NotCriteria;
import org.teiid.query.sql.lang.Query;
+import org.teiid.query.sql.lang.QueryCommand;
import org.teiid.query.sql.lang.SetCriteria;
import org.teiid.query.sql.lang.SubqueryCompareCriteria;
import org.teiid.query.sql.lang.SubqueryContainer;
@@ -446,45 +447,17 @@
* @return
* @throws TeiidComponentException
*/
- static Object validateSubqueryPushdown(SubqueryContainer subqueryContainer, Object critNodeModelID, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord) throws TeiidComponentException {
+ public static Object validateSubqueryPushdown(SubqueryContainer subqueryContainer, Object critNodeModelID,
+ QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord) throws TeiidComponentException {
ProcessorPlan plan = subqueryContainer.getCommand().getProcessorPlan();
if (plan != null) {
- if(!(plan instanceof RelationalPlan)) {
- return null;
- }
-
- RelationalPlan rplan = (RelationalPlan) plan;
-
- // Check that the plan is just an access node
- RelationalNode accessNode = rplan.getRootNode();
- if(accessNode == null || ! (accessNode instanceof AccessNode) || accessNode.getChildren()[0] != null) {
- return null;
- }
-
- // Check that command in access node is a query
- Command command = ((AccessNode)accessNode).getCommand();
- if(command == null || !(command instanceof Query) || ((Query)command).getIsXML()) {
- return null;
- }
-
- // Check that query in access node is for the same model as current node
- try {
- Collection subQueryGroups = GroupCollectorVisitor.getGroupsIgnoreInlineViews(command, false);
- if(subQueryGroups.size() == 0) {
- // No FROM?
- return null;
- }
- GroupSymbol subQueryGroup = (GroupSymbol)subQueryGroups.iterator().next();
-
- Object modelID = metadata.getModelID(subQueryGroup.getMetadataID());
- if (critNodeModelID == null) {
- critNodeModelID = modelID;
- } else if(!CapabilitiesUtil.isSameConnector(critNodeModelID, modelID, metadata, capFinder)) {
- return null;
- }
- } catch(QueryMetadataException e) {
- throw new TeiidComponentException(e, QueryPlugin.Util.getString("RulePushSelectCriteria.Error_getting_modelID")); //$NON-NLS-1$
- }
+ QueryCommand queryCommand = getQueryCommand(plan);
+
+ if (queryCommand == null) {
+ return null;
+ }
+
+ critNodeModelID = validateCommandPushdown(critNodeModelID, metadata, capFinder, queryCommand);
}
if (critNodeModelID == null) {
return null;
@@ -509,6 +482,56 @@
// Found no reason why this node is not eligible
return critNodeModelID;
}
+
+ public static Object validateCommandPushdown(Object critNodeModelID,
+ QueryMetadataInterface metadata, CapabilitiesFinder capFinder,
+ QueryCommand queryCommand) throws TeiidComponentException {
+ // Check that query in access node is for the same model as current node
+ try {
+ Collection subQueryGroups = GroupCollectorVisitor.getGroupsIgnoreInlineViews(queryCommand, false);
+ if(subQueryGroups.size() == 0) {
+ // No FROM?
+ return null;
+ }
+ GroupSymbol subQueryGroup = (GroupSymbol)subQueryGroups.iterator().next();
+
+ Object modelID = subQueryGroup.getModelMetadataId();
+ if (modelID == null) {
+ modelID = metadata.getModelID(subQueryGroup.getMetadataID());
+ }
+ if (critNodeModelID == null) {
+ critNodeModelID = modelID;
+ } else if(!CapabilitiesUtil.isSameConnector(critNodeModelID, modelID, metadata, capFinder)) {
+ return null;
+ }
+ } catch(QueryMetadataException e) {
+ throw new TeiidComponentException(e, QueryPlugin.Util.getString("RulePushSelectCriteria.Error_getting_modelID")); //$NON-NLS-1$
+ }
+ return critNodeModelID;
+ }
+
+ public static QueryCommand getQueryCommand(ProcessorPlan plan) {
+ if(!(plan instanceof RelationalPlan)) {
+ return null;
+ }
+
+ RelationalPlan rplan = (RelationalPlan) plan;
+
+ // Check that the plan is just an access node
+ RelationalNode accessNode = rplan.getRootNode();
+ if(accessNode == null || ! (accessNode instanceof AccessNode) || accessNode.getChildren()[0] != null) {
+ return null;
+ }
+
+ // Check that command in access node is a query
+ Command command = ((AccessNode)accessNode).getCommand();
+ if(command == null || !(command instanceof QueryCommand) || ((command instanceof Query) && ((Query)command).getIsXML())) {
+ return null;
+ }
+
+ QueryCommand queryCommand = (QueryCommand)command;
+ return queryCommand;
+ }
private void handleException(TeiidComponentException e) {
this.valid = false;
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleCollapseSource.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -90,6 +90,9 @@
if(nonRelationalPlan != null) {
accessNode.setProperty(NodeConstants.Info.PROCESSOR_PLAN, nonRelationalPlan);
+ } else if (RuleRaiseAccess.getModelIDFromAccess(accessNode, metadata) == null) {
+ //with query
+ accessNode.setProperty(NodeConstants.Info.IS_COMMON_TABLE, Boolean.TRUE);
} else if(command == null) {
PlanNode commandRoot = accessNode;
GroupSymbol intoGroup = (GroupSymbol)accessNode.getFirstChild().getProperty(NodeConstants.Info.INTO_GROUP);
@@ -106,7 +109,9 @@
command = insertCommand;
}
}
- accessNode.setProperty(NodeConstants.Info.ATOMIC_REQUEST, command);
+ if (command != null) {
+ accessNode.setProperty(NodeConstants.Info.ATOMIC_REQUEST, command);
+ }
accessNode.removeAllChildren();
}
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlaceAccess.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlaceAccess.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePlaceAccess.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -44,7 +44,6 @@
import org.teiid.query.optimizer.relational.plantree.PlanNode;
import org.teiid.query.resolver.util.ResolverUtil;
import org.teiid.query.sql.lang.Insert;
-import org.teiid.query.sql.lang.TextTable;
import org.teiid.query.sql.symbol.ElementSymbol;
import org.teiid.query.sql.symbol.Expression;
import org.teiid.query.sql.symbol.GroupSymbol;
@@ -135,6 +134,11 @@
if (hint != null) {
accessNode.setProperty(NodeConstants.Info.IS_OPTIONAL, hint);
}
+
+ Object modelId = sourceNode.removeProperty(NodeConstants.Info.MODEL_ID);
+ if (modelId != null) {
+ accessNode.setProperty(NodeConstants.Info.MODEL_ID, modelId);
+ }
// Insert
sourceNode.addAsParent(accessNode);
@@ -265,7 +269,7 @@
}
// Create the new symbol
- GroupSymbol newSymbol = (GroupSymbol)oldSymbol.clone();
+ GroupSymbol newSymbol = oldSymbol.clone();
newSymbol.setName(newName);
newSymbol.setDefinition(newDefinition);
return newSymbol;
Modified: trunk/engine/src/main/java/org/teiid/query/processor/BatchIterator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/BatchIterator.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/processor/BatchIterator.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -29,6 +29,7 @@
import org.teiid.common.buffer.TupleBatch;
import org.teiid.common.buffer.TupleBuffer;
import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.query.processor.BatchCollector.BatchProducer;
@@ -79,7 +80,7 @@
protected List<?> getCurrentTuple() throws TeiidComponentException,
BlockedException, TeiidProcessingException {
List<?> tuple = super.getCurrentTuple();
- if (mark && saveOnMark && this.getCurrentIndex() > this.buffer.getRowCount()) {
+ if (tuple != null && mark && saveOnMark && this.getCurrentIndex() > this.buffer.getRowCount()) {
this.buffer.setRowCount(this.getCurrentIndex() - 1);
this.buffer.addTuple(tuple);
}
@@ -122,14 +123,20 @@
this.buffer.purge();
}
mark = true;
+ if (saveOnMark) {
+ try {
+ getCurrentTuple();
+ } catch (TeiidException e) {
+ }
+ }
}
@Override
public void setPosition(int position) {
- super.setPosition(position);
if (this.buffer == null && position < getCurrentIndex() && position < (this.batch != null ? batch.getBeginRow() : Integer.MAX_VALUE)) {
throw new UnsupportedOperationException("Backwards positioning is not allowed"); //$NON-NLS-1$
}
+ super.setPosition(position);
}
}
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/JoinStrategy.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/JoinStrategy.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/JoinStrategy.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -38,6 +38,9 @@
private int reserved;
public void close() {
+ if (joinNode == null) {
+ return;
+ }
joinNode.getBufferManager().releaseBuffers(reserved);
reserved = 0;
try {
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/PartitionedSortJoin.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/PartitionedSortJoin.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/PartitionedSortJoin.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -63,6 +63,9 @@
@Override
public void close() {
+ if (joinNode == null) {
+ return;
+ }
super.close();
for (TupleBuffer tupleSourceID : this.partitions) {
tupleSourceID.remove();
Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalPlan.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalPlan.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/RelationalPlan.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -22,23 +22,32 @@
package org.teiid.query.processor.relational;
-import java.util.ArrayList;
-import java.util.Collections;
+import java.util.LinkedList;
import java.util.List;
import org.teiid.client.plan.PlanNode;
import org.teiid.common.buffer.BlockedException;
import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.TupleBatch;
+import org.teiid.common.buffer.TupleBuffer;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.language.SQLConstants;
+import org.teiid.query.analysis.AnalysisRecord;
+import org.teiid.query.metadata.TempMetadataAdapter;
+import org.teiid.query.processor.BatchCollector;
import org.teiid.query.processor.ProcessorDataManager;
import org.teiid.query.processor.ProcessorPlan;
+import org.teiid.query.processor.QueryProcessor;
import org.teiid.query.processor.relational.ProjectIntoNode.Mode;
+import org.teiid.query.sql.LanguageObject;
+import org.teiid.query.sql.lang.Create;
+import org.teiid.query.sql.lang.Insert;
import org.teiid.query.sql.lang.QueryCommand;
+import org.teiid.query.sql.lang.WithQueryCommand;
+import org.teiid.query.tempdata.TempTableStore;
import org.teiid.query.util.CommandContext;
-
/**
*/
public class RelationalPlan extends ProcessorPlan {
@@ -46,6 +55,11 @@
// Initialize state - don't reset
private RelationalNode root;
private List outputCols;
+ private List<WithQueryCommand> with;
+
+ private List<WithQueryCommand> withToProcess;
+ private BatchCollector withBatchCollector;
+ private TempTableStore tempTableStore;
/**
* Constructor for RelationalPlan.
@@ -61,13 +75,26 @@
public void setRootNode(RelationalNode root) {
this.root = root;
}
-
+
+ public void setWith(List<WithQueryCommand> with) {
+ this.with = with;
+ }
+
/**
* @see ProcessorPlan#connectDataManager(ProcessorDataManager)
*/
public void initialize(CommandContext context, ProcessorDataManager dataMgr, BufferManager bufferMgr) {
- setContext(context);
- connectExternal(this.root, context, dataMgr, bufferMgr);
+ if (this.with != null) {
+ context = context.clone();
+ tempTableStore = new TempTableStore(context.getConnectionID());
+ tempTableStore.setParentTempTableStore(context.getTempTableStore());
+ context.setTempTableStore(tempTableStore);
+ for (WithQueryCommand withCommand : this.with) {
+ withCommand.getCommand().getProcessorPlan().initialize(context, dataMgr, bufferMgr);
+ }
+ }
+ setContext(context);
+ connectExternal(this.root, context, dataMgr, bufferMgr);
}
private void connectExternal(RelationalNode node, CommandContext context, ProcessorDataManager dataMgr, BufferManager bufferMgr) {
@@ -94,7 +121,30 @@
public void open()
throws TeiidComponentException, TeiidProcessingException {
-
+ if (this.with != null) {
+ if (withToProcess == null) {
+ withToProcess = new LinkedList<WithQueryCommand>(with);
+ }
+ while (!withToProcess.isEmpty()) {
+ WithQueryCommand withCommand = withToProcess.get(0);
+ if (withBatchCollector == null) {
+ ProcessorPlan plan = withCommand.getCommand().getProcessorPlan();
+ QueryProcessor qp = new QueryProcessor(plan, getContext(), this.root.getBufferManager(), this.root.getDataManager());
+ withBatchCollector = qp.createBatchCollector();
+ }
+ TupleBuffer tb = withBatchCollector.collectTuples();
+ Create create = new Create();
+ create.setColumns(withCommand.getColumns());
+ create.setTable(withCommand.getGroupSymbol());
+ this.root.getDataManager().registerRequest(getContext(), create, TempMetadataAdapter.TEMP_MODEL.getID(), null, 0);
+ Insert insert = new Insert(withCommand.getGroupSymbol(), withCommand.getColumns(), null);
+ insert.setTupleSource(tb.createIndexedTupleSource(true));
+ this.root.getDataManager().registerRequest(getContext(), insert, TempMetadataAdapter.TEMP_MODEL.getID(), null, 0);
+ this.tempTableStore.setUpdatable(withCommand.getGroupSymbol().getCanonicalName(), false);
+ withToProcess.remove(0);
+ withBatchCollector = null;
+ }
+ }
this.root.open();
}
@@ -109,7 +159,14 @@
public void close()
throws TeiidComponentException {
-
+ if (this.with != null) {
+ for (WithQueryCommand withCommand : this.with) {
+ withCommand.getCommand().getProcessorPlan().close();
+ }
+ if (this.tempTableStore != null) {
+ this.tempTableStore.removeTempTables();
+ }
+ }
this.root.close();
}
@@ -120,20 +177,47 @@
super.reset();
this.root.reset();
+ if (this.with != null) {
+ withToProcess = null;
+ withBatchCollector = null;
+ for (WithQueryCommand withCommand : this.with) {
+ withCommand.getCommand().getProcessorPlan().reset();
+ }
+ }
}
public String toString() {
- return this.root.toString();
+ StringBuilder sb = new StringBuilder();
+ if (this.with != null) {
+ sb.append(SQLConstants.Reserved.WITH);
+ for (WithQueryCommand withCommand : this.with) {
+ sb.append("\n"); //$NON-NLS-1$
+ sb.append(withCommand.getCommand().getProcessorPlan());
+ }
+ }
+ sb.append(this.root.toString());
+ return sb.toString();
}
public RelationalPlan clone(){
RelationalPlan plan = new RelationalPlan((RelationalNode)root.clone());
- plan.setOutputElements(new ArrayList(( outputCols != null ? outputCols : Collections.EMPTY_LIST )));
+ plan.setOutputElements(outputCols);
+ if (with != null) {
+ List<WithQueryCommand> newWith = LanguageObject.Util.deepClone(this.with, WithQueryCommand.class);
+ for (WithQueryCommand withQueryCommand : newWith) {
+ withQueryCommand.getCommand().setProcessorPlan(withQueryCommand.getCommand().getProcessorPlan().clone());
+ }
+ plan.setWith(newWith);
+ }
return plan;
}
public PlanNode getDescriptionProperties() {
- return this.root.getDescriptionProperties();
+ PlanNode node = this.root.getDescriptionProperties();
+ if (this.with != null) {
+ AnalysisRecord.addLanaguageObjects(node, AnalysisRecord.PROP_WITH, this.with);
+ }
+ return node;
}
/**
@@ -145,6 +229,16 @@
@Override
public boolean requiresTransaction(boolean transactionalReads) {
+ if (this.with != null) {
+ if (transactionalReads) {
+ return true;
+ }
+ for (WithQueryCommand withCommand : this.with) {
+ if (withCommand.getCommand().getProcessorPlan().requiresTransaction(transactionalReads)) {
+ return true;
+ }
+ }
+ }
return requiresTransaction(transactionalReads, root);
}
Modified: trunk/engine/src/main/java/org/teiid/query/resolver/ProcedureContainerResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/ProcedureContainerResolver.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/ProcedureContainerResolver.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -37,6 +37,7 @@
import org.teiid.query.metadata.TempMetadataAdapter;
import org.teiid.query.metadata.TempMetadataID;
import org.teiid.query.metadata.TempMetadataStore;
+import org.teiid.query.metadata.TempMetadataID.Type;
import org.teiid.query.parser.QueryParser;
import org.teiid.query.resolver.util.ResolverUtil;
import org.teiid.query.sql.ProcedureReservedWords;
@@ -228,7 +229,7 @@
GroupSymbol variables = new GroupSymbol(name);
externalGroups.addGroup(variables);
TempMetadataID tid = metadata.addTempGroup(name, symbols);
- tid.setScalarGroup();
+ tid.setMetadataType(Type.SCALAR);
variables.setMetadataID(tid);
return variables;
}
Modified: trunk/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/QueryResolver.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -222,13 +222,17 @@
public static boolean isXMLQuery(Query query, QueryMetadataInterface metadata)
throws TeiidComponentException, QueryMetadataException, QueryResolverException {
+ if (query.getWith() != null && !query.getWith().isEmpty()) {
+ return false;
+ }
+
// Check first group
From from = query.getFrom();
if(from == null){
//select with no from
return false;
}
-
+
if (from.getClauses().size() != 1) {
return false;
}
Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/SetQueryResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/SetQueryResolver.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/SetQueryResolver.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -57,6 +57,8 @@
SetQuery setQuery = (SetQuery) command;
+ SimpleQueryResolver.resolveWith(metadata, analysis, setQuery);
+
QueryCommand firstCommand = setQuery.getLeftQuery();
QueryResolver.setChildMetadata(firstCommand, setQuery);
@@ -81,7 +83,7 @@
if (resolveNullLiterals) {
for (int i = 0; i < firstProjectTypes.size(); i++) {
- Class<?> clazz = (Class<?>) firstProjectTypes.get(i);
+ Class<?> clazz = firstProjectTypes.get(i);
if (clazz == null || clazz.equals(DataTypeManager.DefaultDataClasses.NULL)) {
firstProjectTypes.set(i, DataTypeManager.DefaultDataClasses.STRING);
@@ -107,7 +109,7 @@
}
private void setProjectedTypes(SetQuery setQuery,
- List firstProjectTypes, QueryMetadataInterface metadata) throws QueryResolverException {
+ List<Class<?>> firstProjectTypes, QueryMetadataInterface metadata) throws QueryResolverException {
for (QueryCommand subCommand : setQuery.getQueryCommands()) {
if (!(subCommand instanceof SetQuery)) {
continue;
@@ -117,7 +119,7 @@
if (child.getOrderBy() != null) {
for (int j = 0; j < projectedSymbols.size(); j++) {
SingleElementSymbol ses = (SingleElementSymbol)projectedSymbols.get(j);
- Class targetType = (Class)firstProjectTypes.get(j);
+ Class<?> targetType = firstProjectTypes.get(j);
if (ses.getType() != targetType && orderByContainsVariable(child.getOrderBy(), ses, j)) {
String sourceTypeName = DataTypeManager.getDataTypeName(ses.getType());
String targetTypeName = DataTypeManager.getDataTypeName(targetType);
Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/SimpleQueryResolver.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -61,6 +61,7 @@
import org.teiid.query.sql.lang.JoinPredicate;
import org.teiid.query.sql.lang.JoinType;
import org.teiid.query.sql.lang.Query;
+import org.teiid.query.sql.lang.QueryCommand;
import org.teiid.query.sql.lang.SPParameter;
import org.teiid.query.sql.lang.Select;
import org.teiid.query.sql.lang.StoredProcedure;
@@ -71,6 +72,7 @@
import org.teiid.query.sql.lang.TableFunctionReference;
import org.teiid.query.sql.lang.TextTable;
import org.teiid.query.sql.lang.UnaryFromClause;
+import org.teiid.query.sql.lang.WithQueryCommand;
import org.teiid.query.sql.lang.XMLTable;
import org.teiid.query.sql.navigator.PostOrderNavigator;
import org.teiid.query.sql.symbol.AliasSymbol;
@@ -95,7 +97,9 @@
public void resolveCommand(Command command, TempMetadataAdapter metadata, AnalysisRecord analysis, boolean resolveNullLiterals)
throws QueryMetadataException, QueryResolverException, TeiidComponentException {
- Query query = (Query) command;
+ Query query = (Query) command;
+
+ resolveWith(metadata, analysis, query);
try {
QueryResolverVisitor qrv = new QueryResolverVisitor(query, metadata, analysis);
@@ -133,6 +137,58 @@
}
}
+ static void resolveWith(TempMetadataAdapter metadata,
+ AnalysisRecord analysis, QueryCommand query) throws QueryResolverException, TeiidComponentException {
+ if (query.getWith() == null || query.getWith().isEmpty()) {
+ return;
+ }
+ LinkedHashSet<GroupSymbol> discoveredGroups = new LinkedHashSet<GroupSymbol>();
+ for (WithQueryCommand obj : query.getWith()) {
+ QueryCommand queryExpression = obj.getCommand();
+
+ QueryResolver.setChildMetadata(queryExpression, query);
+
+ try {
+ QueryResolver.resolveCommand(queryExpression, Collections.EMPTY_MAP, metadata.getMetadata(), analysis, false);
+ } catch (TeiidException err) {
+ throw new TeiidRuntimeException(err);
+ }
+
+ if (!discoveredGroups.add(obj.getGroupSymbol())) {
+ throw new QueryResolverException("Duplicate WITH clause item name {0}");
+ }
+ List<? extends SingleElementSymbol> projectedSymbols = obj.getCommand().getProjectedSymbols();
+ if (obj.getColumns() != null && !obj.getColumns().isEmpty()) {
+ if (obj.getColumns().size() != projectedSymbols.size()) {
+ throw new QueryResolverException("The number of WITH clause columns for item {0} do not match the query expression");
+ }
+ Iterator<ElementSymbol> iter = obj.getColumns().iterator();
+ for (SingleElementSymbol singleElementSymbol : projectedSymbols) {
+ ElementSymbol es = iter.next();
+ es.setType(singleElementSymbol.getType());
+ }
+ projectedSymbols = obj.getColumns();
+ }
+ TempMetadataID id = ResolverUtil.addTempGroup(metadata, obj.getGroupSymbol(), projectedSymbols, true);
+ obj.getGroupSymbol().setMetadataID(metadata.getMetadataStore().getTempGroupID(obj.getGroupSymbol().getName()));
+ obj.getGroupSymbol().setIsTempTable(true);
+ List<GroupSymbol> groups = Collections.singletonList(obj.getGroupSymbol());
+ if (obj.getColumns() != null && !obj.getColumns().isEmpty()) {
+ for (SingleElementSymbol singleElementSymbol : projectedSymbols) {
+ ResolverVisitor.resolveLanguageObject(singleElementSymbol, groups, metadata);
+ }
+ }
+ if (obj.getColumns() != null && !obj.getColumns().isEmpty()) {
+ Iterator<ElementSymbol> iter = obj.getColumns().iterator();
+ for (TempMetadataID colid : id.getElements()) {
+ ElementSymbol es = iter.next();
+ es.setMetadataID(colid);
+ es.setGroupSymbol(obj.getGroupSymbol());
+ }
+ }
+ }
+ }
+
private static GroupSymbol resolveAllInGroup(AllInGroupSymbol allInGroupSymbol, Set<GroupSymbol> groups, QueryMetadataInterface metadata) throws QueryResolverException, QueryMetadataException, TeiidComponentException {
String name = allInGroupSymbol.getName();
int index = name.lastIndexOf(ALL_IN_GROUP_SUFFIX);
@@ -197,7 +253,7 @@
}
}
- private void resolveSubQuery(SubqueryContainer obj, Collection<GroupSymbol> externalGroups) {
+ private void resolveSubQuery(SubqueryContainer<?> obj, Collection<GroupSymbol> externalGroups) {
Command command = obj.getCommand();
QueryResolver.setChildMetadata(command, query);
Modified: trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -486,7 +486,7 @@
GroupInfo groupInfo = (GroupInfo)metadata.getFromMetadataCache(group.getMetadataID(), key);
if (groupInfo == null) {
- group = (GroupSymbol)group.clone();
+ group = group.clone();
// get all elements from the metadata
List elementIDs = metadata.getElementIDsInGroupID(group.getMetadataID());
Modified: trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/rewriter/QueryRewriter.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -111,6 +111,7 @@
import org.teiid.query.sql.lang.TranslatableProcedureContainer;
import org.teiid.query.sql.lang.UnaryFromClause;
import org.teiid.query.sql.lang.Update;
+import org.teiid.query.sql.lang.WithQueryCommand;
import org.teiid.query.sql.lang.XMLTable;
import org.teiid.query.sql.lang.PredicateCriteria.Negatable;
import org.teiid.query.sql.navigator.PostOrderNavigator;
@@ -231,17 +232,24 @@
switch(command.getType()) {
case Command.TYPE_QUERY:
+ QueryCommand queryCommand = (QueryCommand)command;
+ if (removeOrderBy && queryCommand.getLimit() == null) {
+ queryCommand.setOrderBy(null);
+ }
+ if (queryCommand.getWith() != null) {
+ for (WithQueryCommand withQueryCommand : queryCommand.getWith()) {
+ if (withQueryCommand.getColumns() == null) {
+ List<ElementSymbol> columns = ResolverUtil.resolveElementsInGroup(withQueryCommand.getGroupSymbol(), metadata);
+ withQueryCommand.setColumns(LanguageObject.Util.deepClone(columns, ElementSymbol.class));
+ }
+ rewriteSubqueryContainer(withQueryCommand, true);
+ }
+ }
if(command instanceof Query) {
command = rewriteQuery((Query) command);
}else {
command = rewriteSetQuery((SetQuery) command);
}
- if (removeOrderBy) {
- QueryCommand queryCommand = (QueryCommand)command;
- if (queryCommand.getLimit() == null) {
- queryCommand.setOrderBy(null);
- }
- }
break;
case Command.TYPE_STORED_PROCEDURE:
command = rewriteExec((StoredProcedure) command);
Modified: trunk/engine/src/main/java/org/teiid/query/sql/LanguageObject.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/LanguageObject.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/sql/LanguageObject.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -48,6 +48,9 @@
public static class Util {
public static <S extends LanguageObject, T extends S> ArrayList<S> deepClone(List<T> collection, Class<S> type) {
+ if (collection == null) {
+ return null;
+ }
ArrayList<S> result = new ArrayList<S>(collection.size());
for (LanguageObject obj : collection) {
result.add(type.cast(obj.clone()));
Modified: trunk/engine/src/main/java/org/teiid/query/sql/LanguageVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/LanguageVisitor.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/sql/LanguageVisitor.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -33,6 +33,7 @@
* the public visit methods should be overridden to provide the visitor functionality.
* These public visit methods SHOULD NOT be called directly.</p>
*/
+@SuppressWarnings("unused")
public abstract class LanguageVisitor {
private boolean abort = false;
@@ -135,4 +136,5 @@
public void visit(QueryString obj) {}
public void visit(XMLParse obj) {}
public void visit(ExpressionCriteria obj) {}
+ public void visit(WithQueryCommand obj) {}
}
Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/Insert.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/Insert.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/Insert.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -162,7 +162,7 @@
* Set a collection of variables that replace the existing variables
* @param vars Variables to be set on this object (ElementSymbols)
*/
- public void setVariables(Collection vars) {
+ public void setVariables(Collection<ElementSymbol> vars) {
this.variables.clear();
this.variables.addAll(vars);
}
Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/Query.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/Query.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/Query.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -349,6 +349,8 @@
if(getLimit() != null) {
copy.setLimit( (Limit) getLimit().clone());
}
+
+ copy.setWith(LanguageObject.Util.deepClone(this.getWith(), WithQueryCommand.class));
// Defect 13751: should clone isXML state.
copy.setIsXML(getIsXML());
@@ -391,6 +393,7 @@
EquivalenceUtil.areEqual(getHaving(), other.getHaving()) &&
EquivalenceUtil.areEqual(getOrderBy(), other.getOrderBy()) &&
EquivalenceUtil.areEqual(getLimit(), other.getLimit()) &&
+ EquivalenceUtil.areEqual(getWith(), other.getWith()) &&
getIsXML() == other.getIsXML() &&
sameOptionAndHint(other);
}
Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/QueryCommand.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/QueryCommand.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/QueryCommand.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -22,8 +22,10 @@
package org.teiid.query.sql.lang;
+import java.util.List;
+
/**
* This is a common super class for the two types of query commands: Query and SetQuery.
* This class provides some useful commonalities when the type of query command
@@ -36,6 +38,8 @@
/** Limit on returned rows */
private Limit limit;
+
+ private List<WithQueryCommand> with;
/**
* Get the order by clause for the query.
@@ -61,5 +65,13 @@
this.limit = limit;
}
+ public List<WithQueryCommand> getWith() {
+ return with;
+ }
+
+ public void setWith(List<WithQueryCommand> with) {
+ this.with = with;
+ }
+
public abstract Query getProjectedQuery();
}
Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/SetQuery.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/SetQuery.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/SetQuery.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -34,6 +34,7 @@
import org.teiid.core.util.HashCodeUtil;
import org.teiid.query.metadata.QueryMetadataInterface;
import org.teiid.query.resolver.util.ResolverUtil;
+import org.teiid.query.sql.LanguageObject;
import org.teiid.query.sql.LanguageVisitor;
import org.teiid.query.sql.symbol.AliasSymbol;
import org.teiid.query.sql.symbol.Expression;
@@ -175,13 +176,15 @@
copy.setAll(this.all);
if(this.getOrderBy() != null) {
- copy.setOrderBy( (OrderBy) this.getOrderBy().clone() );
+ copy.setOrderBy(this.getOrderBy().clone());
}
if(this.getLimit() != null) {
copy.setLimit( (Limit) this.getLimit().clone() );
}
+ copy.setWith(LanguageObject.Util.deepClone(this.getWith(), WithQueryCommand.class));
+
if (this.projectedTypes != null) {
copy.setProjectedTypes(new ArrayList<Class<?>>(projectedTypes), this.metadata);
}
@@ -213,6 +216,7 @@
EquivalenceUtil.areEqual(this.rightQuery, other.rightQuery) &&
EquivalenceUtil.areEqual(getOrderBy(), other.getOrderBy()) &&
EquivalenceUtil.areEqual(getLimit(), other.getLimit()) &&
+ EquivalenceUtil.areEqual(getWith(), other.getWith()) &&
sameOptionAndHint(other);
}
Modified: trunk/engine/src/main/java/org/teiid/query/sql/lang/SubqueryContainer.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/SubqueryContainer.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/SubqueryContainer.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -26,18 +26,18 @@
* This interface defines a common interface for all MetaMatrix SQL objects
* that contain subqueries.
*/
-public interface SubqueryContainer {
+public interface SubqueryContainer<T extends Command> {
/**
* Returns the subquery Command object
* @return the subquery Command object
*/
- Command getCommand();
+ T getCommand();
/**
* Sets the subquery Command object
* @param command the subquery Command object
*/
- void setCommand(Command command);
+ void setCommand(T command);
}
Added: trunk/engine/src/main/java/org/teiid/query/sql/lang/WithQueryCommand.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/lang/WithQueryCommand.java (rev 0)
+++ trunk/engine/src/main/java/org/teiid/query/sql/lang/WithQueryCommand.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -0,0 +1,79 @@
+package org.teiid.query.sql.lang;
+
+import java.util.List;
+
+import org.teiid.core.util.EquivalenceUtil;
+import org.teiid.query.sql.LanguageObject;
+import org.teiid.query.sql.LanguageVisitor;
+import org.teiid.query.sql.symbol.ElementSymbol;
+import org.teiid.query.sql.symbol.GroupSymbol;
+import org.teiid.query.sql.visitor.SQLStringVisitor;
+
+public class WithQueryCommand implements LanguageObject, SubqueryContainer<QueryCommand> {
+
+ private GroupSymbol groupSymbol;
+ private List<ElementSymbol> columns;
+ private QueryCommand queryExpression;
+
+ public WithQueryCommand(GroupSymbol groupSymbol, List<ElementSymbol> columns, QueryCommand queryExpression) {
+ this.groupSymbol = groupSymbol;
+ this.columns = columns;
+ this.queryExpression = queryExpression;
+ }
+
+ public GroupSymbol getGroupSymbol() {
+ return groupSymbol;
+ }
+
+ public void setColumns(List<ElementSymbol> columns) {
+ this.columns = columns;
+ }
+
+ public List<ElementSymbol> getColumns() {
+ return columns;
+ }
+
+ @Override
+ public QueryCommand getCommand() {
+ return queryExpression;
+ }
+
+ public void setCommand(QueryCommand command) {
+ this.queryExpression = command;
+ }
+
+ @Override
+ public void acceptVisitor(LanguageVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ @Override
+ public WithQueryCommand clone() {
+ return new WithQueryCommand(groupSymbol.clone(), LanguageObject.Util.deepClone(columns, ElementSymbol.class), (QueryCommand)queryExpression.clone());
+ }
+
+ @Override
+ public int hashCode() {
+ return groupSymbol.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof WithQueryCommand)) {
+ return false;
+ }
+ WithQueryCommand other = (WithQueryCommand)obj;
+ return EquivalenceUtil.areEqual(groupSymbol, other.getGroupSymbol()) &&
+ EquivalenceUtil.areEqual(this.columns, other.getColumns()) &&
+ EquivalenceUtil.areEqual(this.queryExpression, other.queryExpression);
+ }
+
+ @Override
+ public String toString() {
+ return SQLStringVisitor.getSQLString(this);
+ }
+
+}
Property changes on: trunk/engine/src/main/java/org/teiid/query/sql/lang/WithQueryCommand.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/engine/src/main/java/org/teiid/query/sql/navigator/DeepPostOrderNavigator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/navigator/DeepPostOrderNavigator.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/sql/navigator/DeepPostOrderNavigator.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -24,46 +24,17 @@
import org.teiid.query.sql.LanguageObject;
import org.teiid.query.sql.LanguageVisitor;
-import org.teiid.query.sql.lang.ExistsCriteria;
-import org.teiid.query.sql.lang.SubqueryCompareCriteria;
-import org.teiid.query.sql.lang.SubqueryFromClause;
-import org.teiid.query.sql.lang.SubquerySetCriteria;
-import org.teiid.query.sql.symbol.ScalarSubquery;
/**
* @since 4.2
*/
-public class DeepPostOrderNavigator extends PostOrderNavigator {
+public class DeepPostOrderNavigator extends PreOrPostOrderNavigator {
public DeepPostOrderNavigator(LanguageVisitor visitor) {
- super(visitor);
+ super(visitor, PreOrPostOrderNavigator.POST_ORDER, true);
}
- public void visit(ExistsCriteria obj) {
- visitNode(obj.getCommand());
- visitVisitor(obj);
- }
- public void visit(ScalarSubquery obj) {
- visitNode(obj.getCommand());
- visitVisitor(obj);
- }
- public void visit(SubqueryCompareCriteria obj) {
- visitNode(obj.getLeftExpression());
- visitNode(obj.getCommand());
- visitVisitor(obj);
- }
- public void visit(SubqueryFromClause obj) {
- visitNode(obj.getCommand());
- visitNode(obj.getGroupSymbol());
- visitVisitor(obj);
- }
- public void visit(SubquerySetCriteria obj) {
- visitNode(obj.getCommand());
- visitNode(obj.getExpression());
- visitVisitor(obj);
- }
-
public static void doVisit(LanguageObject object, LanguageVisitor visitor) {
DeepPostOrderNavigator nav = new DeepPostOrderNavigator(visitor);
object.acceptVisitor(nav);
Modified: trunk/engine/src/main/java/org/teiid/query/sql/navigator/DeepPreOrderNavigator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/navigator/DeepPreOrderNavigator.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/sql/navigator/DeepPreOrderNavigator.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -24,68 +24,21 @@
import org.teiid.query.sql.LanguageObject;
import org.teiid.query.sql.LanguageVisitor;
-import org.teiid.query.sql.lang.ExistsCriteria;
-import org.teiid.query.sql.lang.SubqueryCompareCriteria;
-import org.teiid.query.sql.lang.SubqueryFromClause;
-import org.teiid.query.sql.lang.SubquerySetCriteria;
-import org.teiid.query.sql.proc.CommandStatement;
-import org.teiid.query.sql.proc.LoopStatement;
-import org.teiid.query.sql.symbol.ScalarSubquery;
/**
* @since 4.2
*/
-public class DeepPreOrderNavigator extends PreOrderNavigator {
+public class DeepPreOrderNavigator extends PreOrPostOrderNavigator {
/**
* @param visitor
* @since 4.2
*/
public DeepPreOrderNavigator(LanguageVisitor visitor) {
- super(visitor);
+ super(visitor, PreOrPostOrderNavigator.PRE_ORDER, true);
}
-
- public void visit(ExistsCriteria obj) {
- visitVisitor(obj);
- visitNode(obj.getCommand());
- }
- public void visit(ScalarSubquery obj) {
- visitVisitor(obj);
- visitNode(obj.getCommand());
- }
- public void visit(SubqueryCompareCriteria obj) {
- visitVisitor(obj);
- visitNode(obj.getLeftExpression());
- visitNode(obj.getCommand());
- }
- public void visit(SubqueryFromClause obj) {
- visitVisitor(obj);
- visitNode(obj.getCommand());
- visitNode(obj.getGroupSymbol());
- }
- public void visit(SubquerySetCriteria obj) {
- visitVisitor(obj);
- visitNode(obj.getCommand());
- visitNode(obj.getExpression());
- }
-
- @Override
- public void visit(CommandStatement obj) {
- visitVisitor(obj);
- visitNode(obj.getCommand());
- visitVisitor(obj);
- }
-
- @Override
- public void visit(LoopStatement obj) {
- visitVisitor(obj);
- visitNode(obj.getCommand());
- visitNode(obj.getBlock());
- visitVisitor(obj);
- }
-
public static void doVisit(LanguageObject object, LanguageVisitor visitor) {
DeepPreOrderNavigator nav = new DeepPreOrderNavigator(visitor);
object.acceptVisitor(nav);
Modified: trunk/engine/src/main/java/org/teiid/query/sql/navigator/PostOrderNavigator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/navigator/PostOrderNavigator.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/sql/navigator/PostOrderNavigator.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -32,7 +32,7 @@
public class PostOrderNavigator extends PreOrPostOrderNavigator {
public PostOrderNavigator(LanguageVisitor visitor) {
- super(visitor, POST_ORDER);
+ super(visitor, POST_ORDER, false);
}
public static void doVisit(LanguageObject object, LanguageVisitor visitor) {
Modified: trunk/engine/src/main/java/org/teiid/query/sql/navigator/PreOrPostOrderNavigator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/navigator/PreOrPostOrderNavigator.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/sql/navigator/PreOrPostOrderNavigator.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -65,6 +65,7 @@
import org.teiid.query.sql.lang.TextTable;
import org.teiid.query.sql.lang.UnaryFromClause;
import org.teiid.query.sql.lang.Update;
+import org.teiid.query.sql.lang.WithQueryCommand;
import org.teiid.query.sql.lang.XMLTable;
import org.teiid.query.sql.proc.AssignmentStatement;
import org.teiid.query.sql.proc.Block;
@@ -115,10 +116,12 @@
public static final boolean POST_ORDER = false;
private boolean order;
+ private boolean deep;
- public PreOrPostOrderNavigator(LanguageVisitor visitor, boolean order) {
+ public PreOrPostOrderNavigator(LanguageVisitor visitor, boolean order, boolean deep) {
super(visitor);
this.order = order;
+ this.deep = deep;
}
protected void preVisitVisitor(LanguageObject obj) {
@@ -192,6 +195,9 @@
}
public void visit(CommandStatement obj) {
preVisitVisitor(obj);
+ if (deep) {
+ visitNode(obj.getCommand());
+ }
postVisitVisitor(obj);
}
public void visit(CompareCriteria obj) {
@@ -247,6 +253,9 @@
}
public void visit(ExistsCriteria obj) {
preVisitVisitor(obj);
+ if (deep) {
+ visitNode(obj.getCommand());
+ }
postVisitVisitor(obj);
}
public void visit(ExpressionSymbol obj) {
@@ -343,6 +352,9 @@
}
public void visit(LoopStatement obj) {
preVisitVisitor(obj);
+ if (deep) {
+ visitNode(obj.getCommand());
+ }
visitNode(obj.getBlock());
postVisitVisitor(obj);
}
@@ -396,6 +408,9 @@
}
public void visit(ScalarSubquery obj) {
preVisitVisitor(obj);
+ if (deep) {
+ visitNode(obj.getCommand());
+ }
postVisitVisitor(obj);
}
public void visit(SearchedCaseExpression obj) {
@@ -445,16 +460,25 @@
public void visit(SubqueryCompareCriteria obj) {
preVisitVisitor(obj);
visitNode(obj.getLeftExpression());
+ if (deep) {
+ visitNode(obj.getCommand());
+ }
postVisitVisitor(obj);
}
public void visit(SubqueryFromClause obj) {
preVisitVisitor(obj);
+ if (deep) {
+ visitNode(obj.getCommand());
+ }
visitNode(obj.getGroupSymbol());
postVisitVisitor(obj);
}
public void visit(SubquerySetCriteria obj) {
preVisitVisitor(obj);
visitNode(obj.getExpression());
+ if (deep) {
+ visitNode(obj.getCommand());
+ }
postVisitVisitor(obj);
}
public void visit(TranslateCriteria obj) {
@@ -608,8 +632,22 @@
postVisitVisitor(obj);
}
+ @Override
+ public void visit(WithQueryCommand obj) {
+ preVisitVisitor(obj);
+ visitNodes(obj.getColumns());
+ if (deep) {
+ visitNode(obj.getCommand());
+ }
+ postVisitVisitor(obj);
+ }
+
public static void doVisit(LanguageObject object, LanguageVisitor visitor, boolean order) {
- PreOrPostOrderNavigator nav = new PreOrPostOrderNavigator(visitor, order);
+ doVisit(object, visitor, order, false);
+ }
+
+ public static void doVisit(LanguageObject object, LanguageVisitor visitor, boolean order, boolean deep) {
+ PreOrPostOrderNavigator nav = new PreOrPostOrderNavigator(visitor, order, deep);
object.acceptVisitor(nav);
}
Modified: trunk/engine/src/main/java/org/teiid/query/sql/navigator/PreOrderNavigator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/navigator/PreOrderNavigator.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/sql/navigator/PreOrderNavigator.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -32,7 +32,7 @@
public class PreOrderNavigator extends PreOrPostOrderNavigator {
public PreOrderNavigator(LanguageVisitor visitor) {
- super(visitor, PRE_ORDER);
+ super(visitor, PRE_ORDER, false);
}
public static void doVisit(LanguageObject object, LanguageVisitor visitor) {
Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/GroupSymbol.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/GroupSymbol.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/GroupSymbol.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -51,6 +51,8 @@
private boolean isGlobalTable;
private boolean isProcedure;
+ private Object modelMetadataId;
+
private String outputDefinition;
/**
@@ -85,6 +87,14 @@
setDefinition(definition);
}
+ public Object getModelMetadataId() {
+ return modelMetadataId;
+ }
+
+ public void setModelMetadataId(Object modelMetadataId) {
+ this.modelMetadataId = modelMetadataId;
+ }
+
public String getNonCorrelationName() {
if (this.definition == null) {
return this.getName();
@@ -177,7 +187,7 @@
* Return a deep copy of this object.
* @return Deep copy of the object
*/
- public Object clone() {
+ public GroupSymbol clone() {
GroupSymbol copy = new GroupSymbol(getName(), getCanonical(), getDefinition());
if(getMetadataID() != null) {
copy.setMetadataID(getMetadataID());
@@ -187,6 +197,7 @@
copy.setOutputDefinition(this.getOutputDefinition());
copy.setOutputName(this.getOutputName());
copy.isGlobalTable = isGlobalTable;
+ copy.modelMetadataId = modelMetadataId;
return copy;
}
Modified: trunk/engine/src/main/java/org/teiid/query/sql/visitor/AggregateSymbolCollectorVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/visitor/AggregateSymbolCollectorVisitor.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/sql/visitor/AggregateSymbolCollectorVisitor.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -40,7 +40,7 @@
public static class AggregateStopNavigator extends PreOrPostOrderNavigator {
public AggregateStopNavigator(LanguageVisitor visitor) {
- super(visitor, PreOrPostOrderNavigator.POST_ORDER);
+ super(visitor, PreOrPostOrderNavigator.POST_ORDER, false);
}
public void visit(AggregateSymbol obj) {
Modified: trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -79,6 +79,7 @@
import org.teiid.query.sql.lang.TextTable;
import org.teiid.query.sql.lang.UnaryFromClause;
import org.teiid.query.sql.lang.Update;
+import org.teiid.query.sql.lang.WithQueryCommand;
import org.teiid.query.sql.lang.XMLTable;
import org.teiid.query.sql.lang.TextTable.TextColumn;
import org.teiid.query.sql.lang.XMLTable.XMLColumn;
@@ -631,13 +632,7 @@
append(SPACE);
append(BY);
append(SPACE);
- for (Iterator<OrderByItem> iterator = obj.getOrderByItems().iterator(); iterator.hasNext();) {
- OrderByItem item = iterator.next();
- visitNode(item);
- if (iterator.hasNext()) {
- append(", "); //$NON-NLS-1$
- }
- }
+ registerNodes(obj.getOrderByItems(), 0);
}
@Override
@@ -725,9 +720,27 @@
append(" = "); //$NON-NLS-1$
visitNode(obj.getValue());
}
+
+ @Override
+ public void visit(WithQueryCommand obj) {
+ visitNode(obj.getGroupSymbol());
+ append(SPACE);
+ if (obj.getColumns() != null && !obj.getColumns().isEmpty()) {
+ append(Tokens.LPAREN);
+ registerNodes(obj.getColumns(), 0);
+ append(Tokens.RPAREN);
+ append(SPACE);
+ }
+ append(AS);
+ append(SPACE);
+ append(Tokens.LPAREN);
+ visitNode(obj.getCommand());
+ append(Tokens.RPAREN);
+ }
public void visit( Query obj ) {
- addCacheHint(obj.getCacheHint());
+ addCacheHint(obj.getCacheHint());
+ addWithClause(obj);
visitNode(obj.getSelect());
if (obj.getInto() != null) {
@@ -776,6 +789,15 @@
}
}
+ private void addWithClause(QueryCommand obj) {
+ if (obj.getWith() != null && !obj.getWith().isEmpty()) {
+ append(WITH);
+ append(SPACE);
+ registerNodes(obj.getWith(), 0);
+ beginClause(0);
+ }
+ }
+
protected void visitCriteria( String keyWord,
Criteria crit ) {
append(keyWord);
@@ -858,6 +880,7 @@
public void visit( SetQuery obj ) {
addCacheHint(obj.getCacheHint());
+ addWithClause(obj);
QueryCommand query = obj.getLeftQuery();
appendSetQuery(obj, query, false);
Modified: trunk/engine/src/main/java/org/teiid/query/sql/visitor/ValueIteratorProviderCollectorVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/visitor/ValueIteratorProviderCollectorVisitor.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/sql/visitor/ValueIteratorProviderCollectorVisitor.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -34,6 +34,7 @@
import org.teiid.query.sql.lang.SubqueryCompareCriteria;
import org.teiid.query.sql.lang.SubqueryContainer;
import org.teiid.query.sql.lang.SubquerySetCriteria;
+import org.teiid.query.sql.lang.WithQueryCommand;
import org.teiid.query.sql.navigator.PreOrderNavigator;
import org.teiid.query.sql.symbol.ScalarSubquery;
@@ -114,6 +115,11 @@
public void visit(ScalarSubquery obj) {
this.valueIteratorProviders.add(obj);
}
+
+ @Override
+ public void visit(WithQueryCommand obj) {
+ this.valueIteratorProviders.add(obj);
+ }
/**
* Helper to quickly get the ValueIteratorProvider instances from obj
Modified: trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/java/org/teiid/query/tempdata/TempTableStore.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -196,6 +196,13 @@
}
}
+ public void setUpdatable(String name, boolean updatable) {
+ TempTable table = groupToTupleSourceID.get(name);
+ if (table != null) {
+ table.setUpdatable(updatable);
+ }
+ }
+
TempTable getOrCreateTempTable(String tempTableID, Command command, BufferManager buffer, boolean delegate) throws QueryProcessingException{
TempTable tsID = groupToTupleSourceID.get(tempTableID);
if(tsID != null) {
Modified: trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
===================================================================
--- trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj 2010-10-04 21:04:24 UTC (rev 2625)
@@ -1286,8 +1286,8 @@
{
Insert insert = new Insert();
String group = null;
- String element = null;
List values = null;
+ List<ElementSymbol> columns = null;
Option option = null;
QueryCommand query = null;
}
@@ -1295,20 +1295,9 @@
<INSERT> <INTO>
group = id()
- [LOOKAHEAD(<LPAREN><ID>)
- <LPAREN>
- element = id()
- {
- insert.addVariable(new ElementSymbol(element));
- }
- ( <COMMA>
- element = id()
- {
- insert.addVariable(new ElementSymbol(element));
- }
- )*
- <RPAREN>
- ]
+ [LOOKAHEAD(<LPAREN><ID>) columns = columnList(false) {
+ insert.setVariables(columns);
+ }]
(
( <VALUES>
@@ -1340,6 +1329,35 @@
}
}
+List<ElementSymbol> columnList(boolean validate) :
+{
+ String element = null;
+ List<ElementSymbol> symbols = new LinkedList<ElementSymbol>();
+}
+{
+ <LPAREN>
+ element = id()
+ {
+ if (validate) {
+ element = validateElementName(element);
+ }
+ symbols.add(new ElementSymbol(element));
+ }
+ ( <COMMA>
+ element = id()
+ {
+ if (validate) {
+ element = validateElementName(element);
+ }
+ symbols.add(new ElementSymbol(element));
+ }
+ )*
+ <RPAREN>
+ {
+ return symbols;
+ }
+}
+
/**
* Parse row values - this is a comma separated list of values.
* @return List of values, never null
@@ -1446,14 +1464,44 @@
QueryCommand queryExpression(ParseInfo info) :
{
QueryCommand query = null;
+ List<WithQueryCommand> withList = null;
+ WithQueryCommand withQueryCommand = null;
}
{
+ [<WITH> withQueryCommand = withListElement(info)
+ {
+ withList = new LinkedList<WithQueryCommand>();
+ withList.add(withQueryCommand);
+ }
+ ( <COMMA>
+ withQueryCommand = withListElement(info)
+ {
+ withList.add(withQueryCommand);
+ }
+ )*
+ ]
query = queryExpressionBody(info)
{
+ query.setWith(withList);
return query;
}
}
+WithQueryCommand withListElement(ParseInfo info) :
+{
+ String name = null;
+ List<ElementSymbol> columns = null;
+ QueryCommand queryExpression = null;
+}
+{
+ name = id()
+ [ columns = columnList(true)]
+ <AS> <LPAREN> queryExpression = queryExpression(info) <RPAREN>
+ {
+ return new WithQueryCommand(new GroupSymbol(validateAlias(name)), columns, queryExpression);
+ }
+}
+
QueryCommand queryExpressionBody(ParseInfo info) :
{
QueryCommand query = null;
@@ -1506,10 +1554,17 @@
QueryCommand queryPrimary(ParseInfo info) :
{
QueryCommand query = null;
+ String name = null;
}
{
(
query=query(info) |
+ (<TABLE> name=id() {
+ Query q = new Query();
+ q.setSelect(new Select(Arrays.asList(new AllSymbol())));
+ q.setFrom(new From(Arrays.asList(new UnaryFromClause(new GroupSymbol(name)))));
+ query = q;
+ }) |
(<LPAREN> query=queryExpressionBody(info) <RPAREN>)
)
{
Modified: trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -78,6 +78,7 @@
import org.teiid.query.sql.lang.TextTable;
import org.teiid.query.sql.lang.UnaryFromClause;
import org.teiid.query.sql.lang.Update;
+import org.teiid.query.sql.lang.WithQueryCommand;
import org.teiid.query.sql.lang.XMLTable;
import org.teiid.query.sql.lang.SetQuery.Operation;
import org.teiid.query.sql.lang.TextTable.TextColumn;
@@ -6857,5 +6858,21 @@
SearchedCaseExpression sce = new SearchedCaseExpression(Arrays.asList(new NotCriteria(new ExpressionCriteria(new ElementSymbol("x")))), Arrays.asList(new ElementSymbol("y")));
helpTestExpression("case when not x then y end", "CASE WHEN NOT (x) THEN y END", sce);
}
+
+ @Test public void testWithClause() throws Exception {
+ Query query = getOrderByQuery(null);
+ query.setWith(Arrays.asList(new WithQueryCommand(new GroupSymbol("x"), null, getOrderByQuery(null))));
+ helpTest("WITH x AS (SELECT a FROM db.g WHERE b = aString) SELECT a FROM db.g WHERE b = aString", "WITH x AS (SELECT a FROM db.g WHERE b = aString) SELECT a FROM db.g WHERE b = aString", query); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Test public void testExplicitTable() throws Exception {
+ Query query = new Query();
+ Select select = new Select();
+ query.setSelect(select);
+ select.addSymbol(new AllSymbol());
+ From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("X"))));
+ query.setFrom(from);
+ helpTest("TABLE X", "SELECT * FROM X", query);
+ }
}
Added: trunk/engine/src/test/java/org/teiid/query/processor/TestWithClauseProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestWithClauseProcessing.java (rev 0)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestWithClauseProcessing.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -0,0 +1,73 @@
+package org.teiid.query.processor;
+
+import static org.teiid.query.processor.TestProcessor.*;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.Test;
+import org.teiid.core.TeiidException;
+import org.teiid.query.optimizer.TestOptimizer;
+import org.teiid.query.optimizer.TestOptimizer.ComparisonMode;
+import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
+import org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder;
+import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
+import org.teiid.query.unittest.FakeMetadataFactory;
+
+@SuppressWarnings({"nls", "unchecked"})
+public class TestWithClauseProcessing {
+
+ @Test public void testSingleItem() {
+ String sql = "with a (x, y, z) as (select e1, e2, e3 from pm1.g1) SELECT pm1.g2.e2, a.x from pm1.g2, a where e1 = x and z = 1 order by x"; //$NON-NLS-1$
+
+ List[] expected = new List[] {
+ Arrays.asList(0, "a"),
+ Arrays.asList(3, "a"),
+ Arrays.asList(0, "a"),
+ Arrays.asList(1, "c"),
+ };
+
+ FakeDataManager dataManager = new FakeDataManager();
+ sampleData1(dataManager);
+
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+
+ helpProcess(plan, dataManager, expected);
+ }
+
+ @Test public void testMultipleItems() {
+ String sql = "with a (x, y, z) as (select e1, e2, e3 from pm1.g1), b as (SELECT * from pm1.g2, a where e1 = x and z = 1 order by e2 limit 2) SELECT a.x, b.e1 from a, b where a.x = b.e1"; //$NON-NLS-1$
+
+ List[] expected = new List[] {
+ Arrays.asList("a", "a"),
+ Arrays.asList("a", "a"),
+ Arrays.asList("a", "a"),
+ Arrays.asList("a", "a"),
+ Arrays.asList("a", "a"),
+ Arrays.asList("a", "a"),
+ };
+
+ FakeDataManager dataManager = new FakeDataManager();
+ sampleData1(dataManager);
+
+ ProcessorPlan plan = helpGetPlan(helpParse(sql), FakeMetadataFactory.example1Cached());
+
+ helpProcess(plan, dataManager, expected);
+ }
+
+ @Test public void testWithPushdown() throws TeiidException {
+ FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
+ BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
+ caps.setCapabilitySupport(Capability.COMMON_TABLE_EXPRESSIONS, true);
+ caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_SELFJOIN, true);
+ capFinder.addCapabilities("pm1", caps); //$NON-NLS-1$
+
+ String sql = "with a (x, y, z) as (select e1, e2, e3 from pm1.g1) SELECT a.x from a, a z"; //$NON-NLS-1$
+
+ FakeDataManager dataManager = new FakeDataManager();
+ sampleData1(dataManager);
+
+ TestOptimizer.helpPlan(sql, FakeMetadataFactory.example1Cached(), null, capFinder, new String[] {"WITH a (x, y, z) AS (SELECT g_0.e1, g_0.e2, g_0.e3 FROM pm1.g1 AS g_0) SELECT g_0.x FROM a AS g_0, a AS g_1"}, ComparisonMode.EXACT_COMMAND_STRING);
+ }
+
+}
Property changes on: trunk/engine/src/test/java/org/teiid/query/processor/TestWithClauseProcessing.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java 2010-10-04 19:26:58 UTC (rev 2624)
+++ trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java 2010-10-04 21:04:24 UTC (rev 2625)
@@ -3042,4 +3042,16 @@
assertEquals("A.ret", resolvedQuery.getProjectedSymbols().get(0).getName());
}
+ @Test public void testWithDuplidateName() {
+ helpResolveException("with x as (TABLE pm1.g1), x as (TABLE pm1.g2) SELECT * from x");
+ }
+
+ @Test public void testWithColumns() {
+ helpResolveException("with x (a, b) as (TABLE pm1.g1) SELECT * from x");
+ }
+
+ @Test public void testWithNameMatchesFrom() {
+ helpResolve("with x as (TABLE pm1.g1) SELECT * from (TABLE x) x");
+ }
+
}
\ No newline at end of file
14 years, 3 months
teiid SVN: r2624 - in branches/7.1.x/engine/src: test/java/org/teiid/query/processor and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-10-04 15:26:58 -0400 (Mon, 04 Oct 2010)
New Revision: 2624
Modified:
branches/7.1.x/engine/src/main/java/org/teiid/query/processor/BatchIterator.java
branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestBatchIterator.java
Log:
TEIID-1289 fixing hasnext handling with marking
Modified: branches/7.1.x/engine/src/main/java/org/teiid/query/processor/BatchIterator.java
===================================================================
--- branches/7.1.x/engine/src/main/java/org/teiid/query/processor/BatchIterator.java 2010-10-04 14:48:14 UTC (rev 2623)
+++ branches/7.1.x/engine/src/main/java/org/teiid/query/processor/BatchIterator.java 2010-10-04 19:26:58 UTC (rev 2624)
@@ -29,6 +29,7 @@
import org.teiid.common.buffer.TupleBatch;
import org.teiid.common.buffer.TupleBuffer;
import org.teiid.core.TeiidComponentException;
+import org.teiid.core.TeiidException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.query.processor.BatchCollector.BatchProducer;
@@ -79,7 +80,7 @@
protected List<?> getCurrentTuple() throws TeiidComponentException,
BlockedException, TeiidProcessingException {
List<?> tuple = super.getCurrentTuple();
- if (mark && saveOnMark && this.getCurrentIndex() > this.buffer.getRowCount()) {
+ if (tuple != null && mark && saveOnMark && this.getCurrentIndex() > this.buffer.getRowCount()) {
this.buffer.setRowCount(this.getCurrentIndex() - 1);
this.buffer.addTuple(tuple);
}
@@ -122,14 +123,20 @@
this.buffer.purge();
}
mark = true;
+ if (saveOnMark) {
+ try {
+ getCurrentTuple();
+ } catch (TeiidException e) {
+ }
+ }
}
@Override
public void setPosition(int position) {
- super.setPosition(position);
if (this.buffer == null && position < getCurrentIndex() && position < (this.batch != null ? batch.getBeginRow() : Integer.MAX_VALUE)) {
throw new UnsupportedOperationException("Backwards positioning is not allowed"); //$NON-NLS-1$
}
+ super.setPosition(position);
}
}
Modified: branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestBatchIterator.java
===================================================================
--- branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestBatchIterator.java 2010-10-04 14:48:14 UTC (rev 2623)
+++ branches/7.1.x/engine/src/test/java/org/teiid/query/processor/TestBatchIterator.java 2010-10-04 19:26:58 UTC (rev 2624)
@@ -72,4 +72,23 @@
assertEquals(2, bi.nextTuple().get(0));
}
+ @Test public void testReset2() throws Exception {
+ BatchIterator bi = new BatchIterator(new FakeRelationalNode(1, new List[] {
+ Arrays.asList(1),
+ Arrays.asList(2),
+ }, 2));
+ BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
+ TupleBuffer tb = bm.createTupleBuffer(Arrays.asList(new ElementSymbol("x")), "test", TupleSourceType.PROCESSOR);
+ bi.setBuffer(tb, true); //$NON-NLS-1$
+ bi.hasNext();
+ bi.mark();
+ bi.nextTuple();
+ bi.nextTuple();
+ assertNull(bi.nextTuple());
+ bi.reset();
+ bi.hasNext();
+ assertEquals(1, bi.getCurrentIndex());
+ assertEquals(1, bi.nextTuple().get(0));
+ }
+
}
14 years, 3 months
teiid SVN: r2623 - branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-10-04 10:48:14 -0400 (Mon, 04 Oct 2010)
New Revision: 2623
Modified:
branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/appendix-b.xml
Log:
TEIID-1285 TEIID-1286 updating the developer's guide and fixing a broken link
Modified: branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/appendix-b.xml
===================================================================
--- branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/appendix-b.xml 2010-10-04 14:46:41 UTC (rev 2622)
+++ branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/appendix-b.xml 2010-10-04 14:48:14 UTC (rev 2623)
@@ -1,23 +1,42 @@
<appendix id="advanced_topics">
<title>Advanced Topics</title>
<section>
- <title>Security Migration From Previous Versions</title>
- <para>It is recommended that customers who have utilized the internal JDBC membership domain from releases
- prior to MetaMatrix 5.5 migrate those users and groups to an LDAP compliant directory server. Several free
- and open source directory servers can be used including:</para>
- <para>
- The Fedora Directory Server
- <ulink url="http://directory.fedoraproject.org/">http://directory.fedoraproject.org/</ulink>
- </para>
- <para>
- Open LDAP
- <ulink url="http://www.openldap.org/">http://www.openldap.org/</ulink>
- </para>
- <para>
- Apache Directory Server
- <ulink url="http://directory.apache.org/">http://directory.apache.org/</ulink>
- </para>
- <para>See the JBossAS security documentation for using an LDAP directory server. If there are additional questions or the need for guidance in the migration process, please contact
- technical support.</para>
+ <title>Security Migration From Previous Versions</title>
+ <para>
+ It is recommended that customers who have utilized the internal JDBC membership
+ domain from releases prior to MetaMatrix 5.5 migrate those users and groups to
+ an LDAP compliant directory server.
+ </para>
+ <para>
+ Refer to the JBoss Application Server security documentation for using
+ an LDAP directory server. If there are additional questions or the need
+ for guidance in the migration process, please contact technical support.
+ </para>
+
+
+ <para>
+ Several free and open source directory servers include:
+ </para>
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ The Fedora Directory Server - <ulink url="http://directory.fedoraproject.org/"/>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Open LDAP - <ulink url="http://www.openldap.org/"/>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Apache Directory Server - <ulink url="http://directory.apache.org/"/>
+ </para>
+ </listitem>
+ </itemizedlist>
+
+
</section>
+
</appendix>
\ No newline at end of file
14 years, 3 months
teiid SVN: r2622 - in branches/7.1.x/documentation/developer-guide: src/main/docbook/en-US and 1 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-10-04 10:46:41 -0400 (Mon, 04 Oct 2010)
New Revision: 2622
Added:
branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/Book_Info.xml
branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/Developer_Guide.xml
Removed:
branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/main.xml
Modified:
branches/7.1.x/documentation/developer-guide/pom.xml
branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/appendix-a.xml
branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/develop-adapter.xml
branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/extending-jdbc.xml
branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/introduction.xml
branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/logging.xml
branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/security.xml
branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml
branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/udf.xml
Log:
TEIID-1285 TEIID-1286 updating the developer's guide and fixing a broken link
Modified: branches/7.1.x/documentation/developer-guide/pom.xml
===================================================================
--- branches/7.1.x/documentation/developer-guide/pom.xml 2010-10-01 15:43:39 UTC (rev 2621)
+++ branches/7.1.x/documentation/developer-guide/pom.xml 2010-10-04 14:46:41 UTC (rev 2622)
@@ -36,7 +36,7 @@
</dependency>
</dependencies>
<configuration>
- <sourceDocumentName>main.xml</sourceDocumentName>
+ <sourceDocumentName>Developer_Guide.xml</sourceDocumentName>
<imageResource>
<directory>${basedir}/src/main/docbook/en-US</directory>
<excludes>
Added: branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/Book_Info.xml
===================================================================
--- branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/Book_Info.xml (rev 0)
+++ branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/Book_Info.xml 2010-10-04 14:46:41 UTC (rev 2622)
@@ -0,0 +1,37 @@
+<?xml version="1.0" ?>
+<!DOCTYPE bookinfo PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN' 'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd' [
+<!ENTITY % CustomDTD SYSTEM "../../../../../docbook/custom.dtd">
+%CustomDTD;
+]>
+
+<bookinfo>
+ <title>Teiid - Scalable Information Integration</title>
+ <subtitle>Teiid Developer's Guide</subtitle>
+ <releaseinfo>&versionNumber;</releaseinfo>
+ <productnumber>&versionNumber;</productnumber>
+ <issuenum>1</issuenum>
+
+ <abstract>
+ <para>
+ This guide contains information for developers creating custom solutions
+ with Teiid. It covers creating JEE JCA connectors with the Teiid framework,
+ Teiid Translators, Teiid User Defined Functions (UDFs) as well as related topics.
+ </para>
+ </abstract>
+
+ <corpauthor>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="Common_Content/images/title_logo.svg"/>
+ </imageobject>
+ </inlinemediaobject>
+ </corpauthor>
+
+ <copyright>
+ <year>©rightYear;</year>
+ <holder>©rightHolder;</holder>
+ </copyright>
+
+ <xi:include href="../../../../../docbook/en-US/legal_notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+</bookinfo>
Property changes on: branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/Book_Info.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/Developer_Guide.xml
===================================================================
--- branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/Developer_Guide.xml (rev 0)
+++ branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/Developer_Guide.xml 2010-10-04 14:46:41 UTC (rev 2622)
@@ -0,0 +1,23 @@
+<?xml version='1.0'?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % CustomDTD SYSTEM "../../../../../docbook/custom.dtd">
+%CustomDTD;
+]>
+
+<book>
+ <xi:include href="Book_Info.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <xi:include href="content/introduction.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/develop-adapter.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/translator-api.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/extending-jdbc.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/udf.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/adminapi.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/logging.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/security.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/appendix-a.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/appendix-b.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+
+</book>
+
Property changes on: branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/Developer_Guide.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/appendix-a.xml
===================================================================
--- branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/appendix-a.xml 2010-10-01 15:43:39 UTC (rev 2621)
+++ branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/appendix-a.xml 2010-10-04 14:46:41 UTC (rev 2622)
@@ -2,56 +2,70 @@
<title>ra.xml file Template</title>
<para> This appendix contains an example of the ra.xml file that can be used as a template
when creating a new Connector.</para>
- <programlisting><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-
+ <programlisting role="XML" language="XML"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<connector xmlns="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
- http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
- version="1.5">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd" version="1.5">
<vendor-name>${comapany-name}</vendor-name>
<eis-type>${type-of-connector}</eis-type>
<resourceadapter-version>1.0</resourceadapter-version>
<license>
- <description>
- ${license text}
- </description>
+ <description>${license text}</description>
<license-required>true</license-required>
</license>
+
<resourceadapter>
<resourceadapter-class>org.teiid.resource.spi.BasicResourceAdapter</resourceadapter-class>
-
<outbound-resourceadapter>
<connection-definition>
- <managedconnectionfactory-class>${connection-factory-class}</managedconnectionfactory-class>
+ <managedconnectionfactory-class>${connection-factory}</managedconnectionfactory-class>
<!-- repeat for every configuration property -->
<config-property>
- <description>{$display:"${short-name}",$description:"${description}", $allowed:[${value-list}], $required:"${required-boolean}", $defaultValue:"${default-value}"}</description>
- <config-property-name>${property-name}</config-property-name>
- <config-property-type>${property-type}</config-property-type>
- <config-property-value>${optional-property-value}</config-property-value>
+ <description>
+ {$display:"${short-name}",$description:"${description}",$allowed:[${value-list}],
+ $required:"${required-boolean}", $defaultValue:"${default-value}"}
+ </description>
+ <config-property-name>${property-name}</config-property-name>
+ <config-property-type>${property-type}</config-property-type>
+ <config-property-value>${optional-property-value}</config-property-value>
</config-property>
-
+
<!-- use the below as is if you used the Connection Factory interface -->
-
- <connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface>
- <connectionfactory-impl-class>org.teiid.resource.spi.WrappedConnectionFactory</connectionfactory-impl-class>
- <connection-interface>javax.resource.cci.Connection</connection-interface>
- <connection-impl-class>org.teiid.resource.spi.WrappedConnection</connection-impl-class>
+ <connectionfactory-interface>
+ javax.resource.cci.ConnectionFactory
+ </connectionfactory-interface>
+ <connectionfactory-impl-class>
+ org.teiid.resource.spi.WrappedConnectionFactory
+ </connectionfactory-impl-class>
+
+ <connection-interface>
+ javax.resource.cci.Connection
+ </connection-interface>
+
+ <connection-impl-class>
+ org.teiid.resource.spi.WrappedConnection
+ </connection-impl-class>
+
</connection-definition>
-
+
<transaction-support>NoTransaction</transaction-support>
-
- <authentication-mechanism>
+
+ <authentication-mechanism>
<authentication-mechanism-type>BasicPassword</authentication-mechanism-type>
- <credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface>
- </authentication-mechanism>
- <reauthentication-support>false</reauthentication-support>
+ <credential-interface>
+ javax.resource.spi.security.PasswordCredential
+ </credential-interface>
+ </authentication-mechanism>
+ <reauthentication-support>false</reauthentication-support>
+
</outbound-resourceadapter>
+
</resourceadapter>
+
</connector>]]></programlisting>
<para>${...} indicates a value to be supplied by the developer.</para>
-</appendix>
\ No newline at end of file
+</appendix>
Modified: branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/develop-adapter.xml
===================================================================
--- branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/develop-adapter.xml 2010-10-01 15:43:39 UTC (rev 2621)
+++ branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/develop-adapter.xml 2010-10-04 14:46:41 UTC (rev 2622)
@@ -10,11 +10,11 @@
developers, we provided a base implementation framework.
If you already have a JCA Connector or some other mechanism to get data from your source system, you can skip this chapter.</para>
- <para>If you are not familiar with JCA API, please read the <ulink url="http://java.sun.com/j2ee/connector/">JCA 1.5 Specification</ulink>.
+ <para>If you are not familiar with JCA API, please read the JCA 1.5 Specification at <ulink url="http://java.sun.com/j2ee/connector/"/>.
There are lot of online tutorials on how to design and build a JCA Connector. The below we show you to build very simple connector,
however building actual connector that supports transactions, security can get much more complex.</para>
- <para>Check out the following links <ulink url="http://docs.jboss.org/jbossas/jboss4guide/r4/html/ch7.chapt.html">Connectors on JBoss</ulink> </para>
+ <para>Refer to the JBoss Application Server Connectors documentation at <ulink url="http://docs.jboss.org/jbossas/jboss4guide/r4/html/ch7.chapt.html"/>.</para>
<section>
<title>Using the Teiid Framework</title>
@@ -45,46 +45,44 @@
attribute for each configuration variable, and then provide both "getter" and "setter" methods for them.
Note to use only "java.lang" objects as the attributes, DO NOT use Java primitives for defining and accessing the properties.
See the following code for an example.</para>
- <programlisting><![CDATA[public class MyManagedConnectionFactory extends BasicManagedConnectionFactory {
- @Override
- public Object createConnectionFactory() throws ResourceException {
- return new MyConnectionFactory();
- }
-
- // config property name (metadata for these are defined inside the ra.xml)
- String userName;
- public String getUserName() {
- return this.userName;
- }
- public void setUserName(String name) {
- this.userName = name;
- }
-
- // config property count (metadata for these are defined inside the ra.xml)
- Integer count;
- public Integer getCount() {
- return this.count;
- }
- public void setCount(Integer value) {
- this.count = value;
- }
+ <programlisting language="Java" role="JAVA"><![CDATA[public class MyManagedConnectionFactory extends BasicManagedConnectionFactory
+{
+ @Override
+ public Object createConnectionFactory() throws ResourceException
+ {
+ return new MyConnectionFactory();
+ }
+
+ // config property name (metadata for these are defined inside the ra.xml)
+ String userName;
+ public String getUserName() { return this.userName; }
+ public void setUserName(String name){ this.userName = name; }
+
+ // config property count (metadata for these are defined inside the ra.xml)
+ Integer count;
+ public Integer getCount() { return this.count; }
+ public void setCount(Integer value) { this.count = value; }
+
}]]></programlisting>
</section>
<section>
<title>Define the Connection Factory class</title>
<para>Extend the <code>BasicConnectionFactory</code> class, and provide a implementation for the "getConnection()" method.</para>
- <programlisting><![CDATA[public class MyConnectionFactory extends BasicConnectionFactory {
- @Override
- public MyConnection getConnection() throws ResourceException {
- return new MyConnection();
- }
+ <programlisting language="Java" role="JAVA"><![CDATA[public class MyConnectionFactory extends BasicConnectionFactory
+{
+ @Override
+ public MyConnection getConnection() throws ResourceException
+ {
+ return new MyConnection();
+ }
}]]></programlisting>
<para>Since the Managed connection object created the "ConnectionFactory" class it has access to all the configuration
parameters, if "getConnection" method needs to do pass any of credentials to the underlying EIS system.
The Connection Factory class can also get reference to the calling user's <code>javax.security.auth.Subject</code> during
"getConnection" method by calling
-
- <programlisting><![CDATA[Subject subject = ConnectionContext.getSubject();]]></programlisting>
+ </para>
+ <programlisting language="Java" role="JAVA"><![CDATA[Subject subject = ConnectionContext.getSubject();]]></programlisting>
+ <para>
This "Subject" object can give access to logged-in user's credentials and roles that are defined. Note that this may be null.
</para>
<para>Note that you can define "security-domain" for this resource adapter, that is separate from
@@ -98,29 +96,34 @@
of the Connection object in the Translator. If your
connection is stateful, then override "isAlive()" and "cleanup()" methods and provide proper implementations. These are called
to check if a Connection is stale or need to flush them from the connection pool etc. by the Container.</para>
- <programlisting><![CDATA[public class MyConnection extends BasicConnection {
-
- public void doSomeOperation(command){
- // do some operation with EIS system..
- // This is method you use in the Translator, you should know
- // what need to be done here for your source..
- }
+ <programlisting language="Java" role="JAVA"><![CDATA[public class MyConnection extends BasicConnection
+{
+ public void doSomeOperation(command)
+ {
+ // do some operation with EIS system..
+ // This is method you use in the Translator, you should know
+ // what need to be done here for your source..
+ }
- @Override
- public boolean isAlive() {
- return true;
- }
- @Override
- public void cleanUp() {
+ @Override
+ public boolean isAlive()
+ {
+ return true;
+ }
+
+ @Override
+ public void cleanUp()
+ {
- }
+ }
}]]></programlisting>
</section>
<section>
<title>XA Transactions</title>
- <para>If you EIS source can participate in XA transactions, then on your <link linkend="connection">Connection</link> object,
- override the "getXAResource()" method and provide the "XAResource" object for the EIS system.
+ <para>If your EIS source can participate in XA transactions, then on your Connection object,
+ override the "getXAResource()" method and provide the "XAResource" object for the EIS system.
+ Refer to <xref linkend="connection"/>.
Also, You need to extend the "BasicResourceAdapter" class and provide implementation for method
"public XAResource[] getXAResources(ActivationSpec[] specs)" to participate in crash recovery. </para>
@@ -131,17 +134,26 @@
<section>
<title>Define the configuration properties in a "ra.xml" file</title>
- <para>Define a "ra.xml" file (sample shown in the <link linkend="appendix_a">appendix-a</link>) in "META-INF" directory of your RAR file.
- For every configuration property defined inside the <link linkend="managed_connection_factory">ManagedConnectionFactory</link>
+ <para>
+ Define a "ra.xml" file in "META-INF" directory of your RAR file.
+ An example file is provided in <xref linkend="appendix_a"/>.
+ </para>
+ <para>
+ For every configuration property defined inside the ManagedConnectionFactory
class, define the following XML configuration
fragment inside the "ra.xml" file. These properties are used by user to configure instance of this Connector inside a
Container. Also, during the startup the Container reads these properties from this file and knows how to inject
- provided values in the "-ds.xml" file into a instance of "ManagedConnectionFactory" to create the Connection.</para>
- <programlisting><![CDATA[<config-property>
- <description>{$display:"${display-name}",$description:"${description}", $allowed="${allowed}", $required="${true|false}", $defaultValue="${default-value}"}</description>
- <config-property-name>${property-name}</config-property-name>
- <config-property-type>${property-type}</config-property-type>
- <config-property-value>${optioal-property-value}</config-property-value>
+ provided values in the "-ds.xml" file into a instance of "ManagedConnectionFactory" to create the Connection.
+ Refer to <xref linkend="managed_connection_factory"/>.
+ </para>
+ <programlisting role="XML" language="XML"><![CDATA[<config-property>
+ <description>
+ {$display:"${display-name}",$description:"${description}", $allowed="${allowed}",
+ $required="${true|false}", $defaultValue="${default-value}"}
+ </description>
+ <config-property-name>${property-name}</config-property-name>
+ <config-property-type>${property-type}</config-property-type>
+ <config-property-value>${optioal-property-value}</config-property-value>
</config-property>]]></programlisting>
<para>The format and contents of "<description>" element may be used as extended metadata for tooling. The special format must begin and end with curly braces e.g. {...}. This use of the special format and all properties is optional. Property names begin with '$' and are separated from the value with ':'. Double quotes identifies a single value. A pair of square brackets, e.g. [...], containing comma separated double quoted entries denotes a list value.
@@ -193,37 +205,39 @@
<para>Maven: If you are using maven, use <packaging> element value as "rar". Teiid uses maven, you can look at any of
the "connector" projects for sample "pom.xml" file. Here is sample pom.xml file.</para>
- <programlisting><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <artifactId>connector-{name}</artifactId>
- <groupId>org.company.project</groupId>
- <name>Name Connector</name>
- <packaging>rar</packaging>
- <description>This connector is a sample</description>
+ <programlisting role="XML" language="XML"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>connector-{name}</artifactId>
+ <groupId>org.company.project</groupId>
+ <name>Name Connector</name>
+ <packaging>rar</packaging>
+ <description>This connector is a sample</description>
- <dependencies>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.teiid</groupId>
- <artifactId>teiid-common-core</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.teiid</groupId>
+ <artifactId>teiid-common-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
</project>]]></programlisting>
</listitem>
</itemizedlist>
<para>Make sure that the RAR file, under its "META-INF" directory has the "ra.xml" file. If you are using maven
- see <ulink url="http://maven.apache.org/plugins/maven-rar-plugin/"></ulink>In the root of the RAR file,
+ refer to <ulink url="http://maven.apache.org/plugins/maven-rar-plugin/"/>. In the root of the RAR file,
you can embed the JAR file containing your connector code and any dependent library JAR files. </para>
</section>
@@ -239,25 +253,29 @@
<itemizedlist>
<listitem>
- <para>Create "${name}-ds.xml" file, and copy it into "deploy" directory of JBoss AS.
- <programlisting><![CDATA[<!DOCTYPE connection-factories PUBLIC
- "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
- "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
+ <para>
+ Create "${name}-ds.xml" file, and copy it into "deploy" directory of JBoss AS.
+ </para>
+ <programlisting language="XML" role="XML"><![CDATA[<!DOCTYPE connection-factories PUBLIC
+ "-//JBoss//DTD JBOSS JCA Config 1.5//EN" "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
<connection-factories>
- <no-tx-connection-factory>
- <jndi-name>${jndi-name}</jndi-name>
- <rar-name>${name}.rar</rar-name>
- <connection-definition>javax.resource.cci.ConnectionFactory</connection-definition>
-
- <!-- define all the properties defined in the "ra.xml" that required or needs to be modified from defaults -->
- <!-- each property is defined in single element -->
- <config-property name="prop-name" type="java.lang.String">prop-value</config-property>
-
- </no-tx-connection-factory>
+ <no-tx-connection-factory>
+ <jndi-name>${jndi-name}</jndi-name>
+ <rar-name>${name}.rar</rar-name>
+ <connection-definition>javax.resource.cci.ConnectionFactory</connection-definition>
+
+ <!--
+ define all the properties defined in the "ra.xml" that required or needs to be
+ modified from defaults each property is defined in single element
+ -->
+ <config-property name="prop-name" type="java.lang.String">prop-value</config-property>
+
+</no-tx-connection-factory>
</connection-factories>]]></programlisting>
- There are lot more properties that you can define for pooling, transactions, security etc in this file.
- Check JBoss AS documentation for all the avaialble properties.
+ <para>
+ There are lot more properties that you can define for pooling, transactions, security etc in this file.
+ Check JBoss AS documentation for all the avaialble properties.
</para>
</listitem>
<listitem>
Modified: branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/extending-jdbc.xml
===================================================================
--- branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/extending-jdbc.xml 2010-10-01 15:43:39 UTC (rev 2621)
+++ branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/extending-jdbc.xml 2010-10-04 14:46:41 UTC (rev 2622)
@@ -40,7 +40,7 @@
<section>
<title>Capabilities Extension</title>
<para>This extension must override the methods that begin with "supports" that describe translator capabilities.
- For all the available translator capabilities please see <link linkend="translator_capabilities">this</link>.</para>
+ Refer to <xref linkend="translator_capabilities"/> for all the available translator capabilities.</para>
<para>The most common example is adding
support for a scalar function – this requires both declaring that the translator has the capability
@@ -59,15 +59,20 @@
<para>Change basic SQL syntax options. See the useXXX methods, e.g. useSelectLimit returns true for SQLServer to indicate that limits are applied in the SELECT clause.</para>
</listitem>
<listitem>
- <para>Register one or more <link linkend="function_modifiers">FunctionModifiers</link> that define how a scalar function should be modified or transformed.</para>
+ <para>Register one or more FunctionModifiers that define how a scalar function should be modified or transformed.</para>
</listitem>
<listitem>
- <para>Modify a LanguageObject. - see the translate, translateXXX, and <link linkend="function_modifiers">FunctionModifiers</link>.translate methods. Modify the passed in object and return null to indicate that the standard syntax output should be used.</para>
+ <para>Modify a LanguageObject. - see the translate, translateXXX, and FunctionModifiers.translate methods. Modify the passed in object and return null to indicate that the standard syntax output should be used.</para>
</listitem>
<listitem>
- <para>Change the way SQL strings are formed for a LanguageObject. - - see the translate, translateXXX, and <link linkend="function_modifiers">FunctionModifiers</link>.translate methods. Return a list of parts, which can contain strings and LanguageObjects, that will be appended in order to the SQL string. If the in coming LanguageObject appears in the returned list it will not be translated again.</para>
+ <para>Change the way SQL strings are formed for a LanguageObject. - - see the translate, translateXXX, and FunctionModifiers.translate methods. Return a list of parts, which can contain strings and LanguageObjects, that will be appended in order to the SQL string. If the in coming LanguageObject appears in the returned list it will not be translated again.</para>
</listitem>
</itemizedlist>
+
+ <para>
+ Refer to <xref linkend="function_modifiers"/>.
+ </para>
+
</section>
<section>
@@ -86,7 +91,7 @@
<section>
<title>Adding Function Support</title>
- <para>See <link linkend="udfs">User Defined Functions</link> for adding new functions to Teiid. This example will show you how to declare support for the function
+ <para>Refer to <xref linkend="udfs"/> for adding new functions to Teiid. This example will show you how to declare support for the function
and modify how the function is passed to the data source.</para>
<para>Following is a summary of all coding steps in supporting a new scalar function:</para>
<orderedlist>
@@ -99,25 +104,27 @@
</orderedlist>
<para>There is a capabilities method getSupportedFunctions() that declares all supported scalar functions.</para>
<informalexample>
- <para>An example of an extended capabilities class to add support for the “abs” absolute value function:</para>
- <programlisting><![CDATA[package my.connector;
-
+ <para>An example of an extended capabilities class to add support for the "abs" absolute value function:</para>
+ <programlisting language="Java" role="JAVA"><![CDATA[package my.connector;
+
import java.util.ArrayList;
import java.util.List;
-public class ExtendedJDBCExecutionFactory extends JDBCExecutionFactory {
- @Override
- public List getSupportedFunctions() {
- List supportedFunctions = new ArrayList();
- supportedFunctions.addAll(super.getSupportedFunctions());
- supportedFunctions.add("ABS");
- return supportedFunctions;
- }
+public class ExtendedJDBCExecutionFactory extends JDBCExecutionFactory
+{
+ @Override
+ public List getSupportedFunctions()
+ {
+ List supportedFunctions = new ArrayList();
+ supportedFunctions.addAll(super.getSupportedFunctions());
+ supportedFunctions.add("ABS");
+ return supportedFunctions;
+ }
}]]></programlisting></informalexample>
<para>In general, it is a good idea to call super.getSupportedFunctions() to ensure that you retain any function
support provided by the translator you are extending.</para>
<para>This may be all that is needed to support a Teiid function if the JDBC data source supports the
- same syntax as Teiid. The built-in SQL translation will translate most functions as: “function(arg1, arg2, …)”.</para>
+ same syntax as Teiid. The built-in SQL translation will translate most functions as: "function(arg1, arg2, …)".</para>
<section id="function_modifiers">
<title>Using FunctionModifiers</title>
<para>In some cases you may need to translate the function differently or even insert
@@ -129,18 +136,19 @@
<informalexample>
<para>An example of overriding the translate method to change the MOD(a, b) function into an infix operator for Sybase (a % b). The translate method returns a list of strings and language objects that will be assembled by the translator into a final string. The strings will be used as is and the language objects will be further processed by the translator.</para>
- <programlisting><![CDATA[public class ModFunctionModifier implements FunctionModifier {
-
- public List translate(Function function) {
- List parts = new ArrayList();
- parts.add("(");
- Expression[] args = function.getParameters();
- parts.add(args[0]);
- parts.add(" % ");
- parts.add(args[1]);
- parts.add(")");
- return parts;
- }
+ <programlisting language="Java" role="JAVA"><![CDATA[public class ModFunctionModifier implements FunctionModifier
+{
+ public List translate(Function function)
+ {
+ List parts = new ArrayList();
+ parts.add("(");
+ Expression[] args = function.getParameters();
+ parts.add(args[0]);
+ parts.add(" % ");
+ parts.add(args[1]);
+ parts.add(")");
+ return parts;
+ }
}]]></programlisting>
</informalexample>
@@ -150,8 +158,8 @@
<table frame='all'>
<title>Common Modifiers</title>
<tgroup cols='2' align='left' colsep='1' rowsep='1'>
- <colspec colname='c1' colwidth=".4*"/>
- <colspec colname='c2' colwidth="1*"/>
+ <colspec colname='c1' colwidth="2*"/>
+ <colspec colname='c2' colwidth="5*"/>
<thead>
<row>
<entry><para>Modifier</para></entry>
@@ -161,7 +169,7 @@
<tbody>
<row>
<entry><para>AliasModifier</para></entry>
- <entry><para>Handles simply renaming a function (“ucase” to “upper” for example)</para></entry>
+ <entry><para>Handles simply renaming a function ("ucase" to "upper" for example)</para></entry>
</row>
<row>
<entry><para>EscapeSyntaxModifier</para></entry>
@@ -172,18 +180,20 @@
</table>
<para>To register the function modifiers for your supported functions,
you must call the <code>ExecutionFactory.registerFunctionModifier(String name, FunctionModifier modifier)</code> method.
- <programlisting><![CDATA[public class ExtendedJDBCExecutionFactory extends JDBCExecutionFactory
-
- @Override
- public void start() {
- super.start();
-
- // register functions.
- registerFunctionModifier("abs", new MyAbsModifier());
- registerFunctionModifier("concat", new AliasModifier(“concat2”));
- }
-}]]></programlisting></para>
- <para>Support for the two functions being registered (“abs” and “concat”) must be declared
+ </para>
+ <programlisting language="Java" role="JAVA"><![CDATA[public class ExtendedJDBCExecutionFactory extends JDBCExecutionFactory
+{
+ @Override
+ public void start()
+ {
+ super.start();
+
+ // register functions.
+ registerFunctionModifier("abs", new MyAbsModifier());
+ registerFunctionModifier("concat", new AliasModifier("concat2"));
+ }
+}]]></programlisting>
+ <para>Support for the two functions being registered ("abs" and "concat") must be declared
in the capabilities as well. Functions that do not have modifiers registered will be translated as usual.
</para>
</section>
@@ -192,10 +202,13 @@
<section>
<title>Installing Extensions</title>
<para>Once you have developed an extension to the JDBC translator, you must install it into the Teiid Server.
- The process of <link linkend="translator_package">packaging</link> or <link linkend="translator_deploy">deploying</link> the
+ The process of packaging or deploying the
extended JDBC translators is exactly as any other other translator. Since the RDMS is accessible already through its JDBC
driver, there is no need to develop a resource adapter for this source as JBoss AS provides a wrapper JCA connector (DataSource)
for any JDBC driver.
</para>
+ <para>
+ Refer to <xref linkend="translator_package"/> and <xref linkend="translator_deploy"/> for more details.
+ </para>
</section>
</chapter>
Modified: branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/introduction.xml
===================================================================
--- branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/introduction.xml 2010-10-01 15:43:39 UTC (rev 2621)
+++ branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/introduction.xml 2010-10-04 14:46:41 UTC (rev 2622)
@@ -8,7 +8,7 @@
<section>
<title>Introduction to the Teiid Connector Architecture</title>
- <itemizedlist>
+ <orderedlist>
<para>Integrating data from a Enterprise Information System (EIS) into Teiid, is separated into two parts.</para>
<listitem>
<para>A Translator, which is required.</para>
@@ -16,20 +16,20 @@
<listitem>
<para>An optional Resource Adapter, which will typically be a JCA Resource Adapter (also called a JEE Connector) </para>
</listitem>
- </itemizedlist>
+ </orderedlist>
<para>A Translator is used to:</para>
- <itemizedlist>
+ <orderedlist>
<listitem>
- <para>Translate a Teiid-specific command into a native command.</para>
+ <para>Translate a Teiid-specific command into a native command,</para>
</listitem>
<listitem>
- <para>Execute the command.</para>
+ <para>Execute the command,</para>
</listitem>
<listitem>
<para>Return batches of results translated to expected Teiid types.</para>
</listitem>
- </itemizedlist>
+ </orderedlist>
<para>A Resource Adapter:</para>
<itemizedlist>
@@ -37,9 +37,11 @@
<para>Handles all communications with individual enterprise information system (EIS), which can include databases, data feeds, flat files, etc.</para>
</listitem>
<listitem>
- <para>Can be a <ulink url="http://java.sun.com/j2ee/connector/">JCA Connector</ulink> or any other custom connection provider.
+ <para>Can be a JCA Connector or any other custom connection provider.
The reason Teiid recommends and uses JCA is this specification defines how one can write, package, and configure access to EIS system in consistent manner.
There are also various commercial/open source software vendors already providing JCA Connectors to access a variety of back-end systems.</para>
+ <para>
+ Refer to <ulink url="http://java.sun.com/j2ee/connector/"/>.</para>
</listitem>
<listitem>
<para>Abstracts Translators from many common concerns, such as connection information, resource pooling, or authentication.</para>
@@ -55,47 +57,76 @@
you can use one of these enterprise information systems, you do not need to develop a custom one.
</para>
<para>Teiid offers the following translators:</para>
- <itemizedlist>
- <listitem>
- <para>
- <emphasis>JDBC:</emphasis>
- Works with many relational databases. The JDBC translator is validated against the following database
- systems: Oracle, Microsoft SQL Server, IBM DB2, MySQL, Postgres, Derby, Sybase, H2, and HSQL. In addition, the JDBC Translator can
- often be used with other 3rd-party drivers and provides a wide range of extensibility options to
- specialize behavior against those drivers.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>File:</emphasis>
- Provides a procedural way to access the file system to handle text files.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>WS:</emphasis> Provides procedural access to XML content via Web Services.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>LDAP:</emphasis> Accesses to LDAP directory services.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>Salesforce:</emphasis> Works with Salesforce interfaces.
- </para>
- </listitem>
- </itemizedlist>
+
+ <variablelist>
+ <varlistentry>
+ <term>JDBC Translator</term>
+ <listitem>
+ <para>
+ Works with many relational databases. The JDBC translator is validated
+ against the following database systems: Oracle, Microsoft SQL Server,
+ IBM DB2, MySQL, Postgres, Derby, Sybase, H2, and HSQL. In addition, the
+ JDBC Translator can often be used with other 3rd-party drivers and provides
+ a wide range of extensibility options to specialize behavior against those
+ drivers.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>File Translator</term>
+ <listitem>
+ <para>
+ Provides a procedural way to access the file system to handle text files.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>WS Translator</term>
+ <listitem>
+ <para>
+ Provides procedural access to XML content using Web Services.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>LDAP Translator</term>
+ <listitem>
+ <para>
+ Accesses to LDAP directory services.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Salesforce Translator</term>
+ <listitem>
+ <para>
+ Works with Salesforce interfaces.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
<section>
<title>Custom Translators</title>
- <orderedlist numeration="arabic">
- <para>High-level Translator development procedure:</para>
+
+ <para>
+ Below are the high-level steps for creating custom Translators. This guide covers
+ how to do each of these steps in detail. It also provides additional information for
+ advanced topics, such as streaming large objects.
+ </para>
+
+ <para>
+ For sample Translator code, refer to the Teiid source code at
+ <ulink url="http://anonsvn.jboss.org/repos/teiid/trunk/connectors/"/>.
+ </para>
+
+ <orderedlist>
<listitem>
- <para><link linkend="custom_ra_intro"></link>Create a new or reuse an existing Resource Adapater for the EIS system, to be used with this Translator</para>
+ <para>Create a new or reuse an existing Resource Adapater for the EIS system, to be used with this Translator.</para>
+ <para>Refer to <xref linkend="custom_ra_intro"/>.</para>
</listitem>
<listitem>
- <para>Implement the required classes defined by the <link linkend="translator_api">Translator API</link>.</para>
+ <para>Implement the required classes defined by the Translator API.</para>
<itemizedlist>
<listitem>
<para>Create an ExecutionFactory – Extend the <code>org.teiid.translator.ExecutionFactory</code> class</para>
@@ -104,29 +135,27 @@
<para>Create relevant Executions (and sub-interfaces) – specifies how to execute each type of command</para>
</listitem>
</itemizedlist>
+ <para>Refer to <xref linkend="translator_api"/>.</para>
</listitem>
<listitem>
- <para>Define the <link linkend="translator_package">template</link> for exposing configuration properties.</para>
+ <para>Define the template for exposing configuration properties.
+ Refer to <xref linkend="translator_package"/>.</para>
</listitem>
<listitem>
- <para><link linkend="translator_deploy">Deploy</link> your Translator.</para>
- <itemizedlist>
- <listitem>
- <para>Deploy a Virtual Database (VDB) utilizing your Translator.</para>
- </listitem>
- </itemizedlist>
+ <para>Deploy your Translator.
+ Refer to <xref linkend="translator_deploy"/>.</para>
</listitem>
+ <listitem>
+ <para>Deploy a Virtual Database (VDB) that uses your Translator.</para>
+ </listitem>
<listitem>
<para>Execute queries via Teiid.</para>
</listitem>
</orderedlist>
- <para>
- This guide covers how to do each of these steps in detail. It also provides additional information for
- advanced topics, such as streaming large objects. For sample
- Translator code, please check the <ulink url="http://anonsvn.jboss.org/repos/teiid/trunk/connectors/">Teiid source code</ulink>
- </para>
+
+
+ </section>
</section>
- </section>
<section>
<title>Do You Need a New Resource Adapter?</title>
<para>As mentioned above, for every Translator that needs to gather data from external source systems, it requires a resource adapter.
@@ -160,7 +189,8 @@
<orderedlist numeration="arabic">
<para>High-level Resource Adapter development procedure:</para>
<listitem>
- <para>Understand the <ulink url="http://java.sun.com/j2ee/connector/">JEE Connector</ulink> specification to have basic idea about what JCA connectors are how they are developed and packaged.</para>
+ <para>Understand the JEE Connector specification to have basic idea about what JCA connectors are how they are developed and packaged.</para>
+ <para>Refer to <ulink url="http://java.sun.com/j2ee/connector/"/>.</para>
</listitem>
<listitem>
<para>Gather all necessary information about your Enterprise Information System (EIS). You will need
@@ -198,16 +228,16 @@
</itemizedlist>
</listitem>
<listitem>
- <para><link linkend="ra_package">Package</link> your resource adapter.</para>
+ <para>Package your resource adapter. Refer to <xref linkend="ra_package"/>.</para>
</listitem>
<listitem>
- <para><link linkend="ra_package">Deploy</link> your resource adapter.</para>
+ <para>Deploy your resource adapter. Refer to <xref linkend="ra_package"/>.</para>
</listitem>
</orderedlist>
<para>
This guide covers how to do each of these steps in detail. It also provides additional information for
- advanced topics, such as transactions. For a sample
- resource adapter code, please check the <ulink url="http://anonsvn.jboss.org/repos/teiid/trunk/connectors/">Teiid Source code</ulink>
+ advanced topics, such as transactions. For sample
+ resource adapter code refer to the Teiid Source code at <ulink url="http://anonsvn.jboss.org/repos/teiid/trunk/connectors/"/>.
</para>
</section>
</section>
@@ -217,13 +247,13 @@
<para>Teiid is highly extensible in other ways:</para>
<itemizedlist>
<listitem>
- <para>You may add <link linkend="udfs">User Defined Functions</link>.</para>
+ <para>You may add User Defined Functions. Refer to <xref linkend="udfs"/>.</para>
</listitem>
<listitem>
- <para>You may adapt <link linkend="logging">logging</link> to your needs, which is especially useful for custom audit or command logging.</para>
+ <para>You may adapt logging to your needs, which is especially useful for custom audit or command logging. Refer to <xref linkend="logging"/>.</para>
</listitem>
<listitem>
- <para>You may change the <link linkend="custom_security">security</link> subsystem for custom authentication and authorization.</para>
+ <para>You may change the subsystem for custom authentication and authorization. Refer to <xref linkend="custom_login_modules"/>.</para>
</listitem>
</itemizedlist>
</section>
Modified: branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/logging.xml
===================================================================
--- branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/logging.xml 2010-10-01 15:43:39 UTC (rev 2621)
+++ branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/logging.xml 2010-10-04 14:46:41 UTC (rev 2622)
@@ -8,23 +8,23 @@
<section id="custom_logging">
<title>Customized Logging</title>
<para>
- The Teiid system provides a wealth of information via logging. To
- control logging level, contexts, and log locations, you should be
- familiar with
- <ulink url="http://logging.apache.org/log4j/">log4j</ulink>
- and the container's jboss-log4j.xml configuration file.
- Teiid also provides a <profile>/conf/jboss-teiid-log4j.xml containing much of information from chapter.
- Check out Admin Guide for more details about different Teiid contexts available.
+ The Teiid system provides a wealth of information using logging. To control logging level,
+ contexts, and log locations, you should be familiar with log4j and the container's
+ <filename>jboss-log4j.xml</filename> configuration file. Teiid also provides a
+ <filename><replaceable>PROFILE</replaceable>/conf/jboss-teiid-log4j.xml</filename> containing
+ much of information from this chapter. Refer to the Administrator Guide for more details about
+ different Teiid contexts available. Refer to <ulink url="http://logging.apache.org/log4j/"/>
+ for more information about log4j.
</para>
<para>
If the default log4j logging mechanisms are not sufficient for your
- logging needs you may need a different appender - see
- <ulink url="http://logging.apache.org/log4j/1.2/apidocs/index.html">the log4j javadocs</ulink>.
+ logging needs you may need a different appender, refer to the log4j javadocs at
+ <ulink url="http://logging.apache.org/log4j/1.2/apidocs/index.html"/>.
Note that log4j already provides quite a few appenders including JMS, RDBMS, and SMTP.
</para>
- <para>If you want a custom appender, follow the Log4J directions to write a custom appender. See instructions
- <ulink url="http://logging.apache.org/log4net/release/faq.html">here</ulink>. If you develop a custom
+ <para>If you want a custom appender, follow the Log4J directions to write a custom appender. Refer to
+ the instructions at <ulink url="http://logging.apache.org/log4net/release/faq.html"/>. If you develop a custom
logging solution, the implementation jar should be placed in the "lib" directory of the JBoss AS server profile
Teiid is installed in.
</para>
Modified: branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/security.xml
===================================================================
--- branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/security.xml 2010-10-01 15:43:39 UTC (rev 2621)
+++ branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/security.xml 2010-10-04 14:46:41 UTC (rev 2622)
@@ -8,37 +8,88 @@
<para>
LoginModules are an essential part of the JAAS security
framework and provide Teiid customizable user authentication and the
- ability to reuse existing LoginModules defined for JBossAS. See
- <ulink
- url="http://docs.jboss.org/jbossas/admindevel326/html/ch8.chapter.html">JBossAS Security</ulink>
- for general information on configuring security in JBossAS.</para>
+ ability to reuse existing LoginModules defined for JBossAS. Refer to
+ the JBoss Application Server security documentation for information about
+ configuring security in JBoss Application Server,
+ <ulink url="http://docs.jboss.org/jbossas/admindevel326/html/ch8.chapter.html"/>.
+ </para>
<section>
<title>Built-in LoginModules</title>
- <para>JBossAS provides several LoginModules for common authentication needs, such as authenticating from text files or LDAP.
- The below are are some of the available in JBoss AS </para>
+ <para>
+ JBoss Application Server provides several LoginModules for common
+ authentication needs, such as authenticating from text files or LDAP.
+ </para>
- <para>See for all the available <ulink url="http://community.jboss.org/docs/DOC-11287"> login modules.</ulink></para>
+ <para>
+ Below are are some of those available in JBoss Application Server:
+ </para>
+
+ <variablelist>
- <para>See <ulink url="http://community.jboss.org/docs/DOC-12510">UserRoles LoginModule configuration</ulink>
- for utilizing simple file based authentication.</para>
- <para>See <ulink url="http://community.jboss.org/docs/DOC-11253">LDAP LoginModule configuration</ulink> for
- utilizing LDAP based authentication. </para>
- <para>See <ulink url="http://community.jboss.org/docs/DOC-9511">Database LoginModule configuration</ulink> for
- utilizing Database based authentication. </para>
+ <varlistentry>
+ <term>UserRoles LoginModule</term>
+ <listitem>
+ <para>
+ Login module that uses simple file based authentication.
+ </para>
+ <para>
+ Refer to <ulink url="http://community.jboss.org/docs/DOC-12510"/>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>LDAP LoginModule</term>
+ <listitem>
+ <para>
+ Login module that uses LDAP based authentication.
+ </para>
+ <para>
+ Refer to <ulink url="http://community.jboss.org/docs/DOC-11253"/>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Database LoginModule</term>
+ <listitem>
+ <para>
+ Login module that uses Database-based authentication.
+ </para>
+ <para>
+ Refer to <ulink url="http://community.jboss.org/docs/DOC-9511"/>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Cert LoginModule</term>
+ <listitem>
+ <para>
+ Login module that uses X509 certificate based authentication.
+ </para>
+ <para>
+ See <ulink url="http://community.jboss.org/docs/DOC-9160"/>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
- <para>See <ulink url="http://community.jboss.org/docs/DOC-9160">Cert LoginModule configuration</ulink> for
- utilizing X509 certificate based authentication. </para>
- </section>
+ <para>
+ For all the available login modules refer to <ulink url="http://community.jboss.org/docs/DOC-11287"/>.
+ </para>
+
+ </section>
+
<section>
<title>Custom LoginModules</title>
<para>
- If your authentication needs go beyond the provided LoginModules, please consult the
- <ulink url="http://java.sun.com/j2se/1.5.0/docs/guide/security/jaas/JAASLMDevGuide.html">JAAS development guide</ulink>.
+ If your authentication needs go beyond the provided LoginModules, please refer
+ to the JAAS development guide at
+ <ulink url="http://java.sun.com/j2se/1.5.0/docs/guide/security/jaas/JAASLMDevGuide.html"/>.
There are also numerous guides available.
</para>
- <para>If you are extending one of the built-in LoginModules, please see
- <ulink url="http://community.jboss.org/docs/DOC-9466">this</ulink>.</para>
+ <para>If you are extending one of the built-in LoginModules, refer to
+ <ulink url="http://community.jboss.org/docs/DOC-9466"/>.</para>
</section>
</chapter>
\ No newline at end of file
Modified: branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml
===================================================================
--- branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml 2010-10-01 15:43:39 UTC (rev 2621)
+++ branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/translator-api.xml 2010-10-04 14:46:41 UTC (rev 2622)
@@ -32,22 +32,26 @@
<para>Every software program requires some external configuration, that defines ways user can alter the behavior of a program.
If this translator needs configurable properties define a variable for every property as an attribute in the extended
"ExecutionFactory" class. Then define a "get" and "set" methods for each of them. Also, annotate each "get" method with
- <code>@TranslatorProperty</code> annotation and provide the metadata about the property. For example, if you need a
- property called "foo",
- <programlisting><![CDATA[private String foo = "balh";
-
+ <code>@TranslatorProperty</code> annotation and provide the metadata about the property.
+ </para>
+ <para>
+ For example, if you need a property called "foo", by providing the annotation on
+ these properties, the Teiid tooling will automatically interrogate and provide
+ graphical way to configure your Translator.
+ </para>
+ <programlisting language="Java" role="JAVA"><![CDATA[private String foo = "blah";
@TranslatorProperty(display="Foo property", description="description about Foo")
-public String getFoo() {
- return foo;
+public String getFoo()
+{
+ return foo;
}
-public void setFoo(String value) {
- return this.foo = value;
+public void setFoo(String value)
+{
+ return this.foo = value;
}]]> </programlisting>
-
- by providing the annotation on these properties, the Teiid tooling will automatically interrogate and
- provide graphical way to configure your
- Translator. Only java primitive (int), primitive object wrapper (java.lang.Integer), or Enum types are supported as Translator properties.
+ <para>
+ Only java primitive (int), primitive object wrapper (java.lang.Integer), or Enum types are supported as Translator properties.
The default value will be derived from calling the getter, if available, on a newly constructed instance.
All properties <emphasis>should</emphasis> have a default value. If there is no applicable default, then the property should be marked in the annotation as required.
Initialization will fail if a required property value is not provided.
@@ -84,7 +88,7 @@
<title>TranslatorCapabilities</title>
<para>These are various methods that typically begin with method
signature "supports" on the "ExecutionFactory" class. These methods need to be overridden to describe the execution
- capabilities of the Translator. See <link linkend="translator_capabilities">Translator Capabilities</link> for more on these methods.</para>
+ capabilities of the Translator. Refer to <xref linkend="translator_capabilities"/> for more on these methods.</para>
</section>
<section>
@@ -161,16 +165,19 @@
</para>
</section>
</section>
+
<section>
- <title>Executing Commands</title>
- <section>
+ <title>Executing Commands</title>
+ <section>
<title>Execution Modes</title>
- <para>
- The Teiid query engine uses the "ExecutionFactory" class to obtain the "Execution" interface for the command it is
- executing. The actual queries themselves are sent to translators in the form of a set of objects, which are further
- described in <link linkend="command_language">Command Language</link>.
- translators are allowed to support any subset of the available execution modes.
- </para>
+ <para>
+ The Teiid query engine uses the "ExecutionFactory" class to obtain the "Execution"
+ interface for the command it is executing. The actual queries themselves are sent
+ to translators in the form of a set of objects, which are further described in
+ Command Language. Refer to <xref linkend="command_language"/>. Translators are
+ allowed to support any subset of the available execution modes.
+ </para>
+
<table frame='all'>
<title>Types of Execution Modes</title>
<tgroup cols='3' align='left' colsep='1' rowsep='1'>
@@ -311,9 +318,8 @@
package. These objects can be combined to represent any possible
command that Teiid may send to the Translator. However, it is possible
to notify Teiid that your Translator can only accept certain kinds of
- constructs via the capabilities defined on the "ExecutionFactory" class. See the section on using
- <link linkend="translator_capabilities">Translator Capabilities</link>
- for more information.
+ constructs via the capabilities defined on the "ExecutionFactory" class. Refer to
+ <xref linkend="translator_capabilities"/> for more information.
</para>
<para>The language objects all extend from the <code>LanguageObject</code> interface.
Language objects should be thought of as a tree where each node is a
@@ -322,7 +328,7 @@
<para>All commands sent to your Translator are in the form of these
language trees, where the root of the tree is a subclass of <code>Command</code>.
Command has several sub-interfaces, namely:
-
+ </para>
<itemizedlist>
<listitem><para><code>QueryExpression</code></para></listitem>
<listitem><para><code>Insert</code></para></listitem>
@@ -331,11 +337,13 @@
<listitem><para><code>BatchedUpdates</code></para></listitem>
<listitem><para><code>Call</code></para></listitem>
</itemizedlist>
-
- Important components of these commands are expressions, criteria, and joins, which are examined
- in closer detail below. Also see the <ulink url="&javaDocUrl;">Teiid JavaDocs</ulink>
- for more on the classes and interfaces described here.
- </para>
+
+ <para>
+ Important components of these commands are expressions, criteria, and joins,
+ which are examined in closer detail below. For more on the classes and interfaces
+ described here, refer to the Teiid JavaDocs <ulink url="&javaDocUrl;"/>.
+ </para>
+
<section>
<title>Expressions</title>
<para>An expression represents a single value in context, although in
@@ -430,9 +438,8 @@
<code>Join</code>
s with a single root. This latter form
is the ANSI perfered style. If you wish all pushdown queries containing joins to be in ANSI style have the
- capability "useAnsiJoin" return true. See
- <link linkend="command_form_capabilities">Command Form Capabilities</link>
- for more information.
+ capability "useAnsiJoin" return true. Refer to
+ <xref linkend="command_form_capabilities"/> for more information.
</para>
</section>
<section>
@@ -542,7 +549,7 @@
<section>
<title>Runtime Metadata</title>
- <para>Teiid uses a library of metadata, known as "runtime metadata” for
+ <para>Teiid uses a library of metadata, known as "runtime metadata" for
each virtual database that is deployed in Teiid. The runtime metadata
is a subset of metadata as defined by models in the Teiid models that
compose the virtual database. While builing your VDB in the Designer, you can define what
@@ -578,14 +585,12 @@
<title>Obtaining Metadata Properties</title>
<para>The process of getting a Table's properties is sometimes needed for translator development. For example
to get the "NameInSource" property or all extension properties:</para>
- <programlisting><![CDATA[
-//getting the Table metadata from an Table is straight-forward
+ <programlisting language="Java" role="JAVA"><![CDATA[//getting the Table metadata from an Table is straight-forward
Table table = runtimeMetadata.getTable("table-name");
String contextName = table.getNameInSource();
//The props will contain extension properties
-Map<String, String> props = table.getProperties();
- ]]></programlisting>
+Map<String, String> props = table.getProperties();]]></programlisting>
</example>
</section>
@@ -661,8 +666,7 @@
not processing order.</para>
<para>Write code to execute your visitor using the utility methods on
DelegatingHierarchyVisitor:</para>
- <programlisting><![CDATA[
-// Get object tree
+ <programlisting language="Java" role="JAVA"><![CDATA[// Get object tree
LanguageObject objectTree = …
// Create your visitor initialize as necessary
@@ -672,8 +676,7 @@
DelegatingHierarchyVisitor.preOrderVisit(visitor, objectTree);
// Retrieve state collected while visiting
-int count = visitor.getCount();
- ]]></programlisting>
+int count = visitor.getCount();]]></programlisting>
</section>
</section>
<section id="translator_capabilities">
@@ -698,9 +701,9 @@
<table frame='all'>
<title>Available Capabilities</title>
<tgroup cols='3' align='left' colsep='1' rowsep='1'>
- <colspec colname='c1' colwidth="1.5*" />
+ <colspec colname='c1' colwidth="1*" />
<colspec colname='c2' colwidth="1*" />
- <colspec colname='c3' colwidth="2*" />
+ <colspec colname='c3' colwidth="3*" />
<thead>
<row>
<entry>
@@ -824,7 +827,7 @@
<para/>
</entry>
<entry>
- <para>Translator can support comparison criteria with the operator "=”.</para>
+ <para>Translator can support comparison criteria with the operator "=".</para>
</entry>
</row>
<row>
@@ -835,7 +838,7 @@
<para/>
</entry>
<entry>
- <para>Translator can support comparison criteria with the operator ">” or "<".</para>
+ <para>Translator can support comparison criteria with the operator ">" or "<".</para>
</entry>
</row>
<row>
@@ -1140,7 +1143,7 @@
<para />
</entry>
<entry>
- <para>Translator can support "searched” CASE expressions anywhere that expressions are
+ <para>Translator can support "searched" CASE expressions anywhere that expressions are
accepted.</para>
</entry>
</row>
@@ -1287,8 +1290,8 @@
<para>The method <code>ExecutionFactory.getSupportedFunctions()</code> can be
used to specify which scalar functions the Translator supports. The
set of possible functions is based on the set of functions supported
- by Teiid. This set can be found in the <ulink url="&docUrl;">Reference</ulink>
- documentation. If the Translator states that it supports a function,
+ by Teiid. This set can be found in the Reference documentation at
+ <ulink url="&docUrl;"/>. If the Translator states that it supports a function,
it must support all type combinations and overloaded forms of that
function.</para>
<para>There are also five standard operators that can also be specified in the
@@ -1339,9 +1342,9 @@
<section>
<title>Data Types</title>
<para>Teiid supports three large object runtime data types: blob,
- clob, and xml. A blob is a “binary large object”, a clob is a
- “character large object”, and “xml” is a “xml
- document”. Columns modeled as a blob, clob, or xml are treated similarly by
+ clob, and xml. A blob is a "binary large object", a clob is a
+ "character large object", and "xml" is a "xml
+ document". Columns modeled as a blob, clob, or xml are treated similarly by
the translator framework to support memory-safe streaming. </para>
</section>
<section>
@@ -1389,7 +1392,7 @@
<para>When the "keepAlive" alive flag is set, then the execution object is only closed when user's Statement is closed.</para>
- <programlisting><![CDATA[executionContext.keepExecutionAlive(true);]]></programlisting>
+ <programlisting language="Java" role="JAVA"><![CDATA[executionContext.keepExecutionAlive(true);]]></programlisting>
</section>
@@ -1405,17 +1408,21 @@
<section id="translator_package">
<title>Packaging</title>
- <para>Once the "ExecutionFactory" class is implemented, package it in a JAR file. The only
- additional requirement is provide a file called "jboss-beans.xml" in the "META-INF" directory of the JAR file, with
- following contents.
- <programlisting><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+ <para>
+ Once the "ExecutionFactory" class is implemented, package it in a JAR file. The only
+ additional requirement is provide a file called "jboss-beans.xml" in the "META-INF"
+ directory of the JAR file, with following contents. Replace ${name} with name of your
+ translator, and replace ${execution-factory-class} with your overridden ExecutionFactory
+ class name. This will register the Translator for use with tooling and Admin API.
+ </para>
+ <programlisting role="XML" language="XML"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
+
<bean name="translator-${name}-template" class="org.teiid.templates.TranslatorDeploymentTemplate">
<property name="info"><inject bean="translator-${name}"/></property>
<property name="managedObjectFactory"><inject bean="ManagedObjectFactory"/></property>
</bean>
-
+
<bean name="translator-${name}" class="org.teiid.templates.TranslatorTemplateInfo">
<constructor factoryMethod="createTemplateInfo">
<factory bean="TranslatorDeploymentTemplateInfoFactory"/>
@@ -1425,11 +1432,10 @@
<parameter class="java.lang.String">${name}</parameter>
</constructor>
</bean>
-
+
</deployment>]]></programlisting>
- replace ${name} with name of your translator, and replace ${execution-factory-class} with your
- overridden ExecutionFactory class name. This will register the Translator for use with tooling and Admin API.</para>
+
</section>
<section id="translator_deploy">
Modified: branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/udf.xml
===================================================================
--- branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/udf.xml 2010-10-01 15:43:39 UTC (rev 2621)
+++ branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/content/udf.xml 2010-10-04 14:46:41 UTC (rev 2622)
@@ -95,7 +95,7 @@
functions score and contains:
</para>
<informalexample>
- <programlisting>SELECT score(1), ID, FREEDATA FROM Docs WHERE contains(freedata, 'nick', 1) > 0</programlisting>
+ <programlisting language="SQL">SELECT score(1), ID, FREEDATA FROM Docs WHERE contains(freedata, 'nick', 1) > 0</programlisting>
</informalexample>
<para>
The
@@ -136,7 +136,9 @@
<listitem>
<para>
Create a new translator jar containing your custom
- ExecutionFactory. See <link linkend="translator_package">packaging</link> and <link linkend="translator_deploy">deployment</link> instructions for using the jar.</para>
+ ExecutionFactory. Refer to <xref linkend="translator_package"/> and
+ <xref linkend="translator_deploy"/> for instructions on using the JAR file.
+ </para>
</listitem>
</itemizedlist>
</section>
@@ -163,8 +165,7 @@
<listitem>
<para>
Number of input arguments and types must match the function metadata defined
- in section
- <link linkend="define_udf">Install user-defined functions</link>
+ in <xref linkend="define_udf"/>.
</para>
</listitem>
<listitem>
@@ -181,22 +182,24 @@
This <code>CommandContext</code> parameter does not need to be delared in the function metadata.</para>
<example>
<title>Sample code</title>
- <programlisting><![CDATA[package org.something;
+ <programlisting language="Java" role="JAVA"><![CDATA[package org.something;
-public class TempConv {
-
- /**
- * Converts the given Celsius temperature to Fahrenheit, and returns the
- * value.
- * @param doubleCelsiusTemp
- * @return Fahrenheit
- */
- public static Double celsiusToFahrenheit(Double doubleCelsiusTemp){
- if (doubleCelsiusTemp == null) {
- return null;
- }
- return (doubleCelsiusTemp)*9/5 + 32;
- }
+public class TempConv
+{
+ /**
+ * Converts the given Celsius temperature to Fahrenheit, and returns the
+ * value.
+ * @param doubleCelsiusTemp
+ * @return Fahrenheit
+ */
+ public static Double celsiusToFahrenheit(Double doubleCelsiusTemp)
+ {
+ if (doubleCelsiusTemp == null)
+ {
+ return null;
+ }
+ return (doubleCelsiusTemp)*9/5 + 32;
+ }
}]]></programlisting>
</example>
</section>
Deleted: branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/main.xml
===================================================================
--- branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/main.xml 2010-10-01 15:43:39 UTC (rev 2621)
+++ branches/7.1.x/documentation/developer-guide/src/main/docbook/en-US/main.xml 2010-10-04 14:46:41 UTC (rev 2622)
@@ -1,60 +0,0 @@
-<?xml version='1.0' encoding="UTF-8"?>
-<!--
-
- JBoss, Home of Professional Open Source.
- Copyright (C) 2008 Red Hat, Inc.
- Licensed to Red Hat, Inc. under one or more contributor
- license agreements. See the copyright.txt file in the
- distribution for a full listing of individual contributors.
-
- 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.
-
--->
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % CustomDTD SYSTEM "../../../../../docbook/custom.dtd">
-%CustomDTD;
-]>
-
-<book>
-
- <bookinfo>
- <title>Teiid - Scalable Information Integration</title>
- <subtitle>Teiid Developer's Guide</subtitle>
- <releaseinfo>&versionNumber;</releaseinfo>
- <productnumber>&versionNumber;</productnumber>
- <issuenum>1</issuenum>
- <copyright>
- <year>©rightYear;</year>
- <holder>©rightHolder;</holder>
- </copyright>
- <xi:include href="../../../../../docbook/en-US/legal_notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- </bookinfo>
-
- <toc/>
-
- <xi:include href="content/introduction.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/develop-adapter.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/translator-api.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/extending-jdbc.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/udf.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/adminapi.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/logging.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/security.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/appendix-a.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/appendix-b.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
-
-</book>
-
14 years, 3 months