Author: shawkins
Date: 2010-04-08 11:33:59 -0400 (Thu, 08 Apr 2010)
New Revision: 2037
Added:
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SQLServerCapabilities.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SQLServerSQLTranslator.java
Removed:
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SqlServerCapabilities.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SqlServerSQLTranslator.java
Modified:
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCManagedConnectionFactory.java
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sqlserver/TestSqlServerConversionVisitor.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestTPCR.java
Log:
TEIID-833 addressing misc. issues - Specific Translators were not being used and changed
SqlServer to SQLServer for consistency
Modified:
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCManagedConnectionFactory.java
===================================================================
---
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCManagedConnectionFactory.java 2010-04-08
02:41:01 UTC (rev 2036)
+++
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCManagedConnectionFactory.java 2010-04-08
15:33:59 UTC (rev 2037)
@@ -60,10 +60,11 @@
if (this.sqlTranslator == null) {
try {
String className = getExtensionTranslationClassName();
- if (StringUtil.isValid(className)) {
- className = Translator.class.getName();
+ if (!StringUtil.isValid(className)) {
+ this.sqlTranslator = new Translator();
+ } else {
+ this.sqlTranslator = (Translator)ReflectionHelper.create(className, null,
Thread.currentThread().getContextClassLoader());
}
- this.sqlTranslator = (Translator)ReflectionHelper.create(className, null,
Thread.currentThread().getContextClassLoader());
sqlTranslator.initialize(this);
} catch (MetaMatrixCoreException e) {
throw new ConnectorException(e);
Copied:
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SQLServerCapabilities.java
(from rev 2035,
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SqlServerCapabilities.java)
===================================================================
---
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SQLServerCapabilities.java
(rev 0)
+++
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SQLServerCapabilities.java 2010-04-08
15:33:59 UTC (rev 2037)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+/*
+ */
+package org.teiid.connector.jdbc.sqlserver;
+
+import java.util.*;
+
+import org.teiid.connector.jdbc.JDBCCapabilities;
+
+
+/**
+ */
+public class SQLServerCapabilities extends JDBCCapabilities {
+
+ public SQLServerCapabilities() {
+ }
+
+ /**
+ * @see com.metamatrix.data.ConnectorCapabilities#getSupportedFunctions()
+ */
+ public List<String> getSupportedFunctions() {
+ List<String> supportedFunctions = new ArrayList<String>();
+ supportedFunctions.addAll(super.getSupportedFunctions());
+ supportedFunctions.add("ABS"); //$NON-NLS-1$
+ supportedFunctions.add("ACOS"); //$NON-NLS-1$
+ supportedFunctions.add("ASIN"); //$NON-NLS-1$
+ supportedFunctions.add("ATAN"); //$NON-NLS-1$
+ supportedFunctions.add("ATAN2"); //$NON-NLS-1$
+ supportedFunctions.add("COS"); //$NON-NLS-1$
+ supportedFunctions.add("COT"); //$NON-NLS-1$
+ supportedFunctions.add("DEGREES"); //$NON-NLS-1$
+ supportedFunctions.add("EXP"); //$NON-NLS-1$
+ supportedFunctions.add("FLOOR"); //$NON-NLS-1$
+ supportedFunctions.add("LOG"); //$NON-NLS-1$
+ supportedFunctions.add("LOG10"); //$NON-NLS-1$
+ supportedFunctions.add("MOD"); //$NON-NLS-1$
+ supportedFunctions.add("PI"); //$NON-NLS-1$
+ supportedFunctions.add("POWER"); //$NON-NLS-1$
+ supportedFunctions.add("RADIANS"); //$NON-NLS-1$
+ supportedFunctions.add("SIGN"); //$NON-NLS-1$
+ supportedFunctions.add("SIN"); //$NON-NLS-1$
+ supportedFunctions.add("SQRT"); //$NON-NLS-1$
+ supportedFunctions.add("TAN"); //$NON-NLS-1$
+ supportedFunctions.add("ASCII"); //$NON-NLS-1$
+ supportedFunctions.add("CHAR"); //$NON-NLS-1$
+ supportedFunctions.add("CHR"); //$NON-NLS-1$
+ supportedFunctions.add("CONCAT"); //$NON-NLS-1$
+ supportedFunctions.add("||"); //$NON-NLS-1$
+ //supportedFunctons.add("INITCAP"); //$NON-NLS-1$
+ supportedFunctions.add("LCASE"); //$NON-NLS-1$
+ supportedFunctions.add("LEFT"); //$NON-NLS-1$
+ supportedFunctions.add("LENGTH"); //$NON-NLS-1$
+ //supportedFunctons.add("LOCATE"); //$NON-NLS-1$
+ supportedFunctions.add("LOWER"); //$NON-NLS-1$
+ //supportedFunctons.add("LPAD"); //$NON-NLS-1$
+ supportedFunctions.add("LTRIM"); //$NON-NLS-1$
+ supportedFunctions.add("REPEAT"); //$NON-NLS-1$
+ //supportedFunctions.add("RAND"); //$NON-NLS-1$
+ supportedFunctions.add("REPLACE"); //$NON-NLS-1$
+ supportedFunctions.add("RIGHT"); //$NON-NLS-1$
+ //supportedFunctons.add("RPAD"); //$NON-NLS-1$
+ supportedFunctions.add("RTRIM"); //$NON-NLS-1$
+ supportedFunctions.add("SPACE"); //$NON-NLS-1$
+ supportedFunctions.add("SUBSTRING"); //$NON-NLS-1$
+ //supportedFunctons.add("TRANSLATE"); //$NON-NLS-1$
+ supportedFunctions.add("UCASE"); //$NON-NLS-1$
+ supportedFunctions.add("UPPER"); //$NON-NLS-1$
+ //supportedFunctons.add("CURDATE"); //$NON-NLS-1$
+ //supportedFunctons.add("CURTIME"); //$NON-NLS-1$
+ supportedFunctions.add("DAYNAME"); //$NON-NLS-1$
+ supportedFunctions.add("DAYOFMONTH"); //$NON-NLS-1$
+ supportedFunctions.add("DAYOFWEEK"); //$NON-NLS-1$
+ supportedFunctions.add("DAYOFYEAR"); //$NON-NLS-1$
+ supportedFunctions.add("HOUR"); //$NON-NLS-1$
+ supportedFunctions.add("MINUTE"); //$NON-NLS-1$
+ supportedFunctions.add("MONTH"); //$NON-NLS-1$
+ supportedFunctions.add("MONTHNAME"); //$NON-NLS-1$
+ //supportedFunctions.add("NOW"); //$NON-NLS-1$
+ supportedFunctions.add("QUARTER"); //$NON-NLS-1$
+ supportedFunctions.add("SECOND"); //$NON-NLS-1$
+ supportedFunctions.add("TIMESTAMPADD"); //$NON-NLS-1$
+ supportedFunctions.add("TIMESTAMPDIFF"); //$NON-NLS-1$
+ supportedFunctions.add("WEEK"); //$NON-NLS-1$
+ supportedFunctions.add("YEAR"); //$NON-NLS-1$
+ supportedFunctions.add("CAST"); //$NON-NLS-1$
+ supportedFunctions.add("CONVERT"); //$NON-NLS-1$
+ supportedFunctions.add("IFNULL"); //$NON-NLS-1$
+ supportedFunctions.add("NVL"); //$NON-NLS-1$
+
+ return supportedFunctions;
+ }
+
+ public boolean supportsInlineViews() {
+ return true;
+ }
+
+ /**
+ * @see org.teiid.connector.api.ConnectorCapabilities#supportsFunctionsInGroupBy()
+ * @since 5.0
+ */
+ public boolean supportsFunctionsInGroupBy() {
+ return true;
+ }
+
+ public boolean supportsRowLimit() {
+ return true;
+ }
+
+ @Override
+ public boolean supportsIntersect() {
+ return true;
+ }
+
+ public boolean supportsExcept() {
+ return true;
+ };
+}
Copied:
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SQLServerSQLTranslator.java
(from rev 2035,
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SqlServerSQLTranslator.java)
===================================================================
---
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SQLServerSQLTranslator.java
(rev 0)
+++
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SQLServerSQLTranslator.java 2010-04-08
15:33:59 UTC (rev 2037)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+/*
+ */
+package org.teiid.connector.jdbc.sqlserver;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.connector.api.ConnectorCapabilities;
+import org.teiid.connector.api.ExecutionContext;
+import org.teiid.connector.api.TypeFacility;
+import org.teiid.connector.jdbc.sybase.SybaseSQLTranslator;
+import org.teiid.connector.language.ColumnReference;
+import org.teiid.connector.language.Function;
+import org.teiid.connector.language.LanguageObject;
+
+/**
+ * Updated to assume the use of the DataDirect, 2005 driver, or later.
+ */
+public class SQLServerSQLTranslator extends SybaseSQLTranslator {
+
+ //TEIID-31 remove mod modifier for SQL Server 2008
+
+ @Override
+ protected List<Object> convertDateToString(Function function) {
+ return Arrays.asList("replace(convert(varchar, ",
function.getParameters().get(0), ", 102), '.', '-')");
//$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Override
+ protected List<?> convertTimestampToString(Function function) {
+ return Arrays.asList("convert(varchar, ", function.getParameters().get(0),
", 21)"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Override
+ public Class<? extends ConnectorCapabilities> getDefaultCapabilities() {
+ return SQLServerCapabilities.class;
+ }
+
+ @Override
+ public List<?> translate(LanguageObject obj, ExecutionContext context) {
+ if (obj instanceof ColumnReference) {
+ ColumnReference elem = (ColumnReference)obj;
+ if (TypeFacility.RUNTIME_TYPES.STRING.equals(elem.getType()) &&
elem.getMetadataObject() != null &&
"uniqueidentifier".equalsIgnoreCase(elem.getMetadataObject().getNativeType())) {
//$NON-NLS-1$
+ return Arrays.asList("cast(", elem, " as char(36))");
//$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ return super.translate(obj, context);
+ }
+
+}
Deleted:
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SqlServerCapabilities.java
===================================================================
---
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SqlServerCapabilities.java 2010-04-08
02:41:01 UTC (rev 2036)
+++
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SqlServerCapabilities.java 2010-04-08
15:33:59 UTC (rev 2037)
@@ -1,138 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/*
- */
-package org.teiid.connector.jdbc.sqlserver;
-
-import java.util.*;
-
-import org.teiid.connector.jdbc.JDBCCapabilities;
-
-
-/**
- */
-public class SqlServerCapabilities extends JDBCCapabilities {
-
- public SqlServerCapabilities() {
- }
-
- /**
- * @see com.metamatrix.data.ConnectorCapabilities#getSupportedFunctions()
- */
- public List<String> getSupportedFunctions() {
- List<String> supportedFunctions = new ArrayList<String>();
- supportedFunctions.addAll(super.getSupportedFunctions());
- supportedFunctions.add("ABS"); //$NON-NLS-1$
- supportedFunctions.add("ACOS"); //$NON-NLS-1$
- supportedFunctions.add("ASIN"); //$NON-NLS-1$
- supportedFunctions.add("ATAN"); //$NON-NLS-1$
- supportedFunctions.add("ATAN2"); //$NON-NLS-1$
- supportedFunctions.add("COS"); //$NON-NLS-1$
- supportedFunctions.add("COT"); //$NON-NLS-1$
- supportedFunctions.add("DEGREES"); //$NON-NLS-1$
- supportedFunctions.add("EXP"); //$NON-NLS-1$
- supportedFunctions.add("FLOOR"); //$NON-NLS-1$
- supportedFunctions.add("LOG"); //$NON-NLS-1$
- supportedFunctions.add("LOG10"); //$NON-NLS-1$
- supportedFunctions.add("MOD"); //$NON-NLS-1$
- supportedFunctions.add("PI"); //$NON-NLS-1$
- supportedFunctions.add("POWER"); //$NON-NLS-1$
- supportedFunctions.add("RADIANS"); //$NON-NLS-1$
- supportedFunctions.add("SIGN"); //$NON-NLS-1$
- supportedFunctions.add("SIN"); //$NON-NLS-1$
- supportedFunctions.add("SQRT"); //$NON-NLS-1$
- supportedFunctions.add("TAN"); //$NON-NLS-1$
- supportedFunctions.add("ASCII"); //$NON-NLS-1$
- supportedFunctions.add("CHAR"); //$NON-NLS-1$
- supportedFunctions.add("CHR"); //$NON-NLS-1$
- supportedFunctions.add("CONCAT"); //$NON-NLS-1$
- supportedFunctions.add("||"); //$NON-NLS-1$
- //supportedFunctons.add("INITCAP"); //$NON-NLS-1$
- supportedFunctions.add("LCASE"); //$NON-NLS-1$
- supportedFunctions.add("LEFT"); //$NON-NLS-1$
- supportedFunctions.add("LENGTH"); //$NON-NLS-1$
- //supportedFunctons.add("LOCATE"); //$NON-NLS-1$
- supportedFunctions.add("LOWER"); //$NON-NLS-1$
- //supportedFunctons.add("LPAD"); //$NON-NLS-1$
- supportedFunctions.add("LTRIM"); //$NON-NLS-1$
- supportedFunctions.add("REPEAT"); //$NON-NLS-1$
- //supportedFunctions.add("RAND"); //$NON-NLS-1$
- supportedFunctions.add("REPLACE"); //$NON-NLS-1$
- supportedFunctions.add("RIGHT"); //$NON-NLS-1$
- //supportedFunctons.add("RPAD"); //$NON-NLS-1$
- supportedFunctions.add("RTRIM"); //$NON-NLS-1$
- supportedFunctions.add("SPACE"); //$NON-NLS-1$
- supportedFunctions.add("SUBSTRING"); //$NON-NLS-1$
- //supportedFunctons.add("TRANSLATE"); //$NON-NLS-1$
- supportedFunctions.add("UCASE"); //$NON-NLS-1$
- supportedFunctions.add("UPPER"); //$NON-NLS-1$
- //supportedFunctons.add("CURDATE"); //$NON-NLS-1$
- //supportedFunctons.add("CURTIME"); //$NON-NLS-1$
- supportedFunctions.add("DAYNAME"); //$NON-NLS-1$
- supportedFunctions.add("DAYOFMONTH"); //$NON-NLS-1$
- supportedFunctions.add("DAYOFWEEK"); //$NON-NLS-1$
- supportedFunctions.add("DAYOFYEAR"); //$NON-NLS-1$
- supportedFunctions.add("HOUR"); //$NON-NLS-1$
- supportedFunctions.add("MINUTE"); //$NON-NLS-1$
- supportedFunctions.add("MONTH"); //$NON-NLS-1$
- supportedFunctions.add("MONTHNAME"); //$NON-NLS-1$
- //supportedFunctions.add("NOW"); //$NON-NLS-1$
- supportedFunctions.add("QUARTER"); //$NON-NLS-1$
- supportedFunctions.add("SECOND"); //$NON-NLS-1$
- supportedFunctions.add("TIMESTAMPADD"); //$NON-NLS-1$
- supportedFunctions.add("TIMESTAMPDIFF"); //$NON-NLS-1$
- supportedFunctions.add("WEEK"); //$NON-NLS-1$
- supportedFunctions.add("YEAR"); //$NON-NLS-1$
- supportedFunctions.add("CAST"); //$NON-NLS-1$
- supportedFunctions.add("CONVERT"); //$NON-NLS-1$
- supportedFunctions.add("IFNULL"); //$NON-NLS-1$
- supportedFunctions.add("NVL"); //$NON-NLS-1$
-
- return supportedFunctions;
- }
-
- public boolean supportsInlineViews() {
- return true;
- }
-
- /**
- * @see org.teiid.connector.api.ConnectorCapabilities#supportsFunctionsInGroupBy()
- * @since 5.0
- */
- public boolean supportsFunctionsInGroupBy() {
- return true;
- }
-
- public boolean supportsRowLimit() {
- return true;
- }
-
- @Override
- public boolean supportsIntersect() {
- return true;
- }
-
- public boolean supportsExcept() {
- return true;
- };
-}
Deleted:
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SqlServerSQLTranslator.java
===================================================================
---
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SqlServerSQLTranslator.java 2010-04-08
02:41:01 UTC (rev 2036)
+++
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SqlServerSQLTranslator.java 2010-04-08
15:33:59 UTC (rev 2037)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-/*
- */
-package org.teiid.connector.jdbc.sqlserver;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.teiid.connector.api.ConnectorCapabilities;
-import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.api.TypeFacility;
-import org.teiid.connector.jdbc.sybase.SybaseSQLTranslator;
-import org.teiid.connector.language.ColumnReference;
-import org.teiid.connector.language.Function;
-import org.teiid.connector.language.LanguageObject;
-
-/**
- * Updated to assume the use of the DataDirect, 2005 driver, or later.
- */
-public class SqlServerSQLTranslator extends SybaseSQLTranslator {
-
- //TEIID-31 remove mod modifier for SQL Server 2008
-
- @Override
- protected List<Object> convertDateToString(Function function) {
- return Arrays.asList("replace(convert(varchar, ",
function.getParameters().get(0), ", 102), '.', '-')");
//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- @Override
- protected List<?> convertTimestampToString(Function function) {
- return Arrays.asList("convert(varchar, ", function.getParameters().get(0),
", 21)"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- @Override
- public Class<? extends ConnectorCapabilities> getDefaultCapabilities() {
- return SqlServerCapabilities.class;
- }
-
- @Override
- public List<?> translate(LanguageObject obj, ExecutionContext context) {
- if (obj instanceof ColumnReference) {
- ColumnReference elem = (ColumnReference)obj;
- if (TypeFacility.RUNTIME_TYPES.STRING.equals(elem.getType()) &&
elem.getMetadataObject() != null &&
"uniqueidentifier".equalsIgnoreCase(elem.getMetadataObject().getNativeType())) {
//$NON-NLS-1$
- return Arrays.asList("cast(", elem, " as char(36))");
//$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- return super.translate(obj, context);
- }
-
-}
Modified:
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sqlserver/TestSqlServerConversionVisitor.java
===================================================================
---
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sqlserver/TestSqlServerConversionVisitor.java 2010-04-08
02:41:01 UTC (rev 2036)
+++
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sqlserver/TestSqlServerConversionVisitor.java 2010-04-08
15:33:59 UTC (rev 2037)
@@ -46,7 +46,7 @@
*/
public class TestSqlServerConversionVisitor {
- private static SqlServerSQLTranslator trans = new SqlServerSQLTranslator();
+ private static SQLServerSQLTranslator trans = new SQLServerSQLTranslator();
@BeforeClass
public static void setup() throws ConnectorException {
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-04-08
02:41:01 UTC (rev 2036)
+++
trunk/engine/src/main/java/org/teiid/dqp/internal/process/RequestWorkItem.java 2010-04-08
15:33:59 UTC (rev 2037)
@@ -243,10 +243,8 @@
}
protected void processMore() throws BlockedException, MetaMatrixCoreException {
- if (this.processor != null) {
- this.processor.getContext().setTimeSliceEnd(System.currentTimeMillis() +
this.processorTimeslice);
- }
if (!doneProducingBatches) {
+ this.processor.getContext().setTimeSliceEnd(System.currentTimeMillis() +
this.processorTimeslice);
sendResultsIfNeeded(null);
collector.collectTuples();
doneProducingBatches = this.resultsBuffer.isFinal();
@@ -287,25 +285,21 @@
protected void attemptClose() {
int rowcount = -1;
if (this.resultsBuffer != null) {
- if (this.processor != null) {
- this.processor.closeProcessing();
- }
+ this.processor.closeProcessing();
if (LogManager.isMessageToBeRecorded(LogConstants.CTX_DQP, MessageLevel.DETAIL)) {
LogManager.logDetail(LogConstants.CTX_DQP, "Removing tuplesource for the
request " + requestID); //$NON-NLS-1$
}
rowcount = resultsBuffer.getRowCount();
- if (this.processor != null) {
- if (this.cid == null || !this.doneProducingBatches) {
- resultsBuffer.remove();
- } else {
- boolean sessionScope =
this.processor.getContext().isSessionFunctionEvaluated();
- CachedResults cr = new CachedResults();
- cr.setCommand(originalCommand);
- cr.setAnalysisRecord(analysisRecord);
- cr.setResults(this.resultsBuffer);
- dqpCore.getRsCache().put(cid, sessionScope, cr);
- }
+ if (this.cid == null || !this.doneProducingBatches) {
+ resultsBuffer.remove();
+ } else {
+ boolean sessionScope =
this.processor.getContext().isSessionFunctionEvaluated();
+ CachedResults cr = new CachedResults();
+ cr.setCommand(originalCommand);
+ cr.setAnalysisRecord(analysisRecord);
+ cr.setResults(this.resultsBuffer);
+ dqpCore.getRsCache().put(cid, sessionScope, cr);
}
for (DataTierTupleSource connectorRequest : this.connectorInfo.values()) {
@@ -313,7 +307,6 @@
}
this.resultsBuffer = null;
- this.processor = null;
for (LobWorkItem lobWorkItem : this.lobStreams.values()) {
lobWorkItem.close();
@@ -381,7 +374,6 @@
doneProducingBatches = true;
resultsBuffer.close();
this.cid = null;
- this.processor = null;
}
this.returnsUpdateCount = request.returnsUpdateCount;
request = null;
@@ -446,12 +438,10 @@
// send any warnings with the response object
List<Throwable> responseWarnings = new ArrayList<Throwable>();
- if (this.processor != null) {
- List<Exception> currentWarnings = processor.getAndClearWarnings();
- if (currentWarnings != null) {
- responseWarnings.addAll(currentWarnings);
- }
- }
+ List<Exception> currentWarnings = processor.getAndClearWarnings();
+ if (currentWarnings != null) {
+ responseWarnings.addAll(currentWarnings);
+ }
synchronized (warnings) {
responseWarnings.addAll(this.warnings);
this.warnings.clear();
Modified:
trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestTPCR.java
===================================================================
---
trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestTPCR.java 2010-04-08
02:41:01 UTC (rev 2036)
+++
trunk/test-integration/common/src/test/java/org/teiid/dqp/internal/process/TestTPCR.java 2010-04-08
15:33:59 UTC (rev 2037)
@@ -26,7 +26,7 @@
import java.util.List;
import org.teiid.connector.jdbc.oracle.OracleCapabilities;
-import org.teiid.connector.jdbc.sqlserver.SqlServerCapabilities;
+import org.teiid.connector.jdbc.sqlserver.SQLServerCapabilities;
import org.teiid.dqp.internal.datamgr.impl.CapabilitiesConverter;
import com.metamatrix.core.util.UnitTestUtil;
@@ -113,7 +113,7 @@
public void testQueryCase3047() throws Exception{
FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
finder.addCapabilities("TPCR_Ora",
CapabilitiesConverter.convertCapabilities(new OracleCapabilities())); //$NON-NLS-1$
- finder.addCapabilities("TPCR_SQLS",
CapabilitiesConverter.convertCapabilities(new SqlServerCapabilities())); //$NON-NLS-1$
+ finder.addCapabilities("TPCR_SQLS",
CapabilitiesConverter.convertCapabilities(new SQLServerCapabilities())); //$NON-NLS-1$
HardcodedDataManager dataMgr = new HardcodedDataManager();
@@ -153,7 +153,7 @@
public void testQueryCase3047workaround() throws Exception{
FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
finder.addCapabilities("TPCR_Ora",
CapabilitiesConverter.convertCapabilities(new OracleCapabilities())); //$NON-NLS-1$
- finder.addCapabilities("TPCR_SQLS",
CapabilitiesConverter.convertCapabilities(new SqlServerCapabilities())); //$NON-NLS-1$
+ finder.addCapabilities("TPCR_SQLS",
CapabilitiesConverter.convertCapabilities(new SQLServerCapabilities())); //$NON-NLS-1$
HardcodedDataManager dataMgr = new HardcodedDataManager();
@@ -197,7 +197,7 @@
public void testDefect22475() throws Exception {
FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
- finder.addCapabilities("TPCR_Oracle_9i",
CapabilitiesConverter.convertCapabilities(new SqlServerCapabilities())); //$NON-NLS-1$
+ finder.addCapabilities("TPCR_Oracle_9i",
CapabilitiesConverter.convertCapabilities(new SQLServerCapabilities())); //$NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan("select S_ACCTBAL, S_NAME,
N_NAME, P_PARTKEY, P_MFGR, S_ADDRESS, S_PHONE, S_COMMENT from (SELECT SUPPLIER.S_ACCTBAL,
SUPPLIER.S_NAME, NATION.N_NAME, PART.P_PARTKEY, PART.P_MFGR, SUPPLIER.S_ADDRESS,
SUPPLIER.S_PHONE, SUPPLIER.S_COMMENT FROM PART, SUPPLIER, PARTSUPP, NATION, REGION WHERE
(PART.P_PARTKEY = PS_PARTKEY) AND (S_SUPPKEY = PS_SUPPKEY) AND (P_SIZE = 15) AND (P_TYPE
LIKE '%BRASS') AND (S_NATIONKEY = N_NATIONKEY) AND (N_REGIONKEY = R_REGIONKEY) AND
(R_NAME = 'EUROPE') AND (PS_SUPPLYCOST = (SELECT MIN(PS_SUPPLYCOST) FROM PARTSUPP,
SUPPLIER, NATION, REGION WHERE (PART.P_PARTKEY = PS_PARTKEY) AND (S_SUPPKEY = PS_SUPPKEY)
AND (S_NATIONKEY = N_NATIONKEY) AND (N_REGIONKEY = R_REGIONKEY) AND (R_NAME =
'EUROPE'))) ORDER BY SUPPLIER.S_ACCTBAL DESC, NATION.N_NAME, SUPPLIER.S_NAME,
PART.P_PARTKEY) as x", //$NON-NLS-1$
METADATA, null, finder,