[teiid-commits] teiid SVN: r525 - in trunk: common-core/src/main/java/com/metamatrix/common/types/basic and 45 other directories.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Mon Mar 2 18:22:01 EST 2009
Author: shawkins
Date: 2009-03-02 18:22:00 -0500 (Mon, 02 Mar 2009)
New Revision: 525
Added:
trunk/common-core/src/main/java/com/metamatrix/common/types/SourceTransform.java
Removed:
trunk/connector-api/src/main/java/org/teiid/connector/api/ValueTranslator.java
trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicValueTranslator.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCExecutionHelper.java
trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/extension/value/JavaUtilDateValueTranslator.java
Modified:
trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java
trunk/common-core/src/main/java/com/metamatrix/common/types/XMLType.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/AnyToObjectTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/AnyToStringTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/util/TimestampWithTimezone.java
trunk/common-core/src/test/java/com/metamatrix/common/types/TestDataTypeManager.java
trunk/common-core/src/test/java/com/metamatrix/common/util/TestTimestampWithTimezone.java
trunk/connector-api/src/main/java/org/teiid/connector/api/ProcedureExecution.java
trunk/connector-api/src/main/java/org/teiid/connector/api/TypeFacility.java
trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicConnector.java
trunk/connector-api/src/main/java/org/teiid/connector/language/IProcedure.java
trunk/connector-api/src/main/resources/org/teiid/connector/i18n.properties
trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/MetadataProcedureExecution.java
trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectSynchExecution.java
trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/internal/ObjectProcedure.java
trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/internal/ObjectProcedureProcessor.java
trunk/connector-metadata/src/test/java/com/metamatrix/connector/metadata/internal/TestObjectProcedure.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCProcedureExecution.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCQueryExecution.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceConnection.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/access/AccessSQLTranslator.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLTranslator.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseSQLTranslator.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/FunctionModifier.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/Translator.java
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleTranslator.java
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sqlserver/TestSqlServerConversionVisitor.java
trunk/connectors/connector-loopback/src/main/java/com/metamatrix/connector/loopback/LoopbackExecution.java
trunk/connectors/connector-loopback/src/test/java/com/metamatrix/connector/loopback/TestLoopbackExecution.java
trunk/connectors/connector-text/src/main/java/com/metamatrix/connector/text/TextSynchExecution.java
trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestMultiFileTextSynchExecution.java
trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestTextSynchExecution.java
trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/ValueConvertor.java
trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/XMLSourceExecution.java
trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/soap/SoapExecution.java
trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xmlsource/file/TestFileExecution.java
trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xmlsource/soap/TestSoapExecution.java
trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectProcedureExecution.java
trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/extension/ISourceTranslator.java
trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/extension/source/BasicSourceTranslator.java
trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/util/ObjectExecutionHelper.java
trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorWorkItem.java
trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ProcedureBatchHandler.java
trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/TypeFacilityImpl.java
trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/language/ProcedureImpl.java
trunk/engine/src/main/java/com/metamatrix/dqp/message/AtomicResultsMessage.java
trunk/engine/src/main/java/com/metamatrix/query/function/FunctionLibrary.java
trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java
trunk/engine/src/main/java/com/metamatrix/query/sql/lang/Command.java
trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/FakeProcedureExecution.java
trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/TestConnectorWorkItem.java
trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestDataTierManager.java
trunk/engine/src/test/java/com/metamatrix/query/function/TestFunctionLibrary.java
trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java
trunk/metadata/src/main/java/com/metamatrix/metadata/runtime/api/MetadataConstants.java
trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/util/TestJDBCExecutionHelper.java
trunk/test-integration/src/test/java/com/metamatrix/data/metadata/runtime/TestMetadataInConnector.java
trunk/test-integration/src/test/java/com/metamatrix/jdbc/TestMMDatabaseMetaData.java
Log:
TEIID-164 TEIID-161 TEIID-390 adding a common type conversion facility for connectors and functions. fixed loopback procedure execution. Also cleaned up calendar caching.
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -25,8 +25,10 @@
import java.sql.Blob;
import java.sql.Clob;
import java.sql.SQLXML;
+import java.sql.Timestamp;
import java.util.Arrays;
import java.util.Collections;
+import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -149,13 +151,15 @@
* Map of a type to the list of types that type may be converted to
* implicitly
*/
- private static Map implicitConversions = new HashMap();
+ private static Map<String, List<String>> implicitConversions = new HashMap<String, List<String>>();
/**
* Map of a type to the list of types that type may be converted to
* implicitly OR explicitly
*/
- private static Map explicitConversions = new HashMap();
+ private static Map<String, List<String>> explicitConversions = new HashMap<String, List<String>>();
+
+ private static Map<Class<?>, SourceTransform> sourceConverters = new HashMap<Class<?>, SourceTransform>();
// Static initializer - loads basic transforms types
static {
@@ -170,6 +174,8 @@
// Load allowed conversions
loadExplicitConversions();
+
+ loadSourceConversions();
}
/**
@@ -443,7 +449,7 @@
* @param transform
* New transform to add
*/
- public static void addTransform(Transform transform) {
+ static void addTransform(Transform transform) {
ArgCheck.isNotNull(transform);
String sourceName = transform.getSourceTypeName();
String targetName = transform.getTargetTypeName();
@@ -456,32 +462,32 @@
innerMap.put(targetName, transform);
}
- public static void setImplicitConversions(String type, List conversions) {
+ static void setImplicitConversions(String type, List<String> conversions) {
implicitConversions.put(type, conversions);
}
- public static List getImplicitConversions(String type) {
- return (List) implicitConversions.get(type);
+ public static List<String> getImplicitConversions(String type) {
+ return implicitConversions.get(type);
}
public static boolean isImplicitConversion(String srcType, String tgtType) {
- List conversions = (List) implicitConversions.get(srcType);
+ List<String> conversions = implicitConversions.get(srcType);
if (conversions != null) {
return conversions.contains(tgtType);
}
return false;
}
- public static void setExplicitConversions(String type, List conversions) {
+ static void setExplicitConversions(String type, List<String> conversions) {
explicitConversions.put(type, conversions);
}
- public static List getExplicitConversions(String type) {
- return (List) explicitConversions.get(type);
+ public static List<String> getExplicitConversions(String type) {
+ return explicitConversions.get(type);
}
public static boolean isExplicitConversion(String srcType, String tgtType) {
- List conversions = (List) explicitConversions.get(srcType);
+ List<String> conversions = explicitConversions.get(srcType);
if (conversions != null) {
return conversions.contains(tgtType);
}
@@ -964,42 +970,85 @@
DataTypeManager.setExplicitConversions(DefaultDataTypes.XML, Arrays
.asList(new String[] { DefaultDataTypes.STRING }));
}
-
+
+ static void loadSourceConversions() {
+ sourceConverters.put(Clob.class, new SourceTransform<Clob, ClobType>() {
+ @Override
+ public ClobType transform(Clob value) {
+ return new ClobType(value);
+ }
+ });
+ sourceConverters.put(char[].class, new SourceTransform<char[], ClobType>() {
+ @Override
+ public ClobType transform(char[] value) {
+ return new ClobType(new ClobImpl(value));
+ }
+ });
+ sourceConverters.put(Blob.class, new SourceTransform<Blob, BlobType>() {
+ @Override
+ public BlobType transform(Blob value) {
+ return new BlobType(value);
+ }
+ });
+ sourceConverters.put(byte[].class, new SourceTransform<byte[], BlobType>() {
+ @Override
+ public BlobType transform(byte[] value) {
+ return new BlobType(new BlobImpl(value));
+ }
+ });
+ sourceConverters.put(SQLXML.class, new SourceTransform<SQLXML, XMLType>() {
+ @Override
+ public XMLType transform(SQLXML value) {
+ return new XMLType(value);
+ }
+ });
+ sourceConverters.put(DOMSource.class, new SourceTransform<DOMSource, XMLType>() {
+ @Override
+ public XMLType transform(DOMSource value) {
+ return new XMLType(new SQLXMLImpl(value));
+ }
+ });
+ sourceConverters.put(SAXSource.class, new SourceTransform<SAXSource, XMLType>() {
+ @Override
+ public XMLType transform(SAXSource value) {
+ return new XMLType(new SQLXMLImpl(value));
+ }
+ });
+ sourceConverters.put(StreamSource.class, new SourceTransform<StreamSource, XMLType>() {
+ @Override
+ public XMLType transform(StreamSource value) {
+ return new XMLType(new SQLXMLImpl(value));
+ }
+ });
+ sourceConverters.put(Date.class, new SourceTransform<Date, Timestamp>() {
+ @Override
+ public Timestamp transform(Date value) {
+ return new Timestamp(value.getTime());
+ }
+ });
+ }
+
public static Object convertToRuntimeType(Object value) {
if (value == null) {
return null;
}
- if (getAllDataTypeClasses().contains(value.getClass())) {
+ Class<?> c = value.getClass();
+ if (getAllDataTypeClasses().contains(c)) {
return value;
}
- if (value instanceof Clob) {
- return new ClobType((Clob) value);
+ SourceTransform t = sourceConverters.get(c);
+ if (t != null) {
+ return t.transform(value);
}
- if (value instanceof char[]) {
- return new ClobType(new ClobImpl((char[]) value));
+ for (Map.Entry<Class<?>, SourceTransform> entry : sourceConverters.entrySet()) {
+ if (entry.getKey().isAssignableFrom(c)) {
+ return entry.getValue().transform(value);
+ }
}
- if (value instanceof Blob) {
- return new BlobType((Blob) value);
- }
- if (value instanceof byte[]) {
- return new BlobType(new BlobImpl((byte[]) value));
- }
- if (value instanceof SQLXML) {
- SQLXML xml = (SQLXML) value;
- return new XMLType(xml);
- }
- if (value instanceof DOMSource) {
- return new XMLType(new SQLXMLImpl((DOMSource) value));
- }
- if (value instanceof StreamSource) {
- return new XMLType(new SQLXMLImpl((StreamSource) value));
- }
- if (value instanceof SAXSource) {
- return new XMLType(new SQLXMLImpl((SAXSource) value));
- }
return value; // "object type"
}
+ @SuppressWarnings("unchecked")
public static <T> T transformValue(Object value, Class<T> targetClass)
throws TransformationException {
if (value == null) {
@@ -1008,6 +1057,7 @@
return transformValue(value, value.getClass(), targetClass);
}
+ @SuppressWarnings("unchecked")
public static <T> T transformValue(Object value, Class sourceType,
Class<T> targetClass) throws TransformationException {
if (value == null || sourceType == targetClass) {
Added: trunk/common-core/src/main/java/com/metamatrix/common/types/SourceTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/SourceTransform.java (rev 0)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/SourceTransform.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -0,0 +1,37 @@
+/*
+ * 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 com.metamatrix.common.types;
+
+public interface SourceTransform<S, T> {
+
+ /**
+ * This method transforms a value of the source type into a value
+ * of the target type.
+ * @param value Incoming value of source type
+ * @return Outgoing value of target type
+ * @throws TransformationException if value is an incorrect input type or
+ * the transformation fails
+ */
+ public T transform(S value);
+
+}
Property changes on: trunk/common-core/src/main/java/com/metamatrix/common/types/SourceTransform.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/XMLType.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/XMLType.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/XMLType.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -39,7 +39,7 @@
* class used everywhere in the MetaMatrix framework, but clients are restricted to use
* only SQLXML interface on top of this.
*/
-public class XMLType implements Streamable, SQLXML {
+public final class XMLType implements Streamable, SQLXML {
private transient SQLXML srcXML;
private String referenceStreamId;
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/AnyToObjectTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/AnyToObjectTransform.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/AnyToObjectTransform.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -59,12 +59,4 @@
return DataTypeManager.DefaultDataClasses.OBJECT;
}
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return false;
- }
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/AnyToStringTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/AnyToStringTransform.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/AnyToStringTransform.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -57,7 +57,11 @@
return null;
}
- return value.toString();
+ String result = value.toString();
+ if (result != null && result.length() > DataTypeManager.MAX_STRING_LENGTH) {
+ return result.substring(0, DataTypeManager.MAX_STRING_LENGTH);
+ }
+ return result;
}
}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/util/TimestampWithTimezone.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/util/TimestampWithTimezone.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/common-core/src/main/java/com/metamatrix/common/util/TimestampWithTimezone.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -44,6 +44,21 @@
*
*/
public class TimestampWithTimezone {
+
+ private static ThreadLocal<Calendar> CALENDAR = new ThreadLocal<Calendar>() {
+ protected Calendar initialValue() {
+ return Calendar.getInstance();
+ }
+ };
+
+ public static Calendar getCalendar() {
+ return CALENDAR.get();
+ }
+
+ public static void resetCalendar(TimeZone tz) {
+ TimeZone.setDefault(tz);
+ CALENDAR.set(Calendar.getInstance());
+ }
public static Object create(java.util.Date date, TimeZone initial, Calendar target, Class type) {
if (type.equals(DataTypeManager.DefaultDataClasses.TIME)) {
@@ -57,7 +72,7 @@
public static Timestamp createTimestamp(java.util.Date date, TimeZone initial, Calendar target) {
if (target == null) {
- target = Calendar.getInstance();
+ target = getCalendar();
}
long time = target.getTimeInMillis();
@@ -78,7 +93,7 @@
public static Time createTime(java.util.Date date, TimeZone initial, Calendar target) {
if (target == null) {
- target = Calendar.getInstance();
+ target = getCalendar();
}
long time = target.getTimeInMillis();
@@ -93,7 +108,7 @@
public static Date createDate(java.util.Date date, TimeZone initial, Calendar target) {
if (target == null) {
- target = Calendar.getInstance();
+ target = getCalendar();
}
long time = target.getTimeInMillis();
@@ -116,7 +131,7 @@
if (date instanceof Time) {
return (Time)date;
}
- Calendar cal = Calendar.getInstance();
+ Calendar cal = getCalendar();
cal.setTime(date);
return normalizeTime(date, cal);
}
@@ -131,7 +146,7 @@
if (date instanceof Date) {
return (Date)date;
}
- Calendar cal = Calendar.getInstance();
+ Calendar cal = getCalendar();
cal.setTime(date);
return normalizeDate(date, cal);
}
@@ -185,9 +200,4 @@
target.set(i, cal.get(i));
}
}
-
- public static void resetCalendar(TimeZone tz) {
- TimeZone.setDefault(tz);
- }
-
}
\ No newline at end of file
Modified: trunk/common-core/src/test/java/com/metamatrix/common/types/TestDataTypeManager.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/common/types/TestDataTypeManager.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/common-core/src/test/java/com/metamatrix/common/types/TestDataTypeManager.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -133,13 +133,8 @@
}
/** Test determine data type for an unknown object type - should be typed as an OBJECT. */
- public void testDetermineDataType3() {
- java.net.URL url = null;
- try {
- url = new java.net.URL("http://fake"); //$NON-NLS-1$
- } catch(Throwable e) {
- fail("Failed to create valid test url"); //$NON-NLS-1$
- }
+ public void testDetermineDataType3() throws Exception {
+ java.net.URL url = new java.net.URL("http://fake"); //$NON-NLS-1$
helpDetermineDataType(url, DataTypeManager.DefaultDataClasses.OBJECT);
}
Modified: trunk/common-core/src/test/java/com/metamatrix/common/util/TestTimestampWithTimezone.java
===================================================================
--- trunk/common-core/src/test/java/com/metamatrix/common/util/TestTimestampWithTimezone.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/common-core/src/test/java/com/metamatrix/common/util/TestTimestampWithTimezone.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -45,11 +45,11 @@
}
public void setUp() {
- TimeZone.setDefault(TimeZone.getTimeZone("America/Chicago")); //$NON-NLS-1$
+ TimestampWithTimezone.resetCalendar(TimeZone.getTimeZone("America/Chicago")); //$NON-NLS-1$
}
public void tearDown() {
- TimeZone.setDefault(null);
+ TimestampWithTimezone.resetCalendar(null);
}
/**
Modified: trunk/connector-api/src/main/java/org/teiid/connector/api/ProcedureExecution.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/ProcedureExecution.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/ProcedureExecution.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -22,7 +22,7 @@
package org.teiid.connector.api;
-import org.teiid.connector.language.IParameter;
+import java.util.List;
/**
* The procedure execution represents the case where a connector can
@@ -34,11 +34,11 @@
public interface ProcedureExecution extends ResultSetExecution {
/**
- * Get the output parameter value for the given parameter.
- * @param parameter The parameter (either OUT or INOUT direction)
- * @return The value or null if null
+ * Get the output parameter values. Results should place the return parameter
+ * first if it is present, then the IN/OUT and OUT parameters should follow in
+ * the order they appeared in the command.
* @throws ConnectorException If an error occurs while retrieving the output value
*/
- Object getOutputValue(IParameter parameter) throws ConnectorException;
+ List<?> getOutputParameterValues() throws ConnectorException;
}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/api/TypeFacility.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/TypeFacility.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/TypeFacility.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -92,29 +92,6 @@
}
/**
- * Checks if the given transformation exists.
- * @param <S>
- * @param <T>
- * @param sourceClass
- * @param targetClass
- * @return
- */
- public abstract <S, T> boolean hasTransformation(Class<S> sourceClass, Class<T> targetClass);
-
- /**
- * Transform the given value into the target type, or throw an exception if this is not
- * possible.
- * @param <S>
- * @param <T>
- * @param value
- * @param sourceClass
- * @param targetClass
- * @return
- * @throws ConnectorException
- */
- public abstract <S, T> T transformValue(S value, Class<S> sourceClass, Class<T> targetClass) throws ConnectorException;
-
- /**
* Convert the given value to the closest runtime type see {@link RUNTIME_TYPES}
* @param value
* @return
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/api/ValueTranslator.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/api/ValueTranslator.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connector-api/src/main/java/org/teiid/connector/api/ValueTranslator.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -1,39 +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.api;
-
-
-/**
- * A ValueTranslator knows how to convert an object value of a given source type
- * into a target type.
- */
-public interface ValueTranslator<S, T> {
-
- Class<S> getSourceType();
-
- Class<T> getTargetType();
-
- T translate(S value, ExecutionContext context) throws ConnectorException;
-}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicConnector.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicConnector.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicConnector.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -37,15 +37,23 @@
String user = credMap.getUser(connectorName);
String password = credMap.getPassword(connectorName);
if (user == null || password == null) {
- throw new ConnectorException("Payload missing credentials for " + connectorName); //$NON-NLS-1$
+ throw new ConnectorException(DataPlugin.Util.getString("UserIdentityFactory.missing_credentials", connectorName)); //$NON-NLS-1$
}
return new MappedUserIdentity(context.getUser(), user, password);
}
+ public String getConnectorName() {
+ return connectorName;
+ }
+
public void setConnectorName(String connectorName) {
this.connectorName = connectorName;
}
+ public boolean useCredentialMap() {
+ return useCredentialMap;
+ }
+
public void setUseCredentialMap(boolean useCredentialMap) {
this.useCredentialMap = useCredentialMap;
}
Deleted: trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicValueTranslator.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicValueTranslator.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connector-api/src/main/java/org/teiid/connector/basic/BasicValueTranslator.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -1,66 +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.basic;
-
-import org.teiid.connector.DataPlugin;
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.api.TypeFacility;
-import org.teiid.connector.api.ValueTranslator;
-
-/**
- * BasicValueTranslator can translate between types using the standard {@link TypeFacility}
- * transformations.
- */
-public class BasicValueTranslator<S, T> implements ValueTranslator<S, T> {
- private Class<S> sourceType;
- private Class<T> targetType;
- private TypeFacility typeFacility;
-
- public static <S, T> BasicValueTranslator<S, T> createTranslator(Class<S> sourceType, Class<T> targetType, TypeFacility typeFacility) {
- return new BasicValueTranslator<S, T>(sourceType, targetType, typeFacility);
- }
-
- public BasicValueTranslator(Class<S> sourceType, Class<T> targetType, TypeFacility typeFacility) {
- this.sourceType = sourceType;
- this.targetType = targetType;
- this.typeFacility = typeFacility;
- }
-
- public Class<S> getSourceType() {
- return this.sourceType;
- }
-
- public Class<T> getTargetType() {
- return this.targetType;
- }
-
- public T translate(S value, ExecutionContext context) throws ConnectorException {
- if (typeFacility.hasTransformation(sourceType, targetType)) {
- return (T)typeFacility.transformValue(value, sourceType, targetType);
- }
- throw new ConnectorException(DataPlugin.Util.getString("ValueTranslator.no_tranfrom_found", new Object[] {this.sourceType, this.targetType}));
- }
-}
Modified: trunk/connector-api/src/main/java/org/teiid/connector/language/IProcedure.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/language/IProcedure.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connector-api/src/main/java/org/teiid/connector/language/IProcedure.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -24,6 +24,7 @@
import java.util.List;
+import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.metadata.runtime.Procedure;
@@ -50,5 +51,13 @@
* @param name The name of the procedure
*/
void setProcedureName(String name);
+
+ /**
+ * Get the procedure result set column types
+ * @return an array containing the types or an empty array if there is no
+ * result set parameter
+ * @throws ConnectorException
+ */
+ Class<?>[] getResultSetColumnTypes() throws ConnectorException;
}
Modified: trunk/connector-api/src/main/resources/org/teiid/connector/i18n.properties
===================================================================
--- trunk/connector-api/src/main/resources/org/teiid/connector/i18n.properties 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connector-api/src/main/resources/org/teiid/connector/i18n.properties 2009-03-02 23:22:00 UTC (rev 525)
@@ -60,4 +60,5 @@
unknown_object_type_to_tranfrom_xml=Unknown object type supplied to transform into SQLXML.
UserIdentityFactory.single_identity_not_supported=Single identity is not supported by the UserIdentityFactory. A context is required.
-UserIdentityFactory.extraction_error=Unable to extract credentials from command payload or trusted session payload for per-user connection.
\ No newline at end of file
+UserIdentityFactory.extraction_error=Unable to extract credentials from command payload or trusted session payload for per-user connection.
+UserIdentityFactory.missing_credentials=Payload missing credentials for {0}
\ No newline at end of file
Modified: trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/MetadataProcedureExecution.java
===================================================================
--- trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/MetadataProcedureExecution.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/MetadataProcedureExecution.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -29,9 +29,7 @@
import org.teiid.connector.api.DataNotAvailableException;
import org.teiid.connector.api.ProcedureExecution;
import org.teiid.connector.basic.BasicExecution;
-import org.teiid.connector.language.IParameter;
import org.teiid.connector.language.IProcedure;
-import org.teiid.connector.language.IParameter.Direction;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
import com.metamatrix.connector.metadata.internal.IObjectSource;
@@ -86,16 +84,9 @@
return null;
}
- /**
- * @see org.teiid.connector.api.ProcedureExecution#getOutputValue(org.teiid.connector.language.IParameter)
- * @since 4.2
- */
- public Object getOutputValue(final IParameter parameter) throws ConnectorException {
- if(parameter.getDirection() != Direction.OUT && parameter.getDirection() != Direction.INOUT && parameter.getDirection() != Direction.RETURN){
- throw new ConnectorException(MetadataConnectorPlugin.Util.getString("ObjectProcedureExecution.0")); //$NON-NLS-1$
- }
- //TODO: Output parameters are not currently handled
- return null;
+ @Override
+ public List<?> getOutputParameterValues() throws ConnectorException {
+ throw new UnsupportedOperationException();
}
/**
Modified: trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectSynchExecution.java
===================================================================
--- trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectSynchExecution.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/adapter/ObjectSynchExecution.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -79,7 +79,6 @@
if(this.queryResults == null) {
return null;
}
- int count = 0;
if (queryResults.hasNext()) {
return (List)queryResults.next();
}
Modified: trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/internal/ObjectProcedure.java
===================================================================
--- trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/internal/ObjectProcedure.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/internal/ObjectProcedure.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -232,24 +232,6 @@
}
/**
- * Check the value at the given index on a row in the resultSet
- * has the same type as the column type
- * @since 4.2
- */
- public void checkType(final int columnIndex, final Object value) {
- if (value != null) {
- if (columnTypes != null && !columnTypes[columnIndex].isAssignableFrom(value.getClass())) {
- throw new MetaMatrixRuntimeException(
- MetadataConnectorPlugin.Util.getString(
- "ObjectQuery.Type_mismatch", //$NON-NLS-1$
- new Object[] {columnNames[columnIndex],
- columnTypes[columnIndex].getName(),
- value.getClass().getName()}));
- }
- }
- }
-
- /**
* Get the type of the column on the resultSet of the procedure at
* the given index.
* @param columnIndex The type of the column at the given index.
Modified: trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/internal/ObjectProcedureProcessor.java
===================================================================
--- trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/internal/ObjectProcedureProcessor.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connector-metadata/src/main/java/com/metamatrix/connector/metadata/internal/ObjectProcedureProcessor.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -33,10 +33,8 @@
import org.teiid.connector.api.ConnectorException;
-import com.metamatrix.common.types.BlobType;
import com.metamatrix.common.types.ClobImpl;
import com.metamatrix.common.types.ClobType;
-import com.metamatrix.common.types.DataTypeManager;
import com.metamatrix.common.vdb.api.VDBFile;
import com.metamatrix.connector.metadata.MetadataConnectorConstants;
import com.metamatrix.connector.metadata.ResultsIterator;
@@ -174,12 +172,6 @@
throw new RuntimeException(e);
}
}
-
- value = DataTypeManager.convertToRuntimeType(value);
- } else if(type.equals(BlobType.class)) {
- value = DataTypeManager.convertToRuntimeType(value);
- } else {
- this.procedure.checkType(i, value);
}
newRow.add(value);
}
Modified: trunk/connector-metadata/src/test/java/com/metamatrix/connector/metadata/internal/TestObjectProcedure.java
===================================================================
--- trunk/connector-metadata/src/test/java/com/metamatrix/connector/metadata/internal/TestObjectProcedure.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connector-metadata/src/test/java/com/metamatrix/connector/metadata/internal/TestObjectProcedure.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -76,21 +76,6 @@
assertEquals("proc", proc.getProcedureNameInSource()); //$NON-NLS-1$
}
- public void testTypeCheckingMatch() throws Exception {
- ObjectProcedure proc = getProcedure("exec proc (\"x\", \"y\", 1)"); //$NON-NLS-1$
- proc.checkType(0, "String"); //$NON-NLS-1$
- }
-
- public void testTypeCheckingDoesNotMatch() throws Exception {
- ObjectProcedure proc = getProcedure("exec proc (\"x\", \"y\", 1)"); //$NON-NLS-1$
- try {
- proc.checkType(0, new Integer(0));
- fail();
- } catch (MetaMatrixRuntimeException e) {
- assertEquals("Types do not match for: col1 expected: java.lang.String but was: java.lang.Integer.", e.getMessage()); //$NON-NLS-1$
- }
- }
-
public void testGetColumnNames() throws Exception {
ObjectProcedure proc = getProcedure("exec proc (\"x\", \"y\", 1)"); //$NON-NLS-1$
assertEquals("col1", proc.getColumnNames()[0]); //$NON-NLS-1$
Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCExecutionHelper.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCExecutionHelper.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCExecutionHelper.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -1,100 +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;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.api.TypeFacility;
-import org.teiid.connector.api.ValueTranslator;
-import org.teiid.connector.basic.BasicValueTranslator;
-
-
-/**
- */
-public class JDBCExecutionHelper {
-
-
- public static Object convertValue(Object value, Class expectedType, List valueTranslators, TypeFacility typeFacility, boolean trimStrings, ExecutionContext context) throws ConnectorException {
- if(expectedType.isAssignableFrom(value.getClass())){
- return value;
- }
- ValueTranslator translator = determineTransformation(value.getClass(), expectedType, valueTranslators, typeFacility);
- Object result = translator.translate(value, context);
- if(trimStrings && result instanceof String){
- result = trimString((String)result);
- }
- return result;
- }
-
- /**
- * @param actualType
- * @param expectedType
- * @return Transformation between actual and expected type
- */
- public static ValueTranslator determineTransformation(Class actualType, Class expectedType, List valueTranslators, TypeFacility typeFacility) throws ConnectorException {
- ValueTranslator valueTranslator = null;
-
- //check valueTranslators first
- if(valueTranslators != null && !valueTranslators.isEmpty()){
- Iterator iter = valueTranslators.iterator();
- while(iter.hasNext()){
- ValueTranslator translator = (ValueTranslator)iter.next();
-
- //Evaluate expressions in this order for performance.
- if(expectedType.equals(translator.getTargetType()) && translator.getSourceType().isAssignableFrom(actualType)){
- valueTranslator = translator;
- break;
- }
- }
- }
-
- if(valueTranslator == null){
- valueTranslator = new BasicValueTranslator(actualType, expectedType, typeFacility);
- }
- return valueTranslator;
- }
-
- /**
- * Expects string to never be null
- * @param value Incoming value
- * @return Right trimmed value
- * @since 4.2
- */
- public static String trimString(String value) {
- for(int i=value.length()-1; i>=0; i--) {
- if(value.charAt(i) != ' ') {
- // end of trim, return what's left
- return value.substring(0, i+1);
- }
- }
-
- // All spaces, so trim it all
- return ""; //$NON-NLS-1$
- }
-
-}
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCProcedureExecution.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCProcedureExecution.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCProcedureExecution.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -24,12 +24,11 @@
import java.sql.CallableStatement;
import java.sql.Connection;
+import java.sql.ParameterMetaData;
import java.sql.SQLException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
+import java.sql.Types;
+import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import java.util.Properties;
import org.teiid.connector.api.ConnectorEnvironment;
@@ -38,23 +37,21 @@
import org.teiid.connector.api.DataNotAvailableException;
import org.teiid.connector.api.ExecutionContext;
import org.teiid.connector.api.ProcedureExecution;
+import org.teiid.connector.api.TypeFacility;
import org.teiid.connector.jdbc.translator.TranslatedCommand;
import org.teiid.connector.jdbc.translator.Translator;
import org.teiid.connector.language.ICommand;
import org.teiid.connector.language.IParameter;
import org.teiid.connector.language.IProcedure;
import org.teiid.connector.language.IParameter.Direction;
-import org.teiid.connector.metadata.runtime.Element;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
-
/**
*/
public class JDBCProcedureExecution extends JDBCQueryExecution implements ProcedureExecution {
- private Map parameterIndexMap;
- private RuntimeMetadata metadata;
-
+ private ParameterMetaData parameterMetaData;
+
/**
* @param connection
* @param sqlTranslator
@@ -70,13 +67,12 @@
RuntimeMetadata metadata, ExecutionContext context,
ConnectorEnvironment env) {
super(command, connection, sqlTranslator, logger, props, context, env);
- this.metadata = metadata;
}
@Override
public void execute() throws ConnectorException {
IProcedure procedure = (IProcedure)command;
- columnDataTypes = getColumnDataTypes(procedure.getParameters(), metadata);
+ columnDataTypes = procedure.getResultSetColumnTypes();
//translate command
TranslatedCommand translatedComm = translateCommand(procedure);
@@ -85,113 +81,64 @@
String sql = translatedComm.getSql();
try{
//create parameter index map
- parameterIndexMap = createParameterIndexMap(procedure.getParameters(), sql);
CallableStatement cstmt = getCallableStatement(sql);
- results = sqlTranslator.executeStoredProcedure(cstmt, translatedComm);
+ this.parameterMetaData = cstmt.getParameterMetaData();
+ this.results = sqlTranslator.executeStoredProcedure(cstmt, translatedComm);
if (results != null) {
initResultSetInfo();
}
addStatementWarnings();
}catch(SQLException e){
- throw new ConnectorException(e, JDBCPlugin.Util.getString("JDBCQueryExecution.Error_executing_query__1", sql));
+ throw new ConnectorException(e, JDBCPlugin.Util.getString("JDBCQueryExecution.Error_executing_query__1", sql)); //$NON-NLS-1$
}
}
@Override
- public List next() throws ConnectorException, DataNotAvailableException {
+ public List<?> next() throws ConnectorException, DataNotAvailableException {
if (results == null) {
return null;
}
return super.next();
}
-
- /**
- * @param results
- * @return
- */
- public static Class[] getColumnDataTypes(List params, RuntimeMetadata metadata) throws ConnectorException {
- if (params != null) {
- IParameter resultSet = null;
- Iterator iter = params.iterator();
- while(iter.hasNext()){
- IParameter param = (IParameter)iter.next();
- if(param.getDirection() == Direction.RESULT_SET){
- resultSet = param;
- break;
- }
- }
-
- if(resultSet != null){
- List<Element> columnMetadata = resultSet.getMetadataObject().getChildren();
-
- int size = columnMetadata.size();
- Class[] coulmnDTs = new Class[size];
- for(int i =0; i<size; i++ ){
- coulmnDTs[i] = columnMetadata.get(i).getJavaType();
- }
- return coulmnDTs;
- }
-
- }
- return new Class[0];
- }
-
- /**
- * @param parameters List of IParameter
- * @param sql
- * @return Map of IParameter to index in sql.
- */
- public static Map createParameterIndexMap(List parameters, String sql) {
- if(parameters == null || parameters.isEmpty()){
- return Collections.EMPTY_MAP;
- }
- Map paramsIndexes = new HashMap();
- int index = 1;
- //return parameter, if there is any, is the first parameter
- Iterator iter = parameters.iterator();
- while(iter.hasNext()){
- IParameter param = (IParameter)iter.next();
- if(param.getDirection() == Direction.RETURN){
- paramsIndexes.put(param, new Integer(index++));
- break;
- }
- }
-
- iter = parameters.iterator();
- while(iter.hasNext()){
- IParameter param = (IParameter)iter.next();
- if(param.getDirection() != Direction.RESULT_SET && param.getDirection() != Direction.RETURN){
- paramsIndexes.put(param, new Integer(index++));
- }
- }
- return paramsIndexes;
- }
-
- /*
- * @see com.metamatrix.data.ProcedureExecution#getOutputValue(com.metamatrix.data.language.IParameter)
- */
- public Object getOutputValue(IParameter parameter) throws ConnectorException {
- if(parameter.getDirection() != Direction.OUT && parameter.getDirection() != Direction.INOUT && parameter.getDirection() != Direction.RETURN){
- throw new ConnectorException(JDBCPlugin.Util.getString("JDBCProcedureExecution.The_parameter_direction_must_be_out_or_inout_1")); //$NON-NLS-1$
- }
-
- Integer index = (Integer)this.parameterIndexMap.get(parameter);
- if(index == null){
- //should not come here
- throw new ConnectorException(JDBCPlugin.Util.getString("JDBCProcedureExecution.Unexpected_exception_1")); //$NON-NLS-1$
- }
+ @Override
+ public List<?> getOutputParameterValues() throws ConnectorException {
try {
- Object value = sqlTranslator.retrieveValue((CallableStatement)this.statement, index.intValue(), parameter.getType());
- if(value == null){
- return null;
- }
- Object result = JDBCExecutionHelper.convertValue(value, parameter.getType(), this.sqlTranslator.getValueTranslators(), this.sqlTranslator.getTypeFacility(), trimString, context);
- return result;
+ IProcedure proc = (IProcedure)this.command;
+ List<Object> result = new ArrayList<Object>();
+ int paramIndex = 1;
+ for (IParameter parameter : proc.getParameters()) {
+ if (parameter.getDirection() == Direction.RETURN) {
+ addParameterValue(result, paramIndex, parameter);
+ break;
+ }
+ }
+ for (IParameter parameter : proc.getParameters()) {
+ if (parameter.getDirection() == Direction.RETURN || parameter.getDirection() == Direction.RESULT_SET) {
+ continue;
+ }
+ paramIndex++;
+ if (parameter.getDirection() == Direction.INOUT || parameter.getDirection() == Direction.OUT) {
+ addParameterValue(result, paramIndex, parameter);
+ }
+ }
+ return result;
} catch (SQLException e) {
throw new ConnectorException(e);
}
}
+
+ private void addParameterValue(List<Object> result, int paramIndex,
+ IParameter parameter) throws SQLException {
+ Object value = sqlTranslator.retrieveValue((CallableStatement)this.statement, paramIndex, parameter.getType());
+ if (value != null
+ && TypeFacility.RUNTIME_TYPES.STRING.equals(value.getClass())
+ && (trimString || (parameterMetaData != null && parameterMetaData
+ .getParameterType(paramIndex) == Types.CHAR))) {
+ value = trimString((String)value);
+ }
+ result.add(value);
+ }
}
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCQueryExecution.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCQueryExecution.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCQueryExecution.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -41,8 +41,6 @@
import org.teiid.connector.api.DataNotAvailableException;
import org.teiid.connector.api.ExecutionContext;
import org.teiid.connector.api.ResultSetExecution;
-import org.teiid.connector.api.TypeFacility;
-import org.teiid.connector.api.ValueTranslator;
import org.teiid.connector.jdbc.translator.TranslatedCommand;
import org.teiid.connector.jdbc.translator.Translator;
import org.teiid.connector.language.ICommand;
@@ -59,13 +57,10 @@
// ===========================================================================================================================
protected ResultSet results;
- protected Class[] columnDataTypes;
protected ConnectorEnvironment env;
protected ICommand command;
- private boolean[] transformKnown;
- private ValueTranslator[] transforms;
+ protected Class<?>[] columnDataTypes;
private boolean[] trimColumn;
- private int[] nativeTypes;
// ===========================================================================================================================
// Constructors
@@ -111,56 +106,27 @@
protected void initResultSetInfo() throws SQLException {
trimColumn = new boolean[columnDataTypes.length];
- nativeTypes = new int[columnDataTypes.length];
ResultSetMetaData rsmd = results.getMetaData();
for(int i=0; i<columnDataTypes.length; i++) {
- nativeTypes[i] = rsmd.getColumnType(i+1);
- if ((nativeTypes[i] == Types.BLOB && (columnDataTypes[i] == TypeFacility.RUNTIME_TYPES.BLOB || columnDataTypes[i] == TypeFacility.RUNTIME_TYPES.OBJECT))
- || (nativeTypes[i] == Types.CLOB && (columnDataTypes[i] == TypeFacility.RUNTIME_TYPES.CLOB || columnDataTypes[i] == TypeFacility.RUNTIME_TYPES.OBJECT))) {
- context.keepExecutionAlive(true);
- }
-
if(columnDataTypes[i].equals(String.class)) {
- if(trimString || nativeTypes[i] == Types.CHAR) {
- trimColumn[i] = true;
- }
+ trimColumn[i] = trimString || rsmd.getColumnType(i+1) == Types.CHAR;
}
}
-
- transformKnown = new boolean[columnDataTypes.length];
- transforms = new ValueTranslator[columnDataTypes.length];
}
@Override
- public List next() throws ConnectorException, DataNotAvailableException {
+ public List<?> next() throws ConnectorException, DataNotAvailableException {
try {
if (results.next()) {
// New row for result set
- List vals = new ArrayList(columnDataTypes.length);
+ List<Object> vals = new ArrayList<Object>(columnDataTypes.length);
for (int i = 0; i < columnDataTypes.length; i++) {
// Convert from 0-based to 1-based
Object value = sqlTranslator.retrieveValue(results, i+1, columnDataTypes[i]);
- if(value != null) {
- // Determine transformation if unknown
- if(! transformKnown[i]) {
- Class valueType = value.getClass();
- if(!columnDataTypes[i].isAssignableFrom(valueType)) {
- transforms[i] = JDBCExecutionHelper.determineTransformation(valueType, columnDataTypes[i], sqlTranslator.getValueTranslators(), sqlTranslator.getTypeFacility());
- }
- transformKnown[i] = true;
- }
-
- // Transform value if necessary
- if(transforms[i] != null) {
- value = transforms[i].translate(value, context);
- }
-
- // Trim string column if necessary
- if(trimColumn[i]) {
- value = JDBCExecutionHelper.trimString((String) value);
- }
+ if (trimColumn[i] && value instanceof String) {
+ value = trimString((String)value);
}
vals.add(value);
}
@@ -176,6 +142,24 @@
}
/**
+ * Expects string to never be null
+ * @param value Incoming value
+ * @return Right trimmed value
+ * @since 4.2
+ */
+ public static String trimString(String value) {
+ for(int i=value.length()-1; i>=0; i--) {
+ if(value.charAt(i) != ' ') {
+ // end of trim, return what's left
+ return value.substring(0, i+1);
+ }
+ }
+
+ // All spaces, so trim it all
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
* @see org.teiid.connector.jdbc.JDBCBaseExecution#close()
*/
public void close() throws ConnectorException {
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceConnection.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceConnection.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceConnection.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -35,6 +35,7 @@
import org.teiid.connector.api.ProcedureExecution;
import org.teiid.connector.api.ResultSetExecution;
import org.teiid.connector.api.UpdateExecution;
+import org.teiid.connector.basic.BasicConnection;
import org.teiid.connector.jdbc.translator.Translator;
import org.teiid.connector.language.ICommand;
import org.teiid.connector.language.IProcedure;
@@ -45,7 +46,7 @@
/**
*
*/
-public class JDBCSourceConnection extends org.teiid.connector.basic.BasicConnection {
+public class JDBCSourceConnection extends BasicConnection {
protected java.sql.Connection physicalConnection;
protected ConnectorEnvironment environment;
private ConnectorLogger logger;
@@ -123,9 +124,4 @@
return true;
}
- @Override
- public void closeCalled() {
-
- }
-
}
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/access/AccessSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/access/AccessSQLTranslator.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/access/AccessSQLTranslator.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -24,24 +24,11 @@
*/
package org.teiid.connector.jdbc.access;
-import java.util.ArrayList;
-import java.util.List;
+import org.teiid.connector.jdbc.sybase.SybaseSQLTranslator;
-import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.jdbc.translator.Translator;
-import org.teiid.connector.language.ICommand;
-import org.teiid.connector.language.ILimit;
-import org.teiid.connector.language.IOrderBy;
-import org.teiid.connector.language.IQueryCommand;
-
-public class AccessSQLTranslator extends Translator {
+public class AccessSQLTranslator extends SybaseSQLTranslator {
- @Override
- public boolean hasTimeType() {
- return false;
- }
-
@Override
public String translateLiteralBoolean(Boolean booleanValue) {
if(booleanValue.booleanValue()) {
@@ -51,31 +38,6 @@
}
@Override
- public List<?> translateCommand(ICommand command, ExecutionContext context) {
- if (!(command instanceof IQueryCommand)) {
- return null;
- }
- IQueryCommand queryCommand = (IQueryCommand)command;
- if (queryCommand.getLimit() == null) {
- return null;
- }
- ILimit limit = queryCommand.getLimit();
- IOrderBy orderBy = queryCommand.getOrderBy();
- queryCommand.setLimit(null);
- queryCommand.setOrderBy(null);
- List<Object> parts = new ArrayList<Object>(6);
- parts.add("SELECT TOP ");
- parts.add(limit.getRowLimit());
- parts.add(" * FROM (");
- parts.add(queryCommand);
- parts.add(") AS X");
- if (orderBy != null) {
- parts.add(orderBy);
- }
- return parts;
- }
-
- @Override
public boolean addSourceComment() {
return false;
}
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLTranslator.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLTranslator.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -40,8 +40,6 @@
import org.teiid.connector.language.IAggregate;
import org.teiid.connector.language.ICommand;
import org.teiid.connector.language.ILimit;
-import org.teiid.connector.language.IOrderBy;
-import org.teiid.connector.language.ISetQuery;
import org.teiid.connector.visitor.framework.HierarchyVisitor;
import org.teiid.connector.visitor.util.SQLReservedWords;
@@ -55,32 +53,32 @@
public void initialize(ConnectorEnvironment env) throws ConnectorException {
super.initialize(env);
- registerFunctionModifier(SourceSystemFunctions.LOG, new AliasModifier("ln")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.LOG10, new AliasModifier("log")); //$NON-NLS-1$ //$NON-NLS-2$
+ registerFunctionModifier(SourceSystemFunctions.LOG, new AliasModifier("ln")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.LOG10, new AliasModifier("log")); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.CHAR, new AliasModifier("chr")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.CONCAT, new AliasModifier("||")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.LCASE, new AliasModifier("lower")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.LEFT, new LeftOrRightFunctionModifier(getLanguageFactory()));//$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.RIGHT, new LeftOrRightFunctionModifier(getLanguageFactory()));//$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.SUBSTRING, new AliasModifier("substr")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.UCASE, new AliasModifier("upper")); //$NON-NLS-1$ //$NON-NLS-2$
+ registerFunctionModifier(SourceSystemFunctions.CHAR, new AliasModifier("chr")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.CONCAT, new AliasModifier("||")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.LCASE, new AliasModifier("lower")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.LEFT, new LeftOrRightFunctionModifier(getLanguageFactory()));
+ registerFunctionModifier(SourceSystemFunctions.RIGHT, new LeftOrRightFunctionModifier(getLanguageFactory()));
+ registerFunctionModifier(SourceSystemFunctions.SUBSTRING, new AliasModifier("substr")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.UCASE, new AliasModifier("upper")); //$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.DAYNAME, new MonthOrDayNameFunctionModifier(getLanguageFactory(), "Day"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.DAYOFWEEK, new ModifiedDatePartFunctionModifier(getLanguageFactory(), "dow", "+", new Integer(1)));//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new DatePartFunctionModifier(getLanguageFactory(), "day"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.DAYOFYEAR, new DatePartFunctionModifier(getLanguageFactory(), "doy"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.HOUR, new DatePartFunctionModifier(getLanguageFactory(), "hour"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.MINUTE, new DatePartFunctionModifier(getLanguageFactory(), "minute"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.MONTH, new DatePartFunctionModifier(getLanguageFactory(), "month"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.MONTHNAME, new MonthOrDayNameFunctionModifier(getLanguageFactory(), "Month"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.QUARTER, new DatePartFunctionModifier(getLanguageFactory(), "quarter"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.SECOND, new DatePartFunctionModifier(getLanguageFactory(), "second"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.WEEK, new DatePartFunctionModifier(getLanguageFactory(), "week"));//$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.YEAR, new DatePartFunctionModifier(getLanguageFactory(), "year"));//$NON-NLS-1$ //$NON-NLS-2$
+ registerFunctionModifier(SourceSystemFunctions.DAYNAME, new MonthOrDayNameFunctionModifier(getLanguageFactory(), "Day"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.DAYOFWEEK, new ModifiedDatePartFunctionModifier(getLanguageFactory(), "dow", "+", new Integer(1)));//$NON-NLS-1$ //$NON-NLS-2$
+ registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new DatePartFunctionModifier(getLanguageFactory(), "day"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.DAYOFYEAR, new DatePartFunctionModifier(getLanguageFactory(), "doy"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.HOUR, new DatePartFunctionModifier(getLanguageFactory(), "hour"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.MINUTE, new DatePartFunctionModifier(getLanguageFactory(), "minute"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.MONTH, new DatePartFunctionModifier(getLanguageFactory(), "month"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.MONTHNAME, new MonthOrDayNameFunctionModifier(getLanguageFactory(), "Month"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.QUARTER, new DatePartFunctionModifier(getLanguageFactory(), "quarter"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.SECOND, new DatePartFunctionModifier(getLanguageFactory(), "second"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.WEEK, new DatePartFunctionModifier(getLanguageFactory(), "week"));//$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.YEAR, new DatePartFunctionModifier(getLanguageFactory(), "year"));//$NON-NLS-1$
- registerFunctionModifier(SourceSystemFunctions.IFNULL, new AliasModifier("coalesce")); //$NON-NLS-1$ //$NON-NLS-2$
- registerFunctionModifier(SourceSystemFunctions.CONVERT, new PostgreSQLConvertModifier(getLanguageFactory())); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.IFNULL, new AliasModifier("coalesce")); //$NON-NLS-1$
+ registerFunctionModifier(SourceSystemFunctions.CONVERT, new PostgreSQLConvertModifier(getLanguageFactory()));
}
@Override
@@ -103,7 +101,7 @@
@Override
public String translateLiteralTimestamp(Timestamp timestampValue) {
- return "to_timestamp('" + formatDateValue(timestampValue) + "', 'YYYY-MM-DD HH24:MI:SS.US')"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ return "to_timestamp('" + formatDateValue(timestampValue) + "', 'YYYY-MM-DD HH24:MI:SS.US')"; //$NON-NLS-1$//$NON-NLS-2$
}
@Override
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseSQLTranslator.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseSQLTranslator.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -93,6 +93,7 @@
parts.add(queryCommand);
parts.add(") AS X");
if (orderBy != null) {
+ parts.add(" ");
parts.add(orderBy);
}
return parts;
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/FunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/FunctionModifier.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/FunctionModifier.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -28,6 +28,7 @@
import org.teiid.connector.language.IExpression;
import org.teiid.connector.language.IFunction;
+import org.teiid.connector.language.ILanguageObject;
/**
@@ -47,12 +48,12 @@
IExpression modify(IFunction function);
/**
- * Return a List of translated parts (LanguageObjects and Strings), or null
+ * Return a List of translated parts ({@link ILanguageObject}s and Objects), or null
* if this FunctionModifier wishes to rely on the default translation of the
* conversion visitor.
* @param function IFunction to be translated
* @return List of translated parts, or null
* @since 4.2
*/
- List translate(IFunction function);
+ List<?> translate(IFunction function);
}
Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/Translator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/Translator.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/Translator.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -33,7 +33,6 @@
import java.sql.Time;
import java.sql.Timestamp;
import java.text.MessageFormat;
-import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
@@ -45,15 +44,14 @@
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
import org.teiid.connector.api.TypeFacility;
-import org.teiid.connector.api.ValueTranslator;
import org.teiid.connector.internal.ConnectorPropertyNames;
import org.teiid.connector.jdbc.JDBCPlugin;
import org.teiid.connector.jdbc.JDBCPropertyNames;
import org.teiid.connector.language.ICommand;
-import org.teiid.connector.language.IFunction;
import org.teiid.connector.language.ILanguageFactory;
import org.teiid.connector.language.ILanguageObject;
import org.teiid.connector.language.ILimit;
+import org.teiid.connector.language.ILiteral;
import org.teiid.connector.language.IParameter;
import org.teiid.connector.language.ISetQuery;
import org.teiid.connector.language.IParameter.Direction;
@@ -99,19 +97,21 @@
TYPE_CODE_MAP.put(TypeFacility.RUNTIME_TYPES.CLOB, new Integer(CLOB_CODE));
}
- private static final MessageFormat COMMENT = new MessageFormat("/*teiid sessionid:{0}, requestid:{1}.{2}*/ "); //$NON-NLS-1$
+ private static final ThreadLocal<MessageFormat> COMMENT = new ThreadLocal<MessageFormat>() {
+ protected MessageFormat initialValue() {
+ return new MessageFormat("/*teiid sessionid:{0}, requestid:{1}.{2}*/ "); //$NON-NLS-1$
+ }
+ };
public final static TimeZone DEFAULT_TIME_ZONE = TimeZone.getDefault();
private static final ThreadLocal<Calendar> CALENDAR = new ThreadLocal<Calendar>();
private Map<String, FunctionModifier> functionModifiers = new HashMap<String, FunctionModifier>();
- private TimeZone databaseTimeZone;
private ConnectorEnvironment environment;
private boolean useComments;
private boolean usePreparedStatements;
- private List<ValueTranslator<?, ?>> valueTranslators = new ArrayList<ValueTranslator<?, ?>>();
private int maxResultRows = 0;
private TypeFacility typeFacility;
@@ -132,10 +132,11 @@
String timeZone = env.getProperties().getProperty(JDBCPropertyNames.DATABASE_TIME_ZONE);
if(timeZone != null && timeZone.trim().length() > 0) {
TimeZone tz = TimeZone.getTimeZone(timeZone);
- // Check that the dbms time zone is really different than the local time zone
if(!DEFAULT_TIME_ZONE.hasSameRules(tz)) {
- this.databaseTimeZone = tz;
- }
+ CALENDAR.set(Calendar.getInstance(tz));
+ } else {
+ CALENDAR.set(Calendar.getInstance());
+ }
}
this.useComments = PropertiesUtils.getBooleanProperty(env.getProperties(), JDBCPropertyNames.USE_COMMENTS_SOURCE_QUERY, false);
@@ -160,26 +161,27 @@
}
}
- public TimeZone getDatabaseTimeZone() {
- return databaseTimeZone;
- }
-
+ /**
+ * Gets the database calendar. This will be set to the time zone
+ * specified by the property {@link JDBCPropertyNames#DATABASE_TIME_ZONE}, or
+ * the local time zone if none is specified.
+ * @return
+ */
public Calendar getDatabaseCalendar() {
- if (this.databaseTimeZone == null) {
- return null;
- }
- Calendar cal = CALENDAR.get();
- if (cal == null) {
- cal = Calendar.getInstance(this.databaseTimeZone);
- CALENDAR.set(cal);
- }
- return cal;
+ return CALENDAR.get();
}
+ /**
+ * Gets the {@link ConnectorEnvironment} used to initialize this
+ * {@link Translator}
+ */
public final ConnectorEnvironment getEnvironment() {
return environment;
}
+ /**
+ * Gets the {@link ILanguageFactory}
+ */
public final ILanguageFactory getLanguageFactory() {
return environment.getLanguageFactory();
}
@@ -194,10 +196,24 @@
return command;
}
+ /**
+ * Return a List of translated parts ({@link ILanguageObject}s and Objects), or null
+ * if to rely on the default translation.
+ * @param command
+ * @param context
+ * @return
+ */
public List<?> translateCommand(ICommand command, ExecutionContext context) {
return null;
}
+ /**
+ * Return a List of translated parts ({@link ILanguageObject}s and Objects), or null
+ * if to rely on the default translation.
+ * @param limit
+ * @param context
+ * @return
+ */
public List<?> translateLimit(ILimit limit, ExecutionContext context) {
return null;
}
@@ -210,14 +226,15 @@
return functionModifiers;
}
+ /**
+ * Add the {@link FunctionModifier} to the set of known modifiers.
+ * @param name
+ * @param modifier
+ */
public void registerFunctionModifier(String name, FunctionModifier modifier) {
this.functionModifiers.put(name, modifier);
}
- public void registerValueTranslator(ValueTranslator<?, ?> translator) {
- this.valueTranslators.add(translator);
- }
-
/**
* Subclasses should override this method to provide a different sql translation
* of the literal boolean value. By default, a boolean literal is represented as:
@@ -247,6 +264,9 @@
* Subclasses should override this method to provide a different sql translation
* of the literal time value. By default, a time literal is represented as:
* <code>{t'23:59:59'}</code>
+ *
+ * See {@link Translator#hasTimeType()} to represent literal times as timestamps.
+ *
* @param timeValue Time value, never null
* @return Translated string
*/
@@ -261,6 +281,10 @@
* Subclasses should override this method to provide a different sql translation
* of the literal timestamp value. By default, a timestamp literal is
* represented as: <code>{ts'2002-12-31 23:59:59'}</code>.
+ *
+ * See {@link Translator#getTimestampNanoPrecision()} to control the literal
+ * precision.
+ *
* @param timestampValue Timestamp value, never null
* @return Translated string
*/
@@ -284,15 +308,14 @@
}
dateObject = newTs;
}
- Calendar cal = getDatabaseCalendar();
- if(cal == null) {
- return dateObject.toString();
- }
-
return getEnvironment().getTypeFacility().convertDate(dateObject,
- DEFAULT_TIME_ZONE, cal, dateObject.getClass()).toString();
+ DEFAULT_TIME_ZONE, getDatabaseCalendar(), dateObject.getClass()).toString();
}
+ /**
+ * Returns true to indicate that SQL should include a comment
+ * indicating the session and request ids.
+ */
public boolean addSourceComment() {
return useComments;
}
@@ -308,35 +331,70 @@
return true;
}
+ /**
+ * Use PreparedStatements (or CallableStatements) as
+ * appropriate for all commands. Bind values will be
+ * determined by the {@link BindValueVisitor}. {@link ILiteral#setBindValue(boolean)}
+ * can be used to force a literal to be a bind value.
+ */
public boolean usePreparedStatements() {
return this.usePreparedStatements;
}
+ /**
+ * Set to true to indicate that every branch of a set query
+ * should have parenthesis, i.e. (query) union (query)
+ * @return
+ */
public boolean useParensForSetQueries() {
return false;
}
+ /**
+ * Return false to indicate that time support should be emulated
+ * with timestamps.
+ * @return
+ */
public boolean hasTimeType() {
return true;
}
+ /**
+ * Returns the name for a given {@link ISetQuery.Operation}
+ * @param operation
+ * @return
+ */
public String getSetOperationString(ISetQuery.Operation operation) {
return operation.toString();
}
+ /**
+ * Returns the source comment for
+ * @param context
+ * @param command
+ * @return
+ */
public String getSourceComment(ExecutionContext context, ICommand command) {
if (addSourceComment() && context != null) {
- synchronized (COMMENT) {
- return COMMENT.format(new Object[] {context.getConnectionIdentifier(), context.getRequestIdentifier(), context.getPartIdentifier()});
- }
+ return COMMENT.get().format(new Object[] {context.getConnectionIdentifier(), context.getRequestIdentifier(), context.getPartIdentifier()});
}
return ""; //$NON-NLS-1$
}
+ /**
+ * Override to return a name other than the default [group.]element
+ * @param group
+ * @param element
+ * @return
+ */
public String replaceElementName(String group, String element) {
return null;
}
+ /**
+ * Return the precision of timestamp literals. Defaults to 9
+ * @return
+ */
public int getTimestampNanoPrecision() {
return 9;
}
@@ -398,13 +456,6 @@
}
/**
- * @see com.metamatrix.connector.jdbc.extension.ResultsTranslator#getValueTranslators()
- */
- public List getValueTranslators() {
- return valueTranslators;
- }
-
- /**
* For registering specific output parameter types we need to translate these into the appropriate
* java.sql.Types output parameters
* We will need to match these up with the appropriate standard sql types
@@ -435,7 +486,6 @@
}
private void setPreparedStatementValues(PreparedStatement stmt, List paramValues, List paramTypes) throws SQLException {
- Calendar cal = getDatabaseCalendar();
for (int i = 0; i< paramValues.size(); i++) {
Object parmvalue = paramValues.get(i);
Class paramType = (Class)paramTypes.get(i);
@@ -490,7 +540,6 @@
public int executeStatementForBulkInsert(Connection conn, PreparedStatement stmt, TranslatedCommand command) throws SQLException {
List rows = command.getPreparedValues();
- Calendar cal = getDatabaseCalendar();
int updateCount = 0;
for (int i = 0; i< rows.size(); i++) {
@@ -521,7 +570,7 @@
* @see com.metamatrix.connector.jdbc.extension.ValueRetriever#retrieveValue(java.sql.ResultSet, int, java.lang.Class, java.util.Calendar)
*/
public Object retrieveValue(ResultSet results, int columnIndex, Class expectedType) throws SQLException {
- Integer code = (Integer) TYPE_CODE_MAP.get(expectedType);
+ Integer code = TYPE_CODE_MAP.get(expectedType);
if(code != null) {
// Calling the specific methods here is more likely to get uniform (and fast) results from different
// data sources as the driver likely knows the best and fastest way to convert from the underlying
@@ -568,29 +617,17 @@
return new Float(value);
}
case TIME_CODE: {
- Calendar cal = getDatabaseCalendar();
- if (cal != null) {
- return results.getTime(columnIndex, cal);
- }
- return results.getTime(columnIndex);
+ return results.getTime(columnIndex, getDatabaseCalendar());
}
case DATE_CODE: {
- Calendar cal = getDatabaseCalendar();
- if (cal != null) {
- return results.getDate(columnIndex, cal);
- }
- return results.getDate(columnIndex);
+ return results.getDate(columnIndex, getDatabaseCalendar());
}
case TIMESTAMP_CODE: {
- Calendar cal = getDatabaseCalendar();
- if (cal != null) {
- return results.getTimestamp(columnIndex, cal);
- }
- return results.getTimestamp(columnIndex);
+ return results.getTimestamp(columnIndex, getDatabaseCalendar());
}
case BLOB_CODE: {
try {
- return typeFacility.convertToRuntimeType(results.getBlob(columnIndex));
+ return results.getBlob(columnIndex);
} catch (SQLException e) {
// ignore
}
@@ -598,20 +635,20 @@
}
case CLOB_CODE: {
try {
- return typeFacility.convertToRuntimeType(results.getClob(columnIndex));
+ return results.getClob(columnIndex);
} catch (SQLException e) {
// ignore
}
break;
- }
+ }
}
}
- return typeFacility.convertToRuntimeType(results.getObject(columnIndex));
+ return results.getObject(columnIndex);
}
public Object retrieveValue(CallableStatement results, int parameterIndex, Class expectedType) throws SQLException{
- Integer code = (Integer) TYPE_CODE_MAP.get(expectedType);
+ Integer code = TYPE_CODE_MAP.get(expectedType);
if(code != null) {
switch(code.intValue()) {
case INTEGER_CODE: {
@@ -653,36 +690,24 @@
return new Float(value);
}
case TIME_CODE: {
- Calendar cal = getDatabaseCalendar();
- if (cal != null) {
- return results.getTime(parameterIndex, cal);
- }
- return results.getTime(parameterIndex);
+ return results.getTime(parameterIndex, getDatabaseCalendar());
}
case DATE_CODE: {
- Calendar cal = getDatabaseCalendar();
- if (cal != null) {
- return results.getDate(parameterIndex, cal);
- }
- return results.getDate(parameterIndex);
+ return results.getDate(parameterIndex, getDatabaseCalendar());
}
case TIMESTAMP_CODE: {
- Calendar cal = getDatabaseCalendar();
- if (cal != null) {
- return results.getTimestamp(parameterIndex, cal);
- }
- return results.getTimestamp(parameterIndex);
+ return results.getTimestamp(parameterIndex, getDatabaseCalendar());
}
case BLOB_CODE: {
try {
- return typeFacility.convertToRuntimeType(results.getBlob(parameterIndex));
+ return results.getBlob(parameterIndex);
} catch (SQLException e) {
// ignore
}
}
case CLOB_CODE: {
try {
- return typeFacility.convertToRuntimeType(results.getClob(parameterIndex));
+ return results.getClob(parameterIndex);
} catch (SQLException e) {
// ignore
}
@@ -692,7 +717,7 @@
// otherwise fall through and call getObject() and rely on the normal
// translation routines
- return typeFacility.convertToRuntimeType(results.getObject(parameterIndex));
+ return results.getObject(parameterIndex);
}
protected void afterInitialConnectionCreation(Connection connection) {
Modified: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleTranslator.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleTranslator.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -24,15 +24,13 @@
import java.util.Properties;
+import junit.framework.TestCase;
+
import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.jdbc.access.AccessSQLTranslator;
-import org.teiid.connector.jdbc.oracle.OracleSQLTranslator;
import org.teiid.connector.jdbc.translator.TranslatedCommand;
import org.teiid.connector.jdbc.translator.Translator;
import org.teiid.connector.language.ICommand;
-import junit.framework.TestCase;
-
import com.metamatrix.cdk.api.EnvironmentUtility;
import com.metamatrix.cdk.unittest.FakeTranslationFactory;
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 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sqlserver/TestSqlServerConversionVisitor.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -104,4 +104,14 @@
output);
}
+ @Test
+ public void testUnionLimitWithOrderBy() throws Exception {
+ String input = "select intkey from bqt1.smalla union select intnum from bqt1.smalla order by intkey limit 100"; //$NON-NLS-1$
+ String output = "SELECT TOP 100 * FROM (SELECT SmallA.IntKey FROM SmallA UNION SELECT SmallA.IntNum FROM SmallA) AS X ORDER BY intkey"; //$NON-NLS-1$
+
+ helpTestVisitor(getBQTVDB(),
+ input,
+ output);
+ }
+
}
Modified: trunk/connectors/connector-loopback/src/main/java/com/metamatrix/connector/loopback/LoopbackExecution.java
===================================================================
--- trunk/connectors/connector-loopback/src/main/java/com/metamatrix/connector/loopback/LoopbackExecution.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/connector-loopback/src/main/java/com/metamatrix/connector/loopback/LoopbackExecution.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -43,7 +43,9 @@
import org.teiid.connector.basic.BasicExecution;
import org.teiid.connector.language.ICommand;
import org.teiid.connector.language.IParameter;
+import org.teiid.connector.language.IProcedure;
import org.teiid.connector.language.IQueryCommand;
+import org.teiid.connector.language.IParameter.Direction;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
@@ -103,7 +105,7 @@
}
}
- if(rowsReturned < rowsNeeded) {
+ if(rowsReturned < rowsNeeded && row.size() > 0) {
rowsReturned++;
return row;
}
@@ -170,15 +172,19 @@
ConnectorException {
return new int [] {0};
}
-
- /*
- * @see com.metamatrix.data.ProcedureExecution#getOutputValue(com.metamatrix.data.language.IParameter)
- */
+
@Override
- public Object getOutputValue(IParameter parameter) throws ConnectorException {
- return null;
+ public List<?> getOutputParameterValues() throws ConnectorException {
+ IProcedure proc = (IProcedure)this.command;
+ int count = 0;
+ for (IParameter param : proc.getParameters()) {
+ if (param.getDirection() == Direction.INOUT || param.getDirection() == Direction.OUT || param.getDirection() == Direction.RETURN) {
+ count++;
+ }
+ }
+ return Arrays.asList(new Object[count]);
}
-
+
/*
* @see com.metamatrix.data.Execution#close()
*/
@@ -201,6 +207,9 @@
IQueryCommand query = (IQueryCommand) command;
return Arrays.asList(query.getColumnTypes());
}
+ if (command instanceof IProcedure) {
+ return Arrays.asList(((IProcedure)command).getResultSetColumnTypes());
+ }
List types = new ArrayList();
types.add(Integer.class);
return types;
Modified: trunk/connectors/connector-loopback/src/test/java/com/metamatrix/connector/loopback/TestLoopbackExecution.java
===================================================================
--- trunk/connectors/connector-loopback/src/test/java/com/metamatrix/connector/loopback/TestLoopbackExecution.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/connector-loopback/src/test/java/com/metamatrix/connector/loopback/TestLoopbackExecution.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -49,11 +49,11 @@
}
public void helpTestQuery(String sql, TranslationUtility metadata, Object[][] expectedResults) throws ConnectorException {
- helpTestQuery(sql, metadata, 100, 0, 1, expectedResults);
+ helpTestQuery(sql, metadata, 0, 1, expectedResults);
}
- public void helpTestQuery(String sql, TranslationUtility metadata, int maxBatchSize, int waitTime, int rowCount, Object[][] expectedResults) throws ConnectorException {
- ConnectorHost host = new ConnectorHost(new LoopbackConnector(), exampleProperties(waitTime, rowCount), metadata);
+ public void helpTestQuery(String sql, TranslationUtility metadata, int waitTime, int rowCount, Object[][] expectedResults) throws ConnectorException {
+ ConnectorHost host = new ConnectorHost(new LoopbackConnector(), exampleProperties(waitTime, rowCount), metadata, false);
List actualResults = host.executeCommand(sql);
@@ -132,11 +132,17 @@
public void testExec() throws Exception {
Object[][] results = new Object[][] {
- new Object[] { new Integer(0) }
+ new Object[] { "ABCDEFGHIJ" } //$NON-NLS-1$
};
helpTestQuery("EXEC mmspTest1.MMSP1()", FakeTranslationFactory.getInstance().getBQTTranslationUtility(), results); //$NON-NLS-1$
}
+ public void testExecWithoutResultSet() throws Exception {
+ Object[][] results = new Object[][] {
+ };
+ helpTestQuery("exec pm4.spTest9(1)", FakeTranslationFactory.getInstance().getBQTTranslationUtility(), results); //$NON-NLS-1$
+ }
+
/**
* wait time is implemented as a random value up to the specified value. assertions are then not really possible
* based upon that time.
@@ -155,38 +161,11 @@
}
}
- public void helpTestBatching(int rowCount, int batchSize) throws Exception {
- Object[][] results = new Object[rowCount][];
- for(int i=0; i<rowCount; i++) {
- results[i] = new Object[] { new Integer(0) };
- }
- helpTestQuery("SELECT intkey FROM BQT1.SmallA", FakeTranslationFactory.getInstance().getBQTTranslationUtility(), batchSize, 0, rowCount, results); //$NON-NLS-1$
- }
-
- public void testBatch1() throws Exception {
- helpTestBatching(50, 100);
- }
-
- public void testBatch2() throws Exception {
- helpTestBatching(100, 100);
- }
-
- public void testBatch3() throws Exception {
- helpTestBatching(150, 100);
- }
-
- public void testBatch4() throws Exception {
- helpTestBatching(200, 100);
- }
-
- public void testBatch5() throws Exception {
- helpTestBatching(0, 100);
- }
-
public void testQueryWithLimit() throws Exception {
Object[][] expected = {{new Integer(0)},
{new Integer(0)},
{new Integer(0)}};
- helpTestQuery("SELECT intkey FROM BQT1.SmallA LIMIT 3", FakeTranslationFactory.getInstance().getBQTTranslationUtility(), 10, 0, 100, expected); //$NON-NLS-1$
+ helpTestQuery("SELECT intkey FROM BQT1.SmallA LIMIT 3", FakeTranslationFactory.getInstance().getBQTTranslationUtility(), 0, 100, expected); //$NON-NLS-1$
}
+
}
Modified: trunk/connectors/connector-text/src/main/java/com/metamatrix/connector/text/TextSynchExecution.java
===================================================================
--- trunk/connectors/connector-text/src/main/java/com/metamatrix/connector/text/TextSynchExecution.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/connector-text/src/main/java/com/metamatrix/connector/text/TextSynchExecution.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -29,6 +29,8 @@
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
+import java.sql.Date;
+import java.sql.Time;
import java.sql.Timestamp;
import java.text.ParseException;
import java.util.ArrayList;
@@ -871,38 +873,34 @@
return value;
}
- TypeFacility typeFacility = txtConn.env.getTypeFacility();
- if (typeFacility.hasTransformation(TypeFacility.RUNTIME_TYPES.STRING, type)) {
+ if (java.util.Date.class.isAssignableFrom(type)) {
+ //check defaults first
try {
- return typeFacility.transformValue(value, TypeFacility.RUNTIME_TYPES.STRING, type);
- } catch (ConnectorException e) {
- Object result = convertToDate(typeFacility, type, value);
- if (result != null) {
- return result;
- }
- throw e;
- }
+ return Timestamp.valueOf(value);
+ } catch (IllegalArgumentException e) {
+
+ }
+ try {
+ return Date.valueOf(value);
+ } catch (IllegalArgumentException e) {
+
+ }
+ try {
+ return Time.valueOf(value);
+ } catch (IllegalArgumentException e) {
+
+ }
+ //check for overrides
+ if (stringToDateTranslator!=null && stringToDateTranslator.hasFormatters()) {
+ try {
+ return new Timestamp(stringToDateTranslator.translateStringToDate(value).getTime());
+ }catch(ParseException ex) {
+ throw new ConnectorException(TextPlugin.Util.getString("TextSynchExecution.Unable_translate_String_to_Date", new Object[] { ex.getMessage() })); //$NON-NLS-1$
+ }
+ }
}
- else {
- throw new ConnectorException(TextPlugin.Util.getString("TextSynchExecution.Unable_get_Tranform", new Object[] { type.getName() })); //$NON-NLS-1$
- }
+ return value;
}
- private Object convertToDate(TypeFacility typeFacility, Class type, String value) throws ConnectorException {
- if (java.util.Date.class.isAssignableFrom(type) && stringToDateTranslator!=null && stringToDateTranslator.hasFormatters()) {
- try {
- Timestamp result = new Timestamp(stringToDateTranslator.translateStringToDate(value).getTime());
- if (typeFacility.hasTransformation(TypeFacility.RUNTIME_TYPES.TIMESTAMP, type)) {
- return typeFacility.transformValue(result, TypeFacility.RUNTIME_TYPES.TIMESTAMP, type);
- }
- else {
- throw new ConnectorException(TextPlugin.Util.getString("TextSynchExecution.Unable_get_Tranform", new Object[] { type.getName() })); //$NON-NLS-1$
- }
- }catch(ParseException ex) {
- throw new ConnectorException(TextPlugin.Util.getString("TextSynchExecution.Unable_translate_String_to_Date", new Object[] { ex.getMessage() })); //$NON-NLS-1$
- }
- }
- return null;
- }
}
Modified: trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestMultiFileTextSynchExecution.java
===================================================================
--- trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestMultiFileTextSynchExecution.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestMultiFileTextSynchExecution.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -73,22 +73,22 @@
// expected values
Set expected = new HashSet();
List value1 = new ArrayList();
- value1.add(new Integer(1));
+ value1.add(String.valueOf(1));
value1.add(TimestampUtil.createDate(103, 2, 25));
value1.add("Blind"); //$NON-NLS-1$
expected.add(value1);
List value2 = new ArrayList();
- value2.add(new Integer(2));
+ value2.add(String.valueOf(2));
value2.add(TimestampUtil.createDate(98, 3, 29));
value2.add("Antipop"); //$NON-NLS-1$
expected.add(value2);
List value3 = new ArrayList();
- value3.add(new Integer(3));
+ value3.add(String.valueOf(3));
value3.add(TimestampUtil.createDate(103, 2, 25));
value3.add("Terroist"); //$NON-NLS-1$
expected.add(value3);
List value4 = new ArrayList();
- value4.add(new Integer(4));
+ value4.add(String.valueOf(4));
value4.add(TimestampUtil.createDate(98, 3, 29));
value4.add("Fanatic"); //$NON-NLS-1$
expected.add(value4);
Modified: trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestTextSynchExecution.java
===================================================================
--- trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestTextSynchExecution.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/connector-text/src/test/java/com/metamatrix/connector/text/TestTextSynchExecution.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -39,8 +39,6 @@
public TestTextSynchExecution(String name) {
super(name);
- System.setProperty("metamatrix.config.none", "true");
-
}
public void testNextBatch2() throws Exception {
@@ -53,12 +51,12 @@
// expected values
List[] expected = new List[2];
List value1 = new ArrayList();
- value1.add(new Integer(1));
+ value1.add(String.valueOf(1));
value1.add(TimestampUtil.createDate(103, 2, 25));
value1.add("Blind"); //$NON-NLS-1$
List value2 = new ArrayList();
- value2.add(new Integer(2));
+ value2.add(String.valueOf(2));
value2.add(TimestampUtil.createDate(98, 3, 29));
value2.add("Antipop"); //$NON-NLS-1$
expected[0] = value1;
@@ -76,7 +74,7 @@
*/
public void testDefect13066() throws Exception {
String sql = "SELECT TRADEID FROM SummitData.SUMMITDATA"; //$NON-NLS-1$
- Util.helpTestExecution("summitData/TextFileTest_1.vdb", "SummitData_Descriptor.txt", sql, 500, 4139); //$NON-NLS-1$
+ Util.helpTestExecution("summitData/TextFileTest_1.vdb", "SummitData_Descriptor.txt", sql, 500, 4139); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -86,7 +84,7 @@
*/
public void testDefect13368() throws Exception {
String sql = "SELECT RATE, DESK FROM SummitData.SUMMITDATA"; //$NON-NLS-1$
- Util.helpTestExecution("summitData/TextFileTest_1.vdb", "SummitData_Descriptor.txt", sql, 5, 4139); //$NON-NLS-1$
+ Util.helpTestExecution("summitData/TextFileTest_1.vdb", "SummitData_Descriptor.txt", sql, 5, 4139); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -96,18 +94,18 @@
*/
public void testDefect13371() throws Exception {
String sql = " SELECT SUMMITEXTRACTCDM.START, SUMMITEXTRACTCDM.SUMMIT_ID, SUMMITEXTRACTCDM.CURRENCY, SUMMITEXTRACTCDM.AMOUNT, SUMMITEXTRACTCDM.MATURITY, SUMMITEXTRACTCDM.RATE, SUMMITEXTRACTCDM.DESK, SUMMITEXTRACTCDM.CDM_ID FROM SUMMITEXTRACTCDM"; //$NON-NLS-1$
- Util.helpTestExecution("summitData/TextFiles.vdb", "SummitExtractCDM_Descriptor.txt", sql, 500, 52); //$NON-NLS-1$
+ Util.helpTestExecution("summitData/TextFiles.vdb", "SummitExtractCDM_Descriptor.txt", sql, 500, 52); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testDefect11402() throws Exception {
String sql = "SELECT Part_ID, Part_Name, Part_Color, Part_Weight from PARTS.PARTS"; //$NON-NLS-1$
- Util.helpTestExecution("TextParts/TextParts.vdb", "/TextParts/PartsDescriptor.txt", sql, 15000, 21); //$NON-NLS-1$
+ Util.helpTestExecution("TextParts/TextParts.vdb", "/TextParts/PartsDescriptor.txt", sql, 15000, 21); //$NON-NLS-1$ //$NON-NLS-2$
}
/** test case 4151 */
public void testCase4151() throws Exception {
String sql = "SELECT COLA, COLB, COLC FROM ThreeColString_Text.testfile"; //$NON-NLS-1$
- Util.helpTestExecution("case4151/MM_00004151.vdb", "testfile-descriptor.txt", sql, 15000, 5); //$NON-NLS-1$
+ Util.helpTestExecution("case4151/MM_00004151.vdb", "testfile-descriptor.txt", sql, 15000, 5); //$NON-NLS-1$ //$NON-NLS-2$
}
}
Modified: trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/ValueConvertor.java
===================================================================
--- trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/ValueConvertor.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/base/ValueConvertor.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -24,8 +24,7 @@
package com.metamatrix.connector.xml.base;
-import java.text.MessageFormat;
-import java.util.ArrayList;
+import java.util.ArrayList;
import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ConnectorException;
@@ -53,23 +52,9 @@
if (type != java.lang.Character.class) {
newValue = newValue.replaceAll(",", ""); //$NON-NLS-1$ //$NON-NLS-2$
}
- return attemptTransformation(newValue, type, env);
+ return newValue;
}
- private static Object attemptTransformation(String value, Class type, ConnectorEnvironment env) throws ConnectorException {
- TypeFacility typeFacility = env.getTypeFacility();
-
- String newValue = value;
- if (typeFacility.hasTransformation(String.class, type)) {
- return typeFacility.transformValue(newValue, String.class, type);
- }
- else {
- String msgRaw = Messages.getString("XMLExecutionImpl.type.conversion.failure"); //$NON-NLS-1$
- String msg = MessageFormat.format(msgRaw, new Object[] { newValue,type });
- throw new ConnectorException(msg);
- }
- }
-
public static boolean compareData(LargeOrSmallString dataStr,
String compareStr, Element elementMetadata,
ConnectorEnvironment env, ExecutionContext ctx)
Modified: trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/XMLSourceExecution.java
===================================================================
--- trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/XMLSourceExecution.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/XMLSourceExecution.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -34,7 +34,6 @@
import org.teiid.connector.api.DataNotAvailableException;
import org.teiid.connector.api.ProcedureExecution;
import org.teiid.connector.basic.BasicExecution;
-import org.teiid.connector.language.IParameter;
@@ -62,7 +61,7 @@
}
Object result = env.getTypeFacility().convertToRuntimeType(value);
if (!(result instanceof SQLXML)) {
- throw new ConnectorException(DataPlugin.Util.getString("unknown_object_type_to_tranfrom_xml"));
+ throw new ConnectorException(DataPlugin.Util.getString("unknown_object_type_to_tranfrom_xml")); //$NON-NLS-1$
}
return (SQLXML)result;
}
@@ -70,7 +69,7 @@
protected abstract Source getReturnValue();
@Override
- public List next() throws ConnectorException, DataNotAvailableException {
+ public List<?> next() throws ConnectorException, DataNotAvailableException {
if (!returnedResult) {
returnedResult = true;
return Arrays.asList(convertToXMLType(getReturnValue()));
@@ -78,10 +77,8 @@
return null;
}
- /**
- * @see org.teiid.connector.api.ProcedureExecution#getOutputValue(org.teiid.connector.language.IParameter)
- */
- public Object getOutputValue(IParameter parameter) throws ConnectorException {
+ @Override
+ public List<?> getOutputParameterValues() throws ConnectorException {
throw new ConnectorException(XMLSourcePlugin.Util.getString("No_outputs_allowed")); //$NON-NLS-1$
}
Modified: trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/soap/SoapExecution.java
===================================================================
--- trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/soap/SoapExecution.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xmlsource/soap/SoapExecution.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -111,7 +111,6 @@
this.outputValues = new HashMap();
this.returnValue = operation.execute(args, outputValues);
- this.context.keepExecutionAlive(this.returnValue != null);
XMLSourcePlugin.logDetail(this.env.getLogger(), "xml_contents", new Object[] {this.returnValue}); //$NON-NLS-1$
} catch (OperationNotFoundException e) {
XMLSourcePlugin.logError(this.env.getLogger(), "soap_procedure_not_found", new Object[] {sourceProcedureName}, e); //$NON-NLS-1$
Modified: trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xmlsource/file/TestFileExecution.java
===================================================================
--- trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xmlsource/file/TestFileExecution.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xmlsource/file/TestFileExecution.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -34,9 +34,7 @@
import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.language.ILanguageFactory;
-import org.teiid.connector.language.IParameter;
import org.teiid.connector.language.IProcedure;
-import org.teiid.connector.language.IParameter.Direction;
import org.teiid.connector.metadata.runtime.Procedure;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
@@ -69,9 +67,8 @@
List result = exec.next();
assertNotNull(result);
assertNull(exec.next());
- IParameter returnParam = fact.createParameter(0, Direction.RETURN, null, null, null);
try {
- exec.getOutputValue(returnParam);
+ exec.getOutputParameterValues();
fail("should have thrown error in returning a return"); //$NON-NLS-1$
}catch(Exception e) {
}
Modified: trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xmlsource/soap/TestSoapExecution.java
===================================================================
--- trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xmlsource/soap/TestSoapExecution.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/connector-xml/src/test/java/com/metamatrix/connector/xmlsource/soap/TestSoapExecution.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -561,9 +561,8 @@
List result = exec.next();
assertNotNull(result);
assertNull(exec.next());
- IParameter returnParam = fact.createParameter(0, Direction.RETURN, null, null, null);
try {
- exec.getOutputValue(returnParam);
+ exec.getOutputParameterValues();
fail("should have thrown error in returning a return"); //$NON-NLS-1$
}catch(Exception e) {
}
Modified: trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectProcedureExecution.java
===================================================================
--- trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectProcedureExecution.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/ObjectProcedureExecution.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -103,15 +103,11 @@
return (List)results.get(index++);
}
-
- /**
- * @see org.teiid.connector.api.ProcedureExecution#getOutputValue(org.teiid.connector.language.IParameter)
- * @since 4.2
- */
- public Object getOutputValue(IParameter parameter) throws ConnectorException {
- return null;
+ @Override
+ public List<?> getOutputParameterValues() throws ConnectorException {
+ throw new UnsupportedOperationException();
}
-
+
public void cancel() {
//needs to be implemented
}
Modified: trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/extension/ISourceTranslator.java
===================================================================
--- trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/extension/ISourceTranslator.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/extension/ISourceTranslator.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -24,7 +24,6 @@
*/
package com.metamatrix.connector.object.extension;
-import java.util.List;
import java.util.TimeZone;
import org.teiid.connector.api.ConnectorEnvironment;
@@ -55,14 +54,6 @@
TimeZone getDatabaseTimezone();
/**
- * Get a list of ValueTranslator objects that specify database-specific value
- * translation logic. By default, the JDBC connector has a large set of available
- * translator.
- * @return List of ValueTranslator
- */
- List getValueTranslators();
-
- /**
* Used to specify a special value retriever. By default, the BasicValueRetriever
* will be used to retrieve objects via the getObject() method.
* @return The specialized ValueRetriever
Modified: trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/extension/source/BasicSourceTranslator.java
===================================================================
--- trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/extension/source/BasicSourceTranslator.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/extension/source/BasicSourceTranslator.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -24,14 +24,11 @@
*/
package com.metamatrix.connector.object.extension.source;
-import java.util.ArrayList;
-import java.util.List;
import java.util.TimeZone;
import org.teiid.connector.api.ConnectorEnvironment;
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.TypeFacility;
-import org.teiid.connector.api.ValueTranslator;
import org.teiid.connector.language.ICommand;
import org.teiid.connector.language.IProcedure;
import org.teiid.connector.metadata.runtime.RuntimeMetadata;
@@ -42,7 +39,6 @@
import com.metamatrix.connector.object.extension.IValueRetriever;
import com.metamatrix.connector.object.extension.command.ProcedureCommand;
import com.metamatrix.connector.object.extension.value.BasicValueRetriever;
-import com.metamatrix.connector.object.extension.value.JavaUtilDateValueTranslator;
/**
*/
@@ -50,7 +46,6 @@
private static final TimeZone LOCAL_TIME_ZONE = TimeZone.getDefault();
- private List valueTranslators = new ArrayList();
private IValueRetriever valueRetriever = new BasicValueRetriever();
private TimeZone dbmsTimeZone = null;
private TypeFacility typeFacility;
@@ -59,14 +54,10 @@
* @see com.metamatrix.connector.jdbc.extension.ResultsTranslator#initialize(com.metamatrix.data.ConnectorEnvironment)
*/
public void initialize(ConnectorEnvironment env) throws ConnectorException {
- ValueTranslator valueTranslator;
this.typeFacility = env.getTypeFacility();
- valueTranslator = new JavaUtilDateValueTranslator();
- addValueTranslator(valueTranslator);
-
String timeZone = env.getProperties().getProperty(ObjectPropertyNames.DATABASE_TIME_ZONE);
if(timeZone != null && timeZone.trim().length() > 0) {
this.dbmsTimeZone = TimeZone.getTimeZone(timeZone);
@@ -78,22 +69,10 @@
}
}
-
- /**
- * @see com.metamatrix.connector.jdbc.extension.ResultsTranslator#getValueTranslators()
- */
- public List getValueTranslators() {
- return valueTranslators;
- }
-
public IValueRetriever getValueRetriever() {
return valueRetriever;
}
- protected void addValueTranslator(ValueTranslator valueTranslator) {
- valueTranslators.add(valueTranslator);
- }
-
public TimeZone getDatabaseTimezone() {
return this.dbmsTimeZone;
}
Deleted: trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/extension/value/JavaUtilDateValueTranslator.java
===================================================================
--- trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/extension/value/JavaUtilDateValueTranslator.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/extension/value/JavaUtilDateValueTranslator.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -1,55 +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 com.metamatrix.connector.object.extension.value;
-
-import java.sql.Timestamp;
-import java.util.Date;
-
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.api.ValueTranslator;
-
-
-/**
- */
-public class JavaUtilDateValueTranslator implements ValueTranslator {
-
- public Class getSourceType() {
- return Date.class;
- }
-
- public Class getTargetType() {
- return Timestamp.class;
- }
-
- public Object translate(Object value, ExecutionContext context) throws ConnectorException {
- Date d = (Date) value;
- long dt = d.getTime();
-
- Timestamp ts = new Timestamp(dt);
- return ts;
- }
-
-}
Modified: trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/util/ObjectExecutionHelper.java
===================================================================
--- trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/util/ObjectExecutionHelper.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/connectors/sandbox/connector-object/src/main/java/com/metamatrix/connector/object/util/ObjectExecutionHelper.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -38,11 +38,8 @@
import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.ExecutionContext;
import org.teiid.connector.api.TypeFacility;
-import org.teiid.connector.api.ValueTranslator;
-import org.teiid.connector.basic.BasicValueTranslator;
import org.teiid.connector.visitor.util.SQLReservedWords;
-import com.metamatrix.common.util.TimestampWithTimezone;
import com.metamatrix.connector.object.ObjectPlugin;
import com.metamatrix.connector.object.extension.IObjectCommand;
import com.metamatrix.connector.object.extension.ISourceTranslator;
@@ -167,7 +164,6 @@
Class[] columnTypes = command.getResultColumnTypes();
List batch = new ArrayList(spResults.size());
- ValueTranslator transform = null;
// Move the result data to the query results
TimeZone dbmsTimeZone = resultsTranslator.getDatabaseTimezone();
@@ -187,14 +183,6 @@
int javaType = TypeFacility.getSQLTypeFromRuntimeType(valueType.getClass());
if (javaType == Types.JAVA_OBJECT) {
- if (value instanceof Collection || value instanceof List) {
- // bypass transformation
- } else {
- transform = determineTransformation(valueType, valueType, resultsTranslator);
-
- value = transform.translate(value, context);
- }
-
if (value != null) {
if (value instanceof List ) {
List vt = (List) value;
@@ -227,20 +215,6 @@
}
}
else {
-
- // if the result is a primitive, non-java
- // object, then there should only be
- // one column type
- transform = determineTransformation(valueType,columnTypes[0], resultsTranslator);
-
- // Transform value if necessary
- if (transform != null) {
- value = transform.translate(value, context);
- } else {
- // Convert time zone if necessary
- value = modifyTimeZone(value, dbmsTimeZone, cal);
- }
-
// Trim string column if necessary
if (trimStrings && (value instanceof String)) {
// if(trimColumn[i]) {
@@ -272,10 +246,6 @@
}
}
- // Reusable list of transformations for the types, lazily loaded
- boolean[] transformKnown = new boolean[columnTypes.length];
- ValueTranslator[] transforms = new ValueTranslator[columnTypes.length];
-
// Move the result data to the query results
List vals = null;
int numCols = columnTypes.length;
@@ -294,26 +264,6 @@
for (int i = 0; i < numCols; i++) {
Object value = valueList.get(i);
if(value != null) {
- // Determine transformation if unknown
- if(! transformKnown[i]) {
- Class valueType = value.getClass();
- if(valueType != columnTypes[i]) {
- transforms[i] = determineTransformation(valueType, columnTypes[i], resultsTranslator);
- }
- transformKnown[i] = true;
- }
-
-// System.out.println("\nRead value = " + value + " of type " + (value != null ? value.getClass().getName() : ""));
-
- // Transform value if necessary
- if(transforms[i] != null) {
- value = transforms[i].translate(value, context);
- }
-
- // Convert time zone if necessary
- value = modifyTimeZone(value, dbmsTimeZone, cal);
-// System.out.println("After modify time zone: value = " + value + " of type " + (value != null ? value.getClass().getName() : ""));
-
// Trim string column if necessary
if(trimColumn[i]) {
value = trimString((String) value);
@@ -326,79 +276,12 @@
batch.add(vals);
rowCnt++;
}
-
-
- } catch (ConnectorException e) {
- throw e;
} catch (Throwable e) {
throw new ConnectorException(e,ObjectPlugin.Util.getString("ObjectExecutionHelper.Unknown_error_translating_results___9", e.getMessage())); //$NON-NLS-1$
}
}
-
/**
- * Modify the time zone of the object if a databaseTimeZone is defined
- * and this value is a Date, Time, or Timestamp.
- * @param value The value, never null
- * @return New value
- */
- private static Object modifyTimeZone(Object value, TimeZone dbmsTimeZone, Calendar target) {
- if(value instanceof TimestampWithTimezone) {
- return value;
-
- } else if(dbmsTimeZone != null && value instanceof java.util.Date) {
- if(value instanceof Timestamp) {
- return TimestampWithTimezone.createTimestamp((Timestamp)value, LOCAL_TIME_ZONE, target);
-
- } else if(value instanceof java.sql.Date) {
- return TimestampWithTimezone.createDate((java.sql.Date)value, LOCAL_TIME_ZONE, target);
-
-
- } else if(value instanceof Time) {
- return TimestampWithTimezone.createTime((Time)value, LOCAL_TIME_ZONE, target);
- }
- return TimestampWithTimezone.createDate((java.util.Date)value, LOCAL_TIME_ZONE, target);
-
- }
-
- return value;
- }
-
- /**
- * @param actualType
- * @param expectedType
- * @return Transformation between actual and expected type
- */
- protected static ValueTranslator determineTransformation(Class actualType, Class expectedType, ISourceTranslator sourceTranslator) throws ConnectorException {
- ValueTranslator valueTranslator = null;
-
- List<ValueTranslator> valueTranslators = sourceTranslator.getValueTranslators();
-
- // Now check to see if there is an override to the translator
- //check valueTranslators first
- if(valueTranslators != null && !valueTranslators.isEmpty()){
- for(ValueTranslator translator:valueTranslators) {
- //Evaluate expressions in this order for performance.
- if(expectedType.equals(translator.getTargetType()) || translator.getSourceType().isAssignableFrom(actualType)){
- valueTranslator = translator;
- break;
- }
- }
- }
-
- if(valueTranslator == null){
- TypeFacility typeFacility = sourceTranslator.getTypeFacility();
- if (typeFacility.hasTransformation(actualType, expectedType)) {
- valueTranslator = new BasicValueTranslator(actualType, expectedType, typeFacility);
- } else {
- throw new ConnectorException(ObjectPlugin.Util.getString("ObjectExecutionHelper.Unable_to_translate_data_value__1", actualType.getName(), expectedType.getName())); //$NON-NLS-1$
- }
- }
- return valueTranslator;
- }
-
-
- /**
* Expects string to never be null
* @param value Incoming value
* @return Right trimmed value
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorWorkItem.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorWorkItem.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ConnectorWorkItem.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -46,6 +46,7 @@
import com.metamatrix.common.comm.exception.CommunicationException;
import com.metamatrix.common.log.LogManager;
import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.TransformationException;
import com.metamatrix.core.util.Assertion;
import com.metamatrix.dqp.DQPPlugin;
import com.metamatrix.dqp.internal.datamgr.language.LanguageBridgeFactory;
@@ -80,6 +81,9 @@
protected volatile ResultSetExecution execution;
protected ProcedureBatchHandler procedureBatchHandler;
private ICommand translatedCommand;
+ private Class<?>[] schema;
+ private List<Integer> convertToRuntimeType;
+ private List<Integer> convertToDesiredRuntimeType;
/* End state information */
private boolean lastBatch;
@@ -288,6 +292,17 @@
// Translate the command
Command command = this.requestMsg.getCommand();
+ List<SingleElementSymbol> symbols = this.requestMsg.getCommand().getProjectedSymbols();
+ this.schema = new Class[symbols.size()];
+ this.convertToDesiredRuntimeType = new ArrayList<Integer>(symbols.size());
+ this.convertToRuntimeType = new ArrayList<Integer>(symbols.size());
+ for (int i = 0; i < schema.length; i++) {
+ SingleElementSymbol symbol = symbols.get(i);
+ this.schema[i] = symbol.getType();
+ this.convertToDesiredRuntimeType.add(i);
+ this.convertToRuntimeType.add(i);
+ }
+
LanguageBridgeFactory factory = new LanguageBridgeFactory(queryMetadata);
this.translatedCommand = factory.translate(command);
@@ -343,25 +358,27 @@
}
protected void handleBatch()
- throws ConnectorException, CommunicationException {
+ throws ConnectorException {
Assertion.assertTrue(!this.lastBatch);
LogManager.logDetail(LogConstants.CTX_CONNECTOR, new Object[] {this.id, "Sending results from connector"}); //$NON-NLS-1$
int batchSize = 0;
- List<List> rows = new ArrayList<List>();
+ List<List> rows = new ArrayList<List>(batchSize/4);
boolean sendResults = true;
try {
while (batchSize < this.requestMsg.getFetchSize()) {
- List<?> row = this.execution.next();
+ List row = this.execution.next();
if (row == null) {
this.lastBatch = true;
break;
}
+
this.rowCount += 1;
batchSize++;
if (this.procedureBatchHandler != null) {
row = this.procedureBatchHandler.padRow(row);
}
- //datatype manipulation
+
+ correctTypes(row);
rows.add(row);
// Check for max result rows exceeded
if(manager.getMaxResultRows() != 0 && this.rowCount >= manager.getMaxResultRows()){
@@ -383,8 +400,9 @@
if (lastBatch) {
if (this.procedureBatchHandler != null) {
- List row = this.procedureBatchHandler.getOutputRow();
+ List row = this.procedureBatchHandler.getParameterRow();
if (row != null) {
+ correctTypes(row);
rows.add(row);
}
}
@@ -413,11 +431,46 @@
this.resultsReceiver.receiveResults(response);
}
}
+
+ private void correctTypes(List row) throws ConnectorException {
+ //TODO: add a proper source schema
+ for (int i = convertToRuntimeType.size() - 1; i >= 0; i--) {
+ int index = convertToRuntimeType.get(i);
+ Object value = row.get(index);
+ if (value != null) {
+ Object result = DataTypeManager.convertToRuntimeType(value);
+ if (DataTypeManager.isLOB(result.getClass())) {
+ this.securityContext.keepExecutionAlive(true);
+ }
+ if (value == result && !DataTypeManager.DefaultDataClasses.OBJECT.equals(this.schema[index])) {
+ convertToRuntimeType.remove(i);
+ }
+ row.set(index, result);
+ }
+ }
+ //TODO: add a proper intermediate schema
+ for (int i = convertToDesiredRuntimeType.size() - 1; i >= 0; i--) {
+ int index = convertToDesiredRuntimeType.get(i);
+ Object value = row.get(index);
+ if (value != null) {
+ Object result;
+ try {
+ result = DataTypeManager.transformValue(value, value.getClass(), this.schema[index]);
+ } catch (TransformationException e) {
+ throw new ConnectorException(e);
+ }
+ if (value == result) {
+ convertToDesiredRuntimeType.remove(i);
+ }
+ row.set(index, result);
+ }
+ }
+ }
protected abstract boolean dataNotAvailable(long delay);
- private void processMoreRequest() throws ConnectorException, CommunicationException {
- Assertion.assertTrue(this.moreRequested, "More was not requested");
+ private void processMoreRequest() throws ConnectorException {
+ Assertion.assertTrue(this.moreRequested, "More was not requested"); //$NON-NLS-1$
this.moreRequested = false;
LogManager.logDetail(LogConstants.CTX_CONNECTOR, new Object[] {this.id, "Processing MORE request"}); //$NON-NLS-1$
@@ -425,16 +478,14 @@
}
public static AtomicResultsMessage createResultsMessage(AtomicRequestMessage message, List[] batch, List columnSymbols) {
- String[] columnNames = new String[columnSymbols.size()];
String[] dataTypes = new String[columnSymbols.size()];
for(int i=0; i<columnSymbols.size(); i++) {
SingleElementSymbol symbol = (SingleElementSymbol) columnSymbols.get(i);
- columnNames[i] = symbol.getShortName();
dataTypes[i] = DataTypeManager.getDataTypeName(symbol.getType());
}
- return new AtomicResultsMessage(message, batch, columnNames, dataTypes);
+ return new AtomicResultsMessage(message, batch, dataTypes);
}
void asynchCancel() throws ConnectorException {
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ProcedureBatchHandler.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ProcedureBatchHandler.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/ProcedureBatchHandler.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -80,31 +80,13 @@
return result;
}
- List getOutputRow() throws ConnectorException {
- if (this.paramCols == 0) {
+ List getParameterRow() throws ConnectorException {
+ if (paramCols == 0) {
return null;
}
- List params = proc.getParameters();
- List outParamValues = Arrays.asList(new Object[this.resultSetCols + this.paramCols]);
- Iterator iter = params.iterator();
- int index = this.resultSetCols;
- //return
- while(iter.hasNext()){
- IParameter param = (IParameter)iter.next();
- if(param.getDirection() == Direction.RETURN){
- outParamValues.set(index++, procExec.getOutputValue(param));
- }
- }
- //out, inout
- iter = params.iterator();
- while(iter.hasNext()){
- IParameter param = (IParameter)iter.next();
- if(param.getDirection() == Direction.OUT || param.getDirection() == Direction.INOUT){
- outParamValues.set(index++, procExec.getOutputValue(param));
- }
- }
-
- return outParamValues;
+ List<Object> result = new ArrayList<Object>(Arrays.asList(new Object[resultSetCols]));
+ result.addAll(procExec.getOutputParameterValues());
+ return result;
}
}
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/TypeFacilityImpl.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/TypeFacilityImpl.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/impl/TypeFacilityImpl.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -26,10 +26,9 @@
import java.util.Date;
import java.util.TimeZone;
-import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.api.TypeFacility;
-import com.metamatrix.common.types.*;
+import com.metamatrix.common.types.DataTypeManager;
import com.metamatrix.common.util.TimestampWithTimezone;
/**
@@ -39,18 +38,6 @@
public TypeFacilityImpl() {
}
- public boolean hasTransformation(Class sourceClass, Class targetClass) {
- return DataTypeManager.isTransformable(sourceClass, targetClass);
- }
-
- public Object transformValue(Object value, Class sourceClass, Class targetClass) throws ConnectorException {
- try {
- return DataTypeManager.transformValue(value, sourceClass, targetClass);
- } catch(TransformationException e) {
- throw new ConnectorException(e);
- }
- }
-
@Override
public Object convertToRuntimeType(Object value) {
return DataTypeManager.convertToRuntimeType(value);
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/language/ProcedureImpl.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/language/ProcedureImpl.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/datamgr/language/ProcedureImpl.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -22,10 +22,14 @@
package com.metamatrix.dqp.internal.datamgr.language;
+import java.util.Iterator;
import java.util.List;
+import org.teiid.connector.api.ConnectorException;
import org.teiid.connector.language.IParameter;
import org.teiid.connector.language.IProcedure;
+import org.teiid.connector.language.IParameter.Direction;
+import org.teiid.connector.metadata.runtime.Element;
import org.teiid.connector.metadata.runtime.Procedure;
import org.teiid.connector.visitor.framework.LanguageObjectVisitor;
@@ -98,5 +102,21 @@
IProcedure proc = (IProcedure) obj;
return getProcedureName().equalsIgnoreCase(proc.getProcedureName());
}
+
+ public Class<?>[] getResultSetColumnTypes() throws ConnectorException {
+ for (IParameter param : parameters) {
+ if(param.getDirection() == Direction.RESULT_SET){
+ List<Element> columnMetadata = param.getMetadataObject().getChildren();
+ int size = columnMetadata.size();
+ Class<?>[] coulmnDTs = new Class[size];
+ for(int i =0; i<size; i++ ){
+ coulmnDTs[i] = columnMetadata.get(i).getJavaType();
+ }
+ return coulmnDTs;
+ }
+ }
+ return new Class[0];
+ }
+
}
Modified: trunk/engine/src/main/java/com/metamatrix/dqp/message/AtomicResultsMessage.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/message/AtomicResultsMessage.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/message/AtomicResultsMessage.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -53,7 +53,7 @@
public AtomicResultsMessage() {
}
- public AtomicResultsMessage(AtomicRequestMessage msg, List[] results, String[] columnNames, String[] dataTypes) {
+ public AtomicResultsMessage(AtomicRequestMessage msg, List[] results, String[] dataTypes) {
this(msg);
this.dataTypes = dataTypes;
this.results = results;
Modified: trunk/engine/src/main/java/com/metamatrix/query/function/FunctionLibrary.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/function/FunctionLibrary.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/engine/src/main/java/com/metamatrix/query/function/FunctionLibrary.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -30,6 +30,7 @@
import com.metamatrix.api.exception.query.InvalidFunctionException;
import com.metamatrix.api.exception.query.QueryResolverException;
import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.TransformationException;
import com.metamatrix.query.QueryPlugin;
import com.metamatrix.query.function.metadata.FunctionMethod;
import com.metamatrix.query.function.metadata.FunctionParameter;
@@ -342,19 +343,16 @@
// Invoke the method and return the result
try {
Object result = method.invoke(null, values);
- if (result instanceof String) {
- String str = (String)result;
- if (str.length() > DataTypeManager.MAX_STRING_LENGTH) {
- return str.substring(0, DataTypeManager.MAX_STRING_LENGTH);
- }
- return result;
- }
- return DataTypeManager.convertToRuntimeType(result);
+ result = DataTypeManager.convertToRuntimeType(result);
+ result = DataTypeManager.transformValue(result, fd.getReturnType());
+ return result;
} catch(InvocationTargetException e) {
throw new FunctionExecutionException(e.getTargetException(), ErrorMessageKeys.FUNCTION_0003, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0003, fd.getName()));
} catch(IllegalAccessException e) {
throw new FunctionExecutionException(e, ErrorMessageKeys.FUNCTION_0004, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0004, method.toString()));
- }
+ } catch (TransformationException e) {
+ throw new FunctionExecutionException(e, e.getMessage());
+ }
}
/**
Modified: trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/engine/src/main/java/com/metamatrix/query/function/FunctionMethods.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -466,7 +466,7 @@
// ================== Helper for a bunch of date functions =====================
private static int getField(java.util.Date date, int field) {
- Calendar cal = Calendar.getInstance();
+ Calendar cal = TimestampWithTimezone.getCalendar();
cal.setTime(date);
return cal.get(field);
@@ -501,9 +501,9 @@
if(x == null) {
return null;
} else if(x instanceof Date) {
- return new Integer(getField((Date)x, Calendar.DATE));
+ return Integer.valueOf(getField((Date)x, Calendar.DATE));
} else if(x instanceof Timestamp) {
- return new Integer(getField((Timestamp)x, Calendar.DATE));
+ return Integer.valueOf(getField((Timestamp)x, Calendar.DATE));
}
throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "dayOfMonth", x.getClass().getName())); //$NON-NLS-1$
@@ -517,9 +517,9 @@
if(x == null) {
return null;
} else if(x instanceof Date) {
- return new Integer(getField((Date)x, Calendar.DAY_OF_WEEK));
+ return Integer.valueOf(getField((Date)x, Calendar.DAY_OF_WEEK));
} else if(x instanceof Timestamp) {
- return new Integer(getField((Timestamp)x, Calendar.DAY_OF_WEEK));
+ return Integer.valueOf(getField((Timestamp)x, Calendar.DAY_OF_WEEK));
}
throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "dayOfWeek", x.getClass().getName())); //$NON-NLS-1$
@@ -533,9 +533,9 @@
if(x == null) {
return null;
} else if(x instanceof Date) {
- return new Integer(getField((Date)x, Calendar.DAY_OF_YEAR));
+ return Integer.valueOf(getField((Date)x, Calendar.DAY_OF_YEAR));
} else if(x instanceof Timestamp) {
- return new Integer(getField((Timestamp)x, Calendar.DAY_OF_YEAR));
+ return Integer.valueOf(getField((Timestamp)x, Calendar.DAY_OF_YEAR));
}
throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "dayOfYear", x.getClass().getName())); //$NON-NLS-1$
@@ -549,9 +549,9 @@
if(x == null) {
return null;
} else if(x instanceof Time) {
- return new Integer(getField((Time)x, Calendar.HOUR_OF_DAY));
+ return Integer.valueOf(getField((Time)x, Calendar.HOUR_OF_DAY));
} else if(x instanceof Timestamp) {
- return new Integer(getField((Timestamp)x, Calendar.HOUR_OF_DAY));
+ return Integer.valueOf(getField((Timestamp)x, Calendar.HOUR_OF_DAY));
}
throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "hour", x.getClass().getName())); //$NON-NLS-1$
@@ -565,9 +565,9 @@
if(x == null) {
return null;
} else if(x instanceof Time) {
- return new Integer(getField((Time)x, Calendar.MINUTE));
+ return Integer.valueOf(getField((Time)x, Calendar.MINUTE));
} else if(x instanceof Timestamp) {
- return new Integer(getField((Timestamp)x, Calendar.MINUTE));
+ return Integer.valueOf(getField((Timestamp)x, Calendar.MINUTE));
}
throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "minute", x.getClass().getName())); //$NON-NLS-1$
@@ -581,9 +581,9 @@
if(x == null) {
return null;
} else if(x instanceof Date) {
- return new Integer(getField((Date)x, Calendar.MONTH)+1);
+ return Integer.valueOf(getField((Date)x, Calendar.MONTH)+1);
} else if(x instanceof Timestamp) {
- return new Integer(getField((Timestamp)x, Calendar.MONTH)+1);
+ return Integer.valueOf(getField((Timestamp)x, Calendar.MONTH)+1);
}
throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "month", x.getClass().getName())); //$NON-NLS-1$
@@ -617,9 +617,9 @@
if(x == null) {
return null;
} else if(x instanceof Time) {
- return new Integer(getField((Time)x, Calendar.SECOND));
+ return Integer.valueOf(getField((Time)x, Calendar.SECOND));
} else if(x instanceof Timestamp) {
- return new Integer(getField((Timestamp)x, Calendar.SECOND));
+ return Integer.valueOf(getField((Timestamp)x, Calendar.SECOND));
}
throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "second", x.getClass().getName())); //$NON-NLS-1$
@@ -633,9 +633,9 @@
if(x == null) {
return null;
} else if(x instanceof Date) {
- return new Integer(getField((Date)x, Calendar.WEEK_OF_YEAR));
+ return Integer.valueOf(getField((Date)x, Calendar.WEEK_OF_YEAR));
} else if(x instanceof Timestamp) {
- return new Integer(getField((Timestamp)x, Calendar.WEEK_OF_YEAR));
+ return Integer.valueOf(getField((Timestamp)x, Calendar.WEEK_OF_YEAR));
}
throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "week", x.getClass().getName())); //$NON-NLS-1$
@@ -649,9 +649,9 @@
if(x == null) {
return null;
} else if(x instanceof Date) {
- return new Integer(getField((Date)x, Calendar.YEAR));
+ return Integer.valueOf(getField((Date)x, Calendar.YEAR));
} else if(x instanceof Timestamp) {
- return new Integer(getField((Timestamp)x, Calendar.YEAR));
+ return Integer.valueOf(getField((Timestamp)x, Calendar.YEAR));
}
throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0015, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0015, "year", x.getClass().getName())); //$NON-NLS-1$
@@ -661,35 +661,27 @@
public static Object quarter(Object date)
throws FunctionExecutionException {
- String month = null;
+ int month = 12;
if(date == null) {
return null;
} else if(date instanceof Date) {
- month = monthNames[getField((Date)date, Calendar.MONTH)];
+ month = getField((Date)date, Calendar.MONTH);
} else if(date instanceof Timestamp) {
- month = monthNames[getField((Timestamp)date, Calendar.MONTH)];
+ month = getField((Timestamp)date, Calendar.MONTH);
+ }
+ if (month > 11) {
+ throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0066, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0066,
+ new Object[] {"quarter", date.getClass().getName()})); //$NON-NLS-1$
}
-
- if (month.equals("January") || month.equals("February") || month.equals("March")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- return new Integer(1);
- } else if (month.equals("April") || month.equals("May") || month.equals("June")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- return new Integer(2);
- } else if (month.equals("July") || month.equals("August") || month.equals("September")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- return new Integer(3);
- } else if (month.equals("October") || month.equals("November") || month.equals("December")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- return new Integer(4);
- }
-
- throw new FunctionExecutionException(ErrorMessageKeys.FUNCTION_0066, QueryPlugin.Util.getString(ErrorMessageKeys.FUNCTION_0066,
- new Object[] {"quarter", date.getClass().getName()})); //$NON-NLS-1$
+ return Integer.valueOf(month/3 + 1);
}
// ================== Function = timestampadd =====================
public static Object timestampAdd(Object interval, Object count, Object timestamp)
throws FunctionExecutionException {
- Calendar cal = Calendar.getInstance();
+ Calendar cal = TimestampWithTimezone.getCalendar();
if (interval == null || count == null || timestamp == null) {
return null;
@@ -855,17 +847,17 @@
return null;
}
- // Get calendar for time
- Calendar timeCal = Calendar.getInstance();
- timeCal.setTime((java.sql.Time)time);
-
- // Build calendar for output timestamp based on the date
- Calendar tsCal = Calendar.getInstance();
+ Calendar tsCal = TimestampWithTimezone.getCalendar();
+ tsCal.setTime((java.sql.Time)time);
+ int hour = tsCal.get(Calendar.HOUR_OF_DAY);
+ int minute = tsCal.get(Calendar.MINUTE);
+ int second = tsCal.get(Calendar.SECOND);
+
tsCal.setTime((java.sql.Date)date);
- tsCal.set(Calendar.HOUR_OF_DAY, timeCal.get(Calendar.HOUR_OF_DAY));
- tsCal.set(Calendar.MINUTE, timeCal.get(Calendar.MINUTE));
- tsCal.set(Calendar.SECOND, timeCal.get(Calendar.SECOND));
+ tsCal.set(Calendar.HOUR_OF_DAY, hour);
+ tsCal.set(Calendar.MINUTE, minute);
+ tsCal.set(Calendar.SECOND, second);
return new Timestamp(tsCal.getTime().getTime());
}
@@ -1393,6 +1385,7 @@
// ================== Function = convert =====================
+ @SuppressWarnings("unchecked")
public static Object convert(Object src, Object type)
throws FunctionExecutionException {
Modified: trunk/engine/src/main/java/com/metamatrix/query/sql/lang/Command.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/sql/lang/Command.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/engine/src/main/java/com/metamatrix/query/sql/lang/Command.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -30,6 +30,7 @@
import com.metamatrix.query.sql.LanguageObject;
import com.metamatrix.query.sql.symbol.ElementSymbol;
import com.metamatrix.query.sql.symbol.GroupSymbol;
+import com.metamatrix.query.sql.symbol.SingleElementSymbol;
import com.metamatrix.query.sql.visitor.CommandCollectorVisitor;
import com.metamatrix.query.sql.visitor.SQLStringVisitor;
@@ -279,7 +280,7 @@
* single column.
* @return Ordered list of SingleElementSymbol
*/
- public abstract List getProjectedSymbols();
+ public abstract List<SingleElementSymbol> getProjectedSymbols();
/**
* Whether the results are cachable.
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/FakeProcedureExecution.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/FakeProcedureExecution.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/FakeProcedureExecution.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -22,6 +22,7 @@
package com.metamatrix.dqp.internal.datamgr.impl;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -29,16 +30,17 @@
import org.teiid.connector.api.DataNotAvailableException;
import org.teiid.connector.api.ProcedureExecution;
import org.teiid.connector.basic.BasicExecution;
-import org.teiid.connector.language.IParameter;
final class FakeProcedureExecution extends BasicExecution implements ProcedureExecution {
int resultSetSize;
int rowNum;
+ int paramSize;
- public FakeProcedureExecution(int resultSetSize) {
+ public FakeProcedureExecution(int resultSetSize, int paramSize) {
this.resultSetSize = resultSetSize;
+ this.paramSize = paramSize;
}
@Override
@@ -46,10 +48,15 @@
}
- public Object getOutputValue(IParameter parameter) throws ConnectorException {
- return new Integer(parameter.getIndex());
+ @Override
+ public List<?> getOutputParameterValues() throws ConnectorException {
+ List<Object> result = new ArrayList<Object>(paramSize);
+ for (int i = 0; i < paramSize; i++) {
+ result.add(i);
+ }
+ return result;
}
-
+
public void close() throws ConnectorException {
}
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/TestConnectorWorkItem.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/TestConnectorWorkItem.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/internal/datamgr/impl/TestConnectorWorkItem.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -93,7 +93,7 @@
}
public void testProcedureBatching() throws Exception {
- ProcedureExecution exec = new FakeProcedureExecution(2);
+ ProcedureExecution exec = new FakeProcedureExecution(2, 1);
// this has two result set columns and 1 out parameter
int total_columns = 3;
@@ -105,10 +105,11 @@
assertEquals(total_columns, pbh.padRow(Arrays.asList(null, null)).size());
- List params = pbh.getOutputRow();
+ List params = pbh.getParameterRow();
+ assertEquals(total_columns, params.size());
// check the parameter value
- assertEquals(new Integer(3), params.get(2));
+ assertEquals(Integer.valueOf(0), params.get(2));
try {
pbh.padRow(Arrays.asList(1));
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestDataTierManager.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestDataTierManager.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/internal/process/TestDataTierManager.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -155,7 +155,7 @@
request.setCommand(command);
- AtomicResultsMessage results = new AtomicResultsMessage(request, new List[0], new String[0], new String[0]);
+ AtomicResultsMessage results = new AtomicResultsMessage(request, new List[0], new String[0]);
if (isLast) {
results.setFinalRow(10);
Modified: trunk/engine/src/test/java/com/metamatrix/query/function/TestFunctionLibrary.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/function/TestFunctionLibrary.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/engine/src/test/java/com/metamatrix/query/function/TestFunctionLibrary.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -37,6 +37,7 @@
import com.metamatrix.api.exception.query.FunctionExecutionException;
import com.metamatrix.api.exception.query.InvalidFunctionException;
import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.util.TimestampWithTimezone;
import com.metamatrix.query.function.metadata.FunctionMethod;
import com.metamatrix.query.sql.ReservedWords;
import com.metamatrix.query.unittest.TimestampUtil;
@@ -59,21 +60,18 @@
private FunctionLibrary library = FunctionLibraryManager.getFunctionLibrary();
- TimestampUtil tsUtil;
-
// ################################## FRAMEWORK ################################
public TestFunctionLibrary(String name) {
super(name);
- tsUtil = new TimestampUtil();
}
public void setUp() {
- TimeZone.setDefault(TimeZone.getTimeZone("GMT-06:00")); //$NON-NLS-1$
+ TimestampWithTimezone.resetCalendar(TimeZone.getTimeZone("GMT-06:00")); //$NON-NLS-1$
}
public void tearDown() {
- TimeZone.setDefault(null);
+ TimestampWithTimezone.resetCalendar(null);
}
// ################################## TEST HELPERS ################################
@@ -782,33 +780,33 @@
}
public void testInvokeFormatTime1() {
- helpInvokeMethod("formatTime", new Object[] {tsUtil.createTime(3,5,12), new String("h:mm a") }, "3:05 AM"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ helpInvokeMethod("formatTime", new Object[] {TimestampUtil.createTime(3,5,12), new String("h:mm a") }, "3:05 AM"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testInvokeFormatTime2() {
- helpInvokeMethod("formatTime", new Object[] {tsUtil.createTime(13, 5,12), new String("K:mm a, z") }, "1:05 PM, GMT-06:00"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ helpInvokeMethod("formatTime", new Object[] {TimestampUtil.createTime(13, 5,12), new String("K:mm a, z") }, "1:05 PM, GMT-06:00"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testInvokeFormatTime3() {
- helpInvokeMethod("formatTime", new Object[] {tsUtil.createTime(13, 5,12), new String("HH:mm:ss z") }, "13:05:12 GMT-06:00"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ helpInvokeMethod("formatTime", new Object[] {TimestampUtil.createTime(13, 5,12), new String("HH:mm:ss z") }, "13:05:12 GMT-06:00"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testInvokeFormatTime4() {
- TimeZone.setDefault(TimeZone.getTimeZone("America/Chicago")); //$NON-NLS-1$
- helpInvokeMethod("formatTime", new Object[] {tsUtil.createTime(13, 5,12), new String("hh a, zzzz") }, "01 PM, Central Standard Time"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ TimestampWithTimezone.resetCalendar(TimeZone.getTimeZone("America/Chicago")); //$NON-NLS-1$
+ helpInvokeMethod("formatTime", new Object[] {TimestampUtil.createTime(13, 5,12), new String("hh a, zzzz") }, "01 PM, Central Standard Time"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testInvokeFormatTimeFail() {
- helpInvokeMethodFail("formatTime", new Object[] {tsUtil.createTime(13, 5,12), new String("hh i, www") }, //$NON-NLS-1$ //$NON-NLS-2$
+ helpInvokeMethodFail("formatTime", new Object[] {TimestampUtil.createTime(13, 5,12), new String("hh i, www") }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionExecutionException("")); //$NON-NLS-1$
}
public void testInvokeFormatDate1() {
- helpInvokeMethod("formatDate", new Object[] {tsUtil.createDate(103, 2, 5), new String("yyyy.MM.dd G") }, "2003.03.05 AD"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ helpInvokeMethod("formatDate", new Object[] {TimestampUtil.createDate(103, 2, 5), new String("yyyy.MM.dd G") }, "2003.03.05 AD"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testInvokeFormatDate2() {
- helpInvokeMethod("formatDate", new Object[] {tsUtil.createDate(103, 2, 5), new String("EEE, MMM d, '' yy") }, "Wed, Mar 5, ' 03"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ helpInvokeMethod("formatDate", new Object[] {TimestampUtil.createDate(103, 2, 5), new String("EEE, MMM d, '' yy") }, "Wed, Mar 5, ' 03"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testInvokeFormatDate3() {
@@ -816,49 +814,49 @@
}
public void testInvokeFormatDateFail() {
- helpInvokeMethodFail("formatTime", new Object[] {tsUtil.createTime(103, 2, 5), new String("yyyy.i.www") }, //$NON-NLS-1$ //$NON-NLS-2$
+ helpInvokeMethodFail("formatTime", new Object[] {TimestampUtil.createTime(103, 2, 5), new String("yyyy.i.www") }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionExecutionException("")); //$NON-NLS-1$
}
public void testInvokeFormatTimestamp1() {
- helpInvokeMethod("formatTimestamp", new Object[] {tsUtil.createTimestamp(103, 2, 5, 3, 4, 12, 255), new String("mm/dd/yy h:mm a") }, "04/05/03 3:04 AM"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ helpInvokeMethod("formatTimestamp", new Object[] {TimestampUtil.createTimestamp(103, 2, 5, 3, 4, 12, 255), new String("mm/dd/yy h:mm a") }, "04/05/03 3:04 AM"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testInvokeFormatTimestamp2() {
- helpInvokeMethod("formatTimestamp", new Object[] {tsUtil.createTimestamp(103, 2, 5, 3, 4, 12, 255), new String("yyyy-mm-dd k:mm a z") }, "2003-04-05 3:04 AM GMT-06:00"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ helpInvokeMethod("formatTimestamp", new Object[] {TimestampUtil.createTimestamp(103, 2, 5, 3, 4, 12, 255), new String("yyyy-mm-dd k:mm a z") }, "2003-04-05 3:04 AM GMT-06:00"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testInvokeFormatTimestamp3() {
- helpInvokeMethod("formatTimestamp", new Object[] {tsUtil.createTimestamp(103, 2, 5, 3, 4, 12, 255), new String("yyyy-mm-dd hh:mm:ss.SSSS") }, "2003-04-05 03:04:12.0000"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ helpInvokeMethod("formatTimestamp", new Object[] {TimestampUtil.createTimestamp(103, 2, 5, 3, 4, 12, 255), new String("yyyy-mm-dd hh:mm:ss.SSSS") }, "2003-04-05 03:04:12.0000"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testInvokeFormatTimestampFail() {
- helpInvokeMethodFail("formatTimestamp", new Object[] {tsUtil.createTimestamp(103, 2, 5, 3, 4, 12, 255), new String("mm/dd/nn h:mm a") }, //$NON-NLS-1$ //$NON-NLS-2$
+ helpInvokeMethodFail("formatTimestamp", new Object[] {TimestampUtil.createTimestamp(103, 2, 5, 3, 4, 12, 255), new String("mm/dd/nn h:mm a") }, //$NON-NLS-1$ //$NON-NLS-2$
new FunctionExecutionException("")); //$NON-NLS-1$
}
public void testInvokeParseTime1() {
- helpInvokeMethod("parseTime", new Object[] {new String("3:12 PM"), new String("h:mm a") }, tsUtil.createTime(15, 12, 0)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ helpInvokeMethod("parseTime", new Object[] {new String("3:12 PM"), new String("h:mm a") }, TimestampUtil.createTime(15, 12, 0)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testInvokeParseTime2() {
- helpInvokeMethod("parseTime", new Object[] {new String("03:12:23 CST"), new String("hh:mm:ss z") }, tsUtil.createTime(3, 12, 23)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ helpInvokeMethod("parseTime", new Object[] {new String("03:12:23 CST"), new String("hh:mm:ss z") }, TimestampUtil.createTime(3, 12, 23)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testInvokeParseDate1() {
- helpInvokeMethod("parseDate", new Object[] {new String("03/05/03"), new String("MM/dd/yy") }, tsUtil.createDate(103, 2, 5)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ helpInvokeMethod("parseDate", new Object[] {new String("03/05/03"), new String("MM/dd/yy") }, TimestampUtil.createDate(103, 2, 5)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testInvokeParseDate2() {
- helpInvokeMethod("parseDate", new Object[] {new String("05-Mar-03"), new String("dd-MMM-yy") }, tsUtil.createDate(103, 2, 5)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ helpInvokeMethod("parseDate", new Object[] {new String("05-Mar-03"), new String("dd-MMM-yy") }, TimestampUtil.createDate(103, 2, 5)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testInvokeParseTimestamp1() {
- helpInvokeMethod("parseTimestamp", new Object[] {new String("05 Mar 2003 03:12:23 CST"), new String("dd MMM yyyy HH:mm:ss z") }, tsUtil.createTimestamp(103, 2, 5, 3, 12, 23, 0)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ helpInvokeMethod("parseTimestamp", new Object[] {new String("05 Mar 2003 03:12:23 CST"), new String("dd MMM yyyy HH:mm:ss z") }, TimestampUtil.createTimestamp(103, 2, 5, 3, 12, 23, 0)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testInvokeParseTimestamp2() {
- helpInvokeMethod("parseTimestamp", new Object[] {new String("05 Mar 2003 03:12:23.333"), new String("dd MMM yyyy HH:mm:ss.SSS") }, tsUtil.createTimestamp(103, 2, 5, 3, 12, 23, 333*1000000)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ helpInvokeMethod("parseTimestamp", new Object[] {new String("05 Mar 2003 03:12:23.333"), new String("dd MMM yyyy HH:mm:ss.SSS") }, TimestampUtil.createTimestamp(103, 2, 5, 3, 12, 23, 333*1000000)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testFindFormatInteger() {
@@ -970,32 +968,32 @@
public void testInvokeQuarter1() {
// 2003-5-15
- helpInvokeMethod("quarter", new Object[] {tsUtil.createDate(103, 4, 15)}, new Integer(2)); //$NON-NLS-1$
+ helpInvokeMethod("quarter", new Object[] {TimestampUtil.createDate(103, 4, 15)}, new Integer(2)); //$NON-NLS-1$
}
public void testInvokeQuarter2() {
// 2003-5-1
- helpInvokeMethod("quarter", new Object[] {tsUtil.createDate(103, 3, 31)}, new Integer(2)); //$NON-NLS-1$
+ helpInvokeMethod("quarter", new Object[] {TimestampUtil.createDate(103, 3, 31)}, new Integer(2)); //$NON-NLS-1$
}
public void testInvokeQuarter3() {
// 2003-1-31
- helpInvokeMethod("quarter", new Object[] {tsUtil.createDate(103, 0, 31)}, new Integer(1)); //$NON-NLS-1$
+ helpInvokeMethod("quarter", new Object[] {TimestampUtil.createDate(103, 0, 31)}, new Integer(1)); //$NON-NLS-1$
}
public void testInvokeQuarter4() {
// 2003-9-30
- helpInvokeMethod("quarter", new Object[] {tsUtil.createDate(103, 8, 30)}, new Integer(3)); //$NON-NLS-1$
+ helpInvokeMethod("quarter", new Object[] {TimestampUtil.createDate(103, 8, 30)}, new Integer(3)); //$NON-NLS-1$
}
public void testInvokeQuarter5() {
// 2003-12-31
- helpInvokeMethod("quarter", new Object[] {tsUtil.createDate(103, 11, 31)}, new Integer(4)); //$NON-NLS-1$
+ helpInvokeMethod("quarter", new Object[] {TimestampUtil.createDate(103, 11, 31)}, new Integer(4)); //$NON-NLS-1$
}
public void testInvokeQuarter6() {
//bad date such as 2003-13-45
- helpInvokeMethod("quarter", new Object[] {tsUtil.createDate(103, 12, 45)}, new Integer(1)); //$NON-NLS-1$
+ helpInvokeMethod("quarter", new Object[] {TimestampUtil.createDate(103, 12, 45)}, new Integer(1)); //$NON-NLS-1$
}
public void testInvokeIfNull() {
@@ -1057,86 +1055,86 @@
/** date + day --> count=28, inteval=day, result should be 2003-6-12 */
public void testInvokeTimestampAddDate1() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_DAY, //$NON-NLS-1$
- new Integer(28), tsUtil.createDate(103, 4, 15)}, tsUtil.createDate(103, 5, 12));
+ new Integer(28), TimestampUtil.createDate(103, 4, 15)}, TimestampUtil.createDate(103, 5, 12));
}
public void testInvokeTimestampAddDate_ignore_case() {
helpInvokeMethod("timestampAdd", new Object[] {"sql_TSI_day", //$NON-NLS-1$ //$NON-NLS-2$
- new Integer(28), tsUtil.createDate(103, 4, 15)}, tsUtil.createDate(103, 5, 12));
+ new Integer(28), TimestampUtil.createDate(103, 4, 15)}, TimestampUtil.createDate(103, 5, 12));
}
/** date + day --> count=-28, inteval=day, result should be 2003-4-17 */
public void testInvokeTimestampAddDate1a() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_DAY, //$NON-NLS-1$
- new Integer(-28), tsUtil.createDate(103, 4, 15)}, tsUtil.createDate(103, 3, 17));
+ new Integer(-28), TimestampUtil.createDate(103, 4, 15)}, TimestampUtil.createDate(103, 3, 17));
}
/** date + month --> count=18, inteval=month, result should be 2004-11-15 */
public void testInvokeTimestampAddDate2() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_MONTH, //$NON-NLS-1$
- new Integer(18), tsUtil.createDate(103, 4, 15)}, tsUtil.createDate(104, 10, 15));
+ new Integer(18), TimestampUtil.createDate(103, 4, 15)}, TimestampUtil.createDate(104, 10, 15));
}
/** date + month --> count=-18, inteval=month, result should be 2001-11-15 */
public void testInvokeTimestampAddDate2a() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_MONTH, //$NON-NLS-1$
- new Integer(-18), tsUtil.createDate(103, 4, 15)}, tsUtil.createDate(101, 10, 15));
+ new Integer(-18), TimestampUtil.createDate(103, 4, 15)}, TimestampUtil.createDate(101, 10, 15));
}
/** date + week --> count=6, inteval=week, result should be 2003-04-03 */
public void testInvokeTimestampAddDate3() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_WEEK, //$NON-NLS-1$
- new Integer(-6), tsUtil.createDate(103, 4, 15)}, tsUtil.createDate(103, 3, 3));
+ new Integer(-6), TimestampUtil.createDate(103, 4, 15)}, TimestampUtil.createDate(103, 3, 3));
}
/** date + quarter --> count=3, inteval=quarter, result should be 2004-2-15 */
public void testInvokeTimestampAddDate4() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_QUARTER, //$NON-NLS-1$
- new Integer(3), tsUtil.createDate(103, 4, 15)}, tsUtil.createDate(104, 1, 15));
+ new Integer(3), TimestampUtil.createDate(103, 4, 15)}, TimestampUtil.createDate(104, 1, 15));
}
/** date + year --> count=-1, inteval=year, result should be 2002-5-15 */
public void testInvokeTimestampAddDate5() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_YEAR, //$NON-NLS-1$
- new Integer(-1), tsUtil.createDate(103, 4, 15)}, tsUtil.createDate(102, 4, 15));
+ new Integer(-1), TimestampUtil.createDate(103, 4, 15)}, TimestampUtil.createDate(102, 4, 15));
}
/** time + minute --> count=23, inteval=3, result should be 03:32:12 */
public void testInvokeTimestampAddTime1() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_MINUTE, //$NON-NLS-1$
- new Integer(23), tsUtil.createTime(3, 9, 12)}, tsUtil.createTime(3, 32, 12));
+ new Integer(23), TimestampUtil.createTime(3, 9, 12)}, TimestampUtil.createTime(3, 32, 12));
}
/** time + hour --> count=21, inteval=4, result should be 00:09:12 and overflow */
public void testInvokeTimestampAddTime2() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_HOUR, //$NON-NLS-1$
- new Integer(21), tsUtil.createTime(3, 9, 12)}, tsUtil.createTime(0, 9, 12));
+ new Integer(21), TimestampUtil.createTime(3, 9, 12)}, TimestampUtil.createTime(0, 9, 12));
}
/** time + hour --> count=2, inteval=4, result should be 01:12:12*/
public void testInvokeTimestampAddTime3() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_HOUR, //$NON-NLS-1$
- new Integer(2), tsUtil.createTime(23, 12, 12)}, tsUtil.createTime(1, 12, 12));
+ new Integer(2), TimestampUtil.createTime(23, 12, 12)}, TimestampUtil.createTime(1, 12, 12));
}
/** time + second --> count=23, inteval=2, result should be 03:10:01 */
public void testInvokeTimestampAddTime4() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_SECOND, //$NON-NLS-1$
- new Integer(49), tsUtil.createTime(3, 9, 12)}, tsUtil.createTime(3, 10, 1));
+ new Integer(49), TimestampUtil.createTime(3, 9, 12)}, TimestampUtil.createTime(3, 10, 1));
}
/** timestamp + second --> count=23, inteval=2, result should be 2003-05-15 03:09:35.100 */
public void testInvokeTimestampAddTimestamp1() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_SECOND, //$NON-NLS-1$
- new Integer(23), tsUtil.createTimestamp(103, 4, 15, 3, 9, 12, 100)},
- tsUtil.createTimestamp(103, 4, 15, 3, 9, 35, 100));
+ new Integer(23), TimestampUtil.createTimestamp(103, 4, 15, 3, 9, 12, 100)},
+ TimestampUtil.createTimestamp(103, 4, 15, 3, 9, 35, 100));
}
/** timestamp + nanos --> count=1, inteval=1, result should be 2003-05-15 03:09:12.000000101 */
public void testInvokeTimestampAddTimestamp2() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_FRAC_SECOND, //$NON-NLS-1$
- new Integer(1), tsUtil.createTimestamp(103, 4, 15, 3, 9, 12, 100)},
- tsUtil.createTimestamp(103, 4, 15, 3, 9, 12, 101));
+ new Integer(1), TimestampUtil.createTimestamp(103, 4, 15, 3, 9, 12, 100)},
+ TimestampUtil.createTimestamp(103, 4, 15, 3, 9, 12, 101));
}
/** timestamp + nanos --> count=2100000000, inteval=1, result should be 2003-05-15 03:10:01.100000003
@@ -1144,20 +1142,20 @@
*/
public void testInvokeTimestampAddTimestamp3() {
helpInvokeMethod("timestampAdd", new Object[] {ReservedWords.SQL_TSI_FRAC_SECOND, //$NON-NLS-1$
- new Integer(2100000000), tsUtil.createTimestamp(103, 4, 15, 3, 9, 59, 1)},
- tsUtil.createTimestamp(103, 4, 15, 3, 10, 1, 100000003));
+ new Integer(2100000000), TimestampUtil.createTimestamp(103, 4, 15, 3, 9, 59, 1)},
+ TimestampUtil.createTimestamp(103, 4, 15, 3, 10, 1, 100000003));
}
/** time --> interval=hour, time1 = 03:04:45, time2= 05:05:36 return = 2 */
public void testInvokeTimestampDiffTime1() {
helpInvokeMethod("timestampDiff", new Object[] {ReservedWords.SQL_TSI_HOUR, //$NON-NLS-1$
- tsUtil.createTime(3, 4, 45), tsUtil.createTime(5, 5, 36) },
+ TimestampUtil.createTime(3, 4, 45), TimestampUtil.createTime(5, 5, 36) },
new Long(2));
}
public void testInvokeTimestampDiffTime1_ignorecase() {
helpInvokeMethod("timestampDiff", new Object[] {"SQL_tsi_HOUR", //$NON-NLS-1$ //$NON-NLS-2$
- tsUtil.createTime(3, 4, 45), tsUtil.createTime(5, 5, 36) },
+ TimestampUtil.createTime(3, 4, 45), TimestampUtil.createTime(5, 5, 36) },
new Long(2));
}
@@ -1167,7 +1165,7 @@
*/
public void testInvokeTimestampDiffTimestamp1() {
helpInvokeMethod("timestampDiff", new Object[] {ReservedWords.SQL_TSI_WEEK, //$NON-NLS-1$
- tsUtil.createTimestamp(102, 5, 21, 3, 9, 35, 100), tsUtil.createTimestamp(103, 4, 2, 5, 19, 35, 500) },
+ TimestampUtil.createTimestamp(102, 5, 21, 3, 9, 35, 100), TimestampUtil.createTimestamp(103, 4, 2, 5, 19, 35, 500) },
new Long(45));
}
@@ -1177,7 +1175,7 @@
*/
public void testInvokeTimestampDiffTimestamp2() {
helpInvokeMethod("timestampDiff", new Object[] {ReservedWords.SQL_TSI_FRAC_SECOND, //$NON-NLS-1$
- tsUtil.createTimestamp(102, 5, 21, 3, 9, 35, 1), tsUtil.createTimestamp(102, 5, 21, 3, 9, 35, 100000000) },
+ TimestampUtil.createTimestamp(102, 5, 21, 3, 9, 35, 1), TimestampUtil.createTimestamp(102, 5, 21, 3, 9, 35, 100000000) },
new Long(99999999));
}
@@ -1187,14 +1185,14 @@
*/
public void testInvokeTimestampDiffTimestamp3() {
helpInvokeMethod("timestampDiff", new Object[] {ReservedWords.SQL_TSI_FRAC_SECOND, //$NON-NLS-1$
- tsUtil.createTimestamp(102, 5, 21, 3, 9, 35, 2), tsUtil.createTimestamp(102, 5, 22, 3, 9, 35, 1) },
+ TimestampUtil.createTimestamp(102, 5, 21, 3, 9, 35, 2), TimestampUtil.createTimestamp(102, 5, 22, 3, 9, 35, 1) },
new Long(86399999999999L));
}
public void testInvokeTimestampCreate1() {
- helpInvokeMethod("timestampCreate", new Object[] {tsUtil.createDate(103, 4, 15), //$NON-NLS-1$
- tsUtil.createTime(23, 59, 59)},
- tsUtil.createTimestamp(103, 4, 15, 23, 59, 59, 0));
+ helpInvokeMethod("timestampCreate", new Object[] {TimestampUtil.createDate(103, 4, 15), //$NON-NLS-1$
+ TimestampUtil.createTime(23, 59, 59)},
+ TimestampUtil.createTimestamp(103, 4, 15, 23, 59, 59, 0));
}
public void testInvokeBitand() {
@@ -1228,7 +1226,7 @@
/** defect 10941 */
public void testInvokeConvertTime() {
- helpInvokeMethod("convert", new Object[] {"05:00:00", "time"}, tsUtil.createTime(5, 0, 0)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ helpInvokeMethod("convert", new Object[] {"05:00:00", "time"}, TimestampUtil.createTime(5, 0, 0)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testInvokeXpath1() {
Modified: trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/engine/src/test/java/com/metamatrix/query/rewriter/TestQueryRewriter.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -2095,7 +2095,7 @@
}
public void testRewriteFromUnixTime() throws Exception {
- TimestampWithTimezone.resetCalendar(TimeZone.getTimeZone("GMT-06:00"));
+ TimestampWithTimezone.resetCalendar(TimeZone.getTimeZone("GMT-06:00")); //$NON-NLS-1$
try {
helpTestRewriteCriteria("from_unixtime(pm1.g1.e2) = '1992-12-01 07:00:00'", "timestampadd(SQL_TSI_SECOND, pm1.g1.e2, {ts'1969-12-31 18:00:00.0'}) = {ts'1992-12-01 07:00:00.0'}"); //$NON-NLS-1$ //$NON-NLS-2$
} finally {
Modified: trunk/metadata/src/main/java/com/metamatrix/metadata/runtime/api/MetadataConstants.java
===================================================================
--- trunk/metadata/src/main/java/com/metamatrix/metadata/runtime/api/MetadataConstants.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/metadata/src/main/java/com/metamatrix/metadata/runtime/api/MetadataConstants.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -52,10 +52,10 @@
*/
public static final short NOT_DEFINED_SHORT = Short.MIN_VALUE;
- public final static String BLANK = "";
+ public final static String BLANK = ""; //$NON-NLS-1$
//properties
- public static final String VERSION_DATE = "versionDate";
+ public static final String VERSION_DATE = "versionDate"; //$NON-NLS-1$
/**
@@ -68,7 +68,7 @@
public final static short NA = 4;
}
- final static String[] MATCH_TYPE_NAMES = {"Full", "Partial", "Neither", "N/A"};
+ final static String[] MATCH_TYPE_NAMES = {"Full", "Partial", "Neither", "N/A"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
public final static String getMatchTypeName(short type) {
return MATCH_TYPE_NAMES[type - 1];
@@ -87,7 +87,7 @@
public final static short INDEX = 6;
}
- final static String[] KEY_TYPE_NAMES = {"Primary", "Foreign", "Unique", "NonUnique", "AccessPattern", "Index"};
+ final static String[] KEY_TYPE_NAMES = {"Primary", "Foreign", "Unique", "NonUnique", "AccessPattern", "Index"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
public final static String getKeyTypeName(short type) {
return KEY_TYPE_NAMES[type - 1];
@@ -103,18 +103,18 @@
public final static short STORED_QUERY = 3;
}
- final static String[] PROCEDURE_TYPE_NAMES = {"Function", "StoredProc", "StoredQuery"};
+ final static String[] PROCEDURE_TYPE_NAMES = {"Function", "StoredProc", "StoredQuery"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
public final static String getProcedureTypeName(short type) {
return PROCEDURE_TYPE_NAMES[type - 1];
}
public static short getProcType(String typeName){
- if("Function".equalsIgnoreCase(typeName))
+ if("Function".equalsIgnoreCase(typeName)) //$NON-NLS-1$
return PROCEDURE_TYPES.FUNCTION;
- else if("StoredProc".equalsIgnoreCase(typeName) || "StoredProcedure".equalsIgnoreCase(typeName))
+ else if("StoredProc".equalsIgnoreCase(typeName) || "StoredProcedure".equalsIgnoreCase(typeName)) //$NON-NLS-1$ //$NON-NLS-2$
return PROCEDURE_TYPES.STORED_PROCEDURE;
- else if("StoredQuery".equalsIgnoreCase(typeName))
+ else if("StoredQuery".equalsIgnoreCase(typeName)) //$NON-NLS-1$
return PROCEDURE_TYPES.STORED_QUERY;
return NOT_DEFINED_SHORT;
@@ -126,7 +126,7 @@
public static final int INSERT_QUERY = 2;
public static final int DELETE_QUERY = 3;
public static final int[] TYPES = new int[]{SELECT_QUERY, UPDATE_QUERY, INSERT_QUERY, DELETE_QUERY};
- public static final String[] TYPE_NAMES = new String[]{"SelectQuery","UpdateQuery","InsertQuery","DeleteQuery"};
+ public static final String[] TYPE_NAMES = new String[]{"SelectQuery","UpdateQuery","InsertQuery","DeleteQuery"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
/**
@@ -141,23 +141,23 @@
public final static short QUERY_PLAN_DELETE_QUERY = 5;
}
- final static String[] QUERY_PLAN_TYPE_NAMES = {"MappingDefn",
- "QueryPlanGroup",
- "QueryPlanStoredQuery",
- "QueryPlanInsertQuery",
- "QueryPlanUpdateQuery",
- "QueryPlanDeleteQuery"};
+ final static String[] QUERY_PLAN_TYPE_NAMES = {"MappingDefn", //$NON-NLS-1$
+ "QueryPlanGroup", //$NON-NLS-1$
+ "QueryPlanStoredQuery", //$NON-NLS-1$
+ "QueryPlanInsertQuery", //$NON-NLS-1$
+ "QueryPlanUpdateQuery", //$NON-NLS-1$
+ "QueryPlanDeleteQuery"}; //$NON-NLS-1$
public final static String getQueryPlanTypeName(short type) {
return QUERY_PLAN_TYPE_NAMES[type];
}
public static short getQueryPlanType(String typeName){
- if("MappingDefn".equalsIgnoreCase(typeName))
+ if("MappingDefn".equalsIgnoreCase(typeName)) //$NON-NLS-1$
return QUERY_PLAN_TYPES.MAPPING_DEFN;
- else if("QueryPlanGroup".equalsIgnoreCase(typeName))
+ else if("QueryPlanGroup".equalsIgnoreCase(typeName)) //$NON-NLS-1$
return QUERY_PLAN_TYPES.QUERY_PLAN_GROUP;
- else if("QueryPlanStoredQuery".equalsIgnoreCase(typeName))
+ else if("QueryPlanStoredQuery".equalsIgnoreCase(typeName)) //$NON-NLS-1$
return QUERY_PLAN_TYPES.QUERY_PLAN_STORED_QUERY;
return NOT_DEFINED_SHORT;
@@ -174,22 +174,22 @@
public final static short RESULT_SET = 5;
}
- final static String[] PARAMETER_TYPE_NAMES = {"In", "Out", "InOut", "ReturnValue", "ResultSet"};
+ final static String[] PARAMETER_TYPE_NAMES = {"In", "Out", "InOut", "ReturnValue", "ResultSet"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
public final static String getParameterTypeName(short type) {
return PARAMETER_TYPE_NAMES[type - 1];
}
public static short getParameterType(String typeName){
- if("In".equalsIgnoreCase(typeName))
+ if("In".equalsIgnoreCase(typeName)) //$NON-NLS-1$
return PARAMETER_TYPES.IN_PARM;
- else if("Out".equalsIgnoreCase(typeName))
+ else if("Out".equalsIgnoreCase(typeName)) //$NON-NLS-1$
return PARAMETER_TYPES.OUT_PARM;
- else if("InOut".equalsIgnoreCase(typeName))
+ else if("InOut".equalsIgnoreCase(typeName)) //$NON-NLS-1$
return PARAMETER_TYPES.INOUT_PARM;
- else if("ReturnValue".equalsIgnoreCase(typeName) || "Return".equalsIgnoreCase(typeName))
+ else if("ReturnValue".equalsIgnoreCase(typeName) || "Return".equalsIgnoreCase(typeName)) //$NON-NLS-1$ //$NON-NLS-2$
return PARAMETER_TYPES.RETURN_VALUE;
- else if("ResultSet".equalsIgnoreCase(typeName))
+ else if("ResultSet".equalsIgnoreCase(typeName)) //$NON-NLS-1$
return PARAMETER_TYPES.RESULT_SET;
return NOT_DEFINED_SHORT;
@@ -205,20 +205,20 @@
public final static short UNSEARCHABLE = 4;
}
- final static String[] SEARCH_TYPE_NAMES = {"Searchable", "All Except Like", "Like Only", "Unsearchable"};
+ final static String[] SEARCH_TYPE_NAMES = {"Searchable", "All Except Like", "Like Only", "Unsearchable"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
public final static String getSearchTypeName(short type) {
return SEARCH_TYPE_NAMES[type - 1];
}
public final static short getSearchType(String typeName) {
- if("Searchable".equalsIgnoreCase(typeName))
+ if("Searchable".equalsIgnoreCase(typeName)) //$NON-NLS-1$
return SEARCH_TYPES.SEARCHABLE;
- else if("All Except Like".equalsIgnoreCase(typeName))
+ else if("All Except Like".equalsIgnoreCase(typeName)) //$NON-NLS-1$
return SEARCH_TYPES.ALLEXCEPTLIKE;
- else if("Like Only".equalsIgnoreCase(typeName))
+ else if("Like Only".equalsIgnoreCase(typeName)) //$NON-NLS-1$
return SEARCH_TYPES.LIKE_ONLY;
- else if("Unsearchable".equalsIgnoreCase(typeName))
+ else if("Unsearchable".equalsIgnoreCase(typeName)) //$NON-NLS-1$
return SEARCH_TYPES.UNSEARCHABLE;
return NOT_DEFINED_SHORT;
@@ -233,18 +233,18 @@
public final static short RESULT_SET = 3;
}
- final static String[] DATATYPE_TYPE_NAMES = {"Basic", "UserDefined", "ResultSet"};
+ final static String[] DATATYPE_TYPE_NAMES = {"Basic", "UserDefined", "ResultSet"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
public final static String getDataTypeTypeName(short type) {
return DATATYPE_TYPE_NAMES[type - 1];
}
public static short getDataTypeType(String typeName){
- if("Basic".equalsIgnoreCase(typeName))
+ if("Basic".equalsIgnoreCase(typeName)) //$NON-NLS-1$
return DATATYPE_TYPES.BASIC;
- else if("UserDefined".equalsIgnoreCase(typeName))
+ else if("UserDefined".equalsIgnoreCase(typeName)) //$NON-NLS-1$
return DATATYPE_TYPES.USER_DEFINED;
- else if("ResultSet".equalsIgnoreCase(typeName))
+ else if("ResultSet".equalsIgnoreCase(typeName)) //$NON-NLS-1$
return DATATYPE_TYPES.RESULT_SET;
return NOT_DEFINED_SHORT;
@@ -263,7 +263,7 @@
public static final short SYSTEM_DOCUMENT_TYPE = 7;
}
- final static String[] TABLE_TYPE_NAMES = {"Table", "SystemTable", "View", "Document", "MappingClass", "XmlTempTable"};
+ final static String[] TABLE_TYPE_NAMES = {"Table", "SystemTable", "View", "Document", "MappingClass", "XmlTempTable"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
public final static String getTableTypeName(short type) {
return TABLE_TYPE_NAMES[type - 1];
@@ -278,18 +278,18 @@
public static final short UNKNOWN = 3;
}
- final static String[] NULL_TYPE_NAMES = {"Not Nullable", "Nullable", "Unknown"};
+ final static String[] NULL_TYPE_NAMES = {"Not Nullable", "Nullable", "Unknown"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
public final static String getNullTypeName(short type) {
return NULL_TYPE_NAMES[type - 1];
}
public static short getNullType(String typeName){
- if("Not Nullable".equalsIgnoreCase(typeName))
+ if("Not Nullable".equalsIgnoreCase(typeName)) //$NON-NLS-1$
return NULL_TYPES.NOT_NULL;
- else if("Nullable".equalsIgnoreCase(typeName))
+ else if("Nullable".equalsIgnoreCase(typeName)) //$NON-NLS-1$
return NULL_TYPES.NULLABLE;
- else if("Unknown".equalsIgnoreCase(typeName))
+ else if("Unknown".equalsIgnoreCase(typeName)) //$NON-NLS-1$
return NULL_TYPES.UNKNOWN;
return NOT_DEFINED_SHORT;
@@ -321,7 +321,7 @@
public static final short PRIVATE_VISIBILITY = ModelInfo.PRIVATE;
}
- public final static String[] VISIBILITY_TYPE_NAMES = {"Public", "Private"};
+ public final static String[] VISIBILITY_TYPE_NAMES = {"Public", "Private"}; //$NON-NLS-1$ //$NON-NLS-2$
public final static String getVisibilityTypeName(short type){
if(type == VISIBILITY_TYPES.PUBLIC_VISIBILITY)
@@ -332,9 +332,9 @@
}
public final static short getVisibilityType(String typeName){
- if("Public".equalsIgnoreCase(typeName))
+ if("Public".equalsIgnoreCase(typeName)) //$NON-NLS-1$
return VISIBILITY_TYPES.PUBLIC_VISIBILITY;
- else if("Private".equalsIgnoreCase(typeName))
+ else if("Private".equalsIgnoreCase(typeName)) //$NON-NLS-1$
return VISIBILITY_TYPES.PRIVATE_VISIBILITY;
return NOT_DEFINED_SHORT;
}
@@ -372,10 +372,10 @@
}
}
- public final static String[] DATA_TYPE_FACETS_NAMES = {"equal", "ordered", "bounded",
- "cardinality", "numeric", "length", "minLength", "maxLength", "pattern", "enumeration",
- "whiteSpace", "maxInclusive", "minInclusive", "maxExclusive", "minExclusive",
- "totalDigits", "fractionDigits"};
+ public final static String[] DATA_TYPE_FACETS_NAMES = {"equal", "ordered", "bounded", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "cardinality", "numeric", "length", "minLength", "maxLength", "pattern", "enumeration", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+ "whiteSpace", "maxInclusive", "minInclusive", "maxExclusive", "minExclusive", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ "totalDigits", "fractionDigits"}; //$NON-NLS-1$ //$NON-NLS-2$
public final static String getDataTypeFacetName(short facetType){
if(facetType < 1 || facetType > DATA_TYPE_FACETS_NAMES.length){
@@ -435,7 +435,7 @@
public static final short COLLAPSE = 3;
}
- public final static String[] WHITE_SPACE_TYPE_NAMES = {"preserve", "replace", "collapse"};
+ public final static String[] WHITE_SPACE_TYPE_NAMES = {"preserve", "replace", "collapse"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
public final static String getWhiteSapceTypeName(short type){
if(type < 1 || type > WHITE_SPACE_TYPE_NAMES.length){
@@ -446,11 +446,11 @@
}
public final static short getWhiteSapceType(String typeName){
- if("preserve".equalsIgnoreCase(typeName)){
+ if("preserve".equalsIgnoreCase(typeName)){ //$NON-NLS-1$
return WHITE_SPACE_TYPES.PRESERVE;
- }else if("replace".equalsIgnoreCase(typeName)){
+ }else if("replace".equalsIgnoreCase(typeName)){ //$NON-NLS-1$
return WHITE_SPACE_TYPES.REPLACE;
- }else if("collapse".equalsIgnoreCase(typeName)){
+ }else if("collapse".equalsIgnoreCase(typeName)){ //$NON-NLS-1$
return WHITE_SPACE_TYPES.COLLAPSE;
}
return NOT_DEFINED_SHORT;
@@ -465,7 +465,7 @@
public static final short UNION = 3;
}
- public final static String[] VARIETY_TYPE_NAMES = {"atomic", "list", "union"};
+ public final static String[] VARIETY_TYPE_NAMES = {"atomic", "list", "union"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
public final static String getVarietyTypeName(short type){
if(type < 1 || type > VARIETY_TYPE_NAMES.length){
@@ -476,11 +476,11 @@
}
public final static short getVarietyType(String typeName){
- if("atomic".equalsIgnoreCase(typeName)){
+ if("atomic".equalsIgnoreCase(typeName)){ //$NON-NLS-1$
return VARIETY_TYPES.ATOMIC;
- }else if("list".equalsIgnoreCase(typeName)){
+ }else if("list".equalsIgnoreCase(typeName)){ //$NON-NLS-1$
return VARIETY_TYPES.LIST;
- }else if("union".equalsIgnoreCase(typeName)){
+ }else if("union".equalsIgnoreCase(typeName)){ //$NON-NLS-1$
return VARIETY_TYPES.UNION;
}
return NOT_DEFINED_SHORT;
@@ -500,7 +500,7 @@
public static final short RESTRICTION_AND_LISTAND_UNION = 7;
}
- public final static String[] FINAL_TYPE_NAMES = {"restriction", "list", "union"};
+ public final static String[] FINAL_TYPE_NAMES = {"restriction", "list", "union"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
public final static Collection getFinalTypeNames(short type){
if(type < 1 || type > 7){
@@ -529,11 +529,11 @@
while(iter.hasNext()){
String typeName = (String)iter.next();
- if("restriction".equalsIgnoreCase(typeName)){
+ if("restriction".equalsIgnoreCase(typeName)){ //$NON-NLS-1$
result = (short) (result | FINAL_TYPES.RESTRICTION);
- }else if("list".equalsIgnoreCase(typeName)){
+ }else if("list".equalsIgnoreCase(typeName)){ //$NON-NLS-1$
result = (short) (result | FINAL_TYPES.LIST);
- }else if("union".equalsIgnoreCase(typeName)){
+ }else if("union".equalsIgnoreCase(typeName)){ //$NON-NLS-1$
result = (short) (result | FINAL_TYPES.UNION);
}
}
@@ -548,9 +548,9 @@
* properties to a model, which is actually what we do for testing.
*/
final public static class CAPABILITY_PROPERTY_NAMES {
- public static final String PROP_BLACK_BOX = "supportsBlackBoxJoin";
- public static final String PROP_SINGLE_GROUP_SELECT = "requiresSingleGroupSelect";
- public static final String PROP_LEAF_JOIN_SELECT = "requiresLeafJoinSelect";
+ public static final String PROP_BLACK_BOX = "supportsBlackBoxJoin"; //$NON-NLS-1$
+ public static final String PROP_SINGLE_GROUP_SELECT = "requiresSingleGroupSelect"; //$NON-NLS-1$
+ public static final String PROP_LEAF_JOIN_SELECT = "requiresLeafJoinSelect"; //$NON-NLS-1$
}
}
Modified: trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/util/TestJDBCExecutionHelper.java
===================================================================
--- trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/util/TestJDBCExecutionHelper.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/util/TestJDBCExecutionHelper.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -24,21 +24,16 @@
*/
package com.metamatrix.connector.jdbc.util;
-import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
-import org.teiid.connector.api.ConnectorException;
-import org.teiid.connector.api.ExecutionContext;
-import org.teiid.connector.jdbc.JDBCExecutionHelper;
+import junit.framework.TestCase;
+
+import org.teiid.connector.jdbc.JDBCQueryExecution;
import org.teiid.connector.language.IQuery;
import org.teiid.connector.language.ISelect;
-import junit.framework.TestCase;
-
import com.metamatrix.common.types.DataTypeManager;
-import com.metamatrix.dqp.internal.datamgr.impl.FakeExecutionContextImpl;
-import com.metamatrix.dqp.internal.datamgr.impl.TypeFacilityImpl;
import com.metamatrix.dqp.internal.datamgr.language.LiteralImpl;
import com.metamatrix.dqp.internal.datamgr.language.QueryImpl;
import com.metamatrix.dqp.internal.datamgr.language.SelectImpl;
@@ -65,36 +60,8 @@
assertEquals( results[1], expectedResults[1]);
}
- public void testConvertValue1(){
- Object value = new Integer(5);
- Class expectedType = DataTypeManager.DefaultDataClasses.BIG_DECIMAL;
- Object result = null;
- try {
- ExecutionContext context = new FakeExecutionContextImpl();
- result = JDBCExecutionHelper.convertValue(value, expectedType, new ArrayList(), new TypeFacilityImpl(), false, context);
- } catch (ConnectorException e) {
- e.printStackTrace();
- fail("Failed converting Integer to BigDecimal"); //$NON-NLS-1$
- }
- assertEquals(result, new BigDecimal("5"));
- }
-
- public void testConvertValue2(){
- Object value = new Integer(5);
- Class expectedType = DataTypeManager.DefaultDataClasses.STRING;
- Object result = null;
- try {
- ExecutionContext context = new FakeExecutionContextImpl();
- result = JDBCExecutionHelper.convertValue(value, expectedType, new ArrayList(), new TypeFacilityImpl(), true, context);
- } catch (ConnectorException e) {
- e.printStackTrace();
- fail("Failed converting Integer to String"); //$NON-NLS-1$
- }
- assertEquals(result, "5"); //$NON-NLS-1$
- }
-
public void helpTestTrimString(String value, String expected) {
- String actual = JDBCExecutionHelper.trimString(value);
+ String actual = JDBCQueryExecution.trimString(value);
assertEquals("Did not get a match, expected=[" + expected + "', actual=[" + actual + "]", expected, actual); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
Modified: trunk/test-integration/src/test/java/com/metamatrix/data/metadata/runtime/TestMetadataInConnector.java
===================================================================
--- trunk/test-integration/src/test/java/com/metamatrix/data/metadata/runtime/TestMetadataInConnector.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/test-integration/src/test/java/com/metamatrix/data/metadata/runtime/TestMetadataInConnector.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -1,7 +1,5 @@
package com.metamatrix.data.metadata.runtime;
-import org.teiid.connector.api.ConnectorException;
-
import com.metamatrix.core.util.UnitTestUtil;
import com.metamatrix.jdbc.api.AbstractMMQueryTestCase;
@@ -11,14 +9,14 @@
private static final String VDB = "TestExtensions"; //$NON-NLS-1$
- public void testMetadataTable() throws ConnectorException {
+ public void testMetadataTable() throws Exception {
getConnection(VDB, DQP_PROP_FILE, ""); //$NON-NLS-1$
execute("Select * from TableA"); //$NON-NLS-1$
String expected[] = {"column1[string] column2[integer]"}; //$NON-NLS-1$
assertResults(expected);
}
- public void testMetadataProcedure() throws ConnectorException {
+ public void testMetadataProcedure() throws Exception {
getConnection(VDB, DQP_PROP_FILE, ""); //$NON-NLS-1$
executeStoredProcedure("exec AnyModel.ProcedureB(?)", new Object[] {"foo"}); //$NON-NLS-1$ //$NON-NLS-2$
String expected[] = {"column1[string] column2[integer]"}; //$NON-NLS-1$
Modified: trunk/test-integration/src/test/java/com/metamatrix/jdbc/TestMMDatabaseMetaData.java
===================================================================
--- trunk/test-integration/src/test/java/com/metamatrix/jdbc/TestMMDatabaseMetaData.java 2009-03-02 22:32:39 UTC (rev 524)
+++ trunk/test-integration/src/test/java/com/metamatrix/jdbc/TestMMDatabaseMetaData.java 2009-03-02 23:22:00 UTC (rev 525)
@@ -22,6 +22,12 @@
package com.metamatrix.jdbc;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
@@ -40,17 +46,18 @@
import java.util.List;
import java.util.Map;
-import junit.framework.TestCase;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
import com.metamatrix.core.util.UnitTestUtil;
import com.metamatrix.jdbc.util.ResultSetUtil;
/**
*/
-public class TestMMDatabaseMetaData extends TestCase {
+public class TestMMDatabaseMetaData {
- private static final int TESTS = 56;
- private static int tests = -1;
private static final String DQP_CONFIG_FILE = UnitTestUtil.getTestDataPath() + "/bqt/bqt.properties"; //$NON-NLS-1$
static Connection conn = null;
@@ -75,35 +82,26 @@
private static final int ResultSet_HOLD_CURSORS_OVER_COMMIT = 1; // ResultSet.HOLD_CURSORS_OVER_COMMIT == 1
private static final int ResultSet_CLOSE_CURSORS_AT_COMMIT = 2; // ResultSet.CLOSE_CURSORS_AT_COMMIT == 2
- public TestMMDatabaseMetaData(String name) {
- super(name);
- }
-
+ @Before
public void setUp() throws Exception {
- oneTimeSetUp(TESTS);
dbmd = new MMDatabaseMetaData((BaseDriver)DriverManager.getDriver(serverUrl), (MMConnection) conn);
}
- public void tearDown() throws Exception {
- tests--;
- if (tests == 0) {
- if (conn != null) {
- conn.close();
- }
+ @AfterClass
+ public static void oneTimeTearDown() throws Exception {
+ if (conn != null) {
+ conn.close();
}
}
- protected synchronized static void oneTimeSetUp(int numtests) throws Exception {
- if (tests == -1) {
- tests = numtests;
- if (conn == null) {
- Class.forName("com.metamatrix.jdbc.EmbeddedDriver"); //$NON-NLS-1$
- conn = DriverManager.getConnection(serverUrl);
- }
- }
+ @BeforeClass
+ public static void oneTimeSetUp() throws Exception {
+ Class.forName(EmbeddedDriver.class.getName());
+ conn = DriverManager.getConnection(serverUrl);
}
/** Test all the non-query methods */
+ @Test
public void testMethodsWithoutParams() throws Exception {
Class dbmdClass = dbmd.getClass();
// non-query Methods return String, boolean or int
@@ -140,6 +138,7 @@
}
/** Test all the methods that throw exception */
+ @Test
public void testMethodsWithExceptions() throws Exception {
Class dbmdClass = dbmd.getClass();
Method[] methods = dbmdClass.getDeclaredMethods();
@@ -154,6 +153,7 @@
}
/** test supportResultSetConcurrency() with params and test them with different input values */
+ @Test
public void testSupportResultSetConcurrency() throws Exception {
boolean returned = true;
String functionName = "supportResultSetConcurrency"; //$NON-NLS-1$
@@ -180,6 +180,7 @@
}
/** test supportResultSetHoldability() with params and test them with different input values */
+ @Test
public void testSupportResultSetHoldability() throws Exception {
boolean returned = false;
String functionName = "supportResultSetHoldability"; //$NON-NLS-1$
@@ -194,6 +195,7 @@
}
/** test supportResultSetType() with params and test them with different input values */
+ @Test
public void testSupportResultSetType() throws Exception {
boolean returned = true;
String functionName = "supportResultSetType"; //$NON-NLS-1$
@@ -213,6 +215,7 @@
}
/** test supportsTransactionIsolationLevel() with params and test them with different input values */
+ @Test
public void testSupportsTransactionIsolationLevel() throws Exception {
boolean returned = false;
String functionName = "supportsTransactionIsolationLevel"; //$NON-NLS-1$
@@ -224,6 +227,7 @@
}
/** test deletesAreDetected() with params and test them with different input values */
+ @Test
public void testDeletesAreDetected() throws Exception {
boolean returned = false;
String functionName = "deletesAreDetected"; //$NON-NLS-1$
@@ -242,6 +246,7 @@
}
/** test insertsAreDetected() with params and test them with different input values */
+ @Test
public void testInsertsAreDetected() throws Exception {
boolean returned = false;
String functionName = "insertsAreDetected"; //$NON-NLS-1$
@@ -260,6 +265,7 @@
}
/** test updatesAreDetected() with params and test them with different input values */
+ @Test
public void testUpdatesAreDetected() throws Exception {
boolean returned = false;
String functionName = "updatesAreDetected"; //$NON-NLS-1$
@@ -278,6 +284,7 @@
}
/** test ownUpdatesAreVisible() with params and test them with different input values */
+ @Test
public void testOwnUpdatesAreVisible() throws Exception {
boolean returned = false;
String functionName = "ownUpdatesAreVisible"; //$NON-NLS-1$
@@ -296,6 +303,7 @@
}
/** test ownInsertsAreVisible() with params and test them with different input values */
+ @Test
public void testOwnInsertsAreVisible() throws Exception {
boolean returned = false;
String functionName = "ownInsertsAreVisible"; //$NON-NLS-1$
@@ -314,6 +322,7 @@
}
/** test othersUpdatesAreVisible() with params and test them with different input values */
+ @Test
public void testOthersUpdatesAreVisible() throws Exception {
boolean returned = false;
String functionName = "othersUpdatesAreVisible"; //$NON-NLS-1$
@@ -332,6 +341,7 @@
}
/** test othersInsertsAreVisible() with params and test them with different input values */
+ @Test
public void testOthersInsertsAreVisible() throws Exception {
boolean returned = false;
String functionName = "othersInsertsAreVisible"; //$NON-NLS-1$
@@ -350,6 +360,7 @@
}
/** test othersInsertsAreVisible() with params and test them with different input values */
+ @Test
public void testOthersDeletesAreVisible() throws Exception {
boolean returned = false;
String functionName = "othersDeletesAreVisible"; //$NON-NLS-1$
@@ -368,12 +379,14 @@
}
/** test overloaded method supportsConvert() with params and test them with different input values */
+ @Test
public void testSupportsConvert1() throws Exception {
assertEquals("Expected doesn't match with actual for method - supportsConvert()", //$NON-NLS-1$
true, dbmd.supportsConvert());
}
/** test overloaded method supportsConvert() without params */
+ @Test
public void testSupportsConvert2() throws Exception {
// should succeed
helpTestSupportsConverts(Types.CHAR, Types.CHAR, true);
@@ -477,6 +490,7 @@
);
}
+ @Test
public void testUcaseMatchReturnsNoRows() throws Exception {
initResultSetStreams("testGetColumnsSingleMatchQuery"); //$NON-NLS-1$
ResultSet rs = null;
@@ -506,6 +520,7 @@
}
}
+ @Test
public void testGetColumnsSingleMatch() throws Exception {
initResultSetStreams("testGetColumnsSingleMatch"); //$NON-NLS-1$
ResultSet rs = null;
@@ -525,6 +540,7 @@
}
}
+ @Test
public void testGetCatalogs() throws Exception {
initResultSetStreams("testGetCatalogs"); //$NON-NLS-1$
ResultSet rs = null;
@@ -543,6 +559,7 @@
}
}
+ @Test
public void testGetCrossReference() throws Exception {
initResultSetStreams("testGetCrossReference"); //$NON-NLS-1$
ResultSet rs = null;
@@ -574,6 +591,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetImportedKeys() throws Exception {
initResultSetStreams("testGetImportedKeys"); //$NON-NLS-1$
ResultSet rs = null;
@@ -603,6 +621,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetExportedKeys() throws Exception {
initResultSetStreams("testGetExportedKeys"); //$NON-NLS-1$
ResultSet rs = null;
@@ -629,6 +648,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetIndexInfo() throws Exception {
initResultSetStreams("testGetIndexInfo"); //$NON-NLS-1$
ResultSet rs = null;
@@ -656,6 +676,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetPrimaryKeys() throws Exception {
initResultSetStreams("testGetPrimaryKeys"); //$NON-NLS-1$
ResultSet rs = null;
@@ -688,6 +709,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetProcedureColumns() throws Exception {
initResultSetStreams("testGetProcedureColumns"); //$NON-NLS-1$
ResultSet rs = null;
@@ -714,6 +736,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetProcedures() throws Exception {
initResultSetStreams("testGetProcedures"); //$NON-NLS-1$
ResultSet rs = null;
@@ -740,6 +763,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetSchemas() throws Exception {
initResultSetStreams("testGetSchemas"); //$NON-NLS-1$
ResultSet rs = null;
@@ -758,6 +782,7 @@
closeResultSetTestStreams();
}
}
+ @Test
public void testGetColumns() throws Exception {
initResultSetStreams("testGetColumns"); //$NON-NLS-1$
DatabaseMetaData dbmd = conn.getMetaData();
@@ -771,6 +796,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetColumns2() throws Exception {
initResultSetStreams("testGetColumns2"); //$NON-NLS-1$
DatabaseMetaData dbmd = conn.getMetaData();
@@ -786,6 +812,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetColumns3() throws Exception {
initResultSetStreams("testGetColumns3"); //$NON-NLS-1$
DatabaseMetaData dbmd = conn.getMetaData();
@@ -801,6 +828,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetColumns4() throws Exception {
initResultSetStreams("testGetColumns4"); //$NON-NLS-1$
DatabaseMetaData dbmd = conn.getMetaData();
@@ -817,6 +845,7 @@
}
+ @Test
public void testGetColumnPrivileges() throws Exception {
initResultSetStreams("testGetColumnPrivileges"); //$NON-NLS-1$
DatabaseMetaData dbmd = conn.getMetaData();
@@ -835,6 +864,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetColumnPrivilegesResultSetMetaData() throws Exception {
initResultSetStreams("testGetColumnPrivilegesResultSetMetaData"); //$NON-NLS-1$
DatabaseMetaData dbmd = conn.getMetaData();
@@ -847,6 +877,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetTablePrivileges() throws Exception {
initResultSetStreams("testGetTablePrivileges"); //$NON-NLS-1$
DatabaseMetaData dbmd = conn.getMetaData();
@@ -861,6 +892,7 @@
+ @Test
public void testGetTablePrivilegesResultSetMetaData() throws Exception {
initResultSetStreams("testGetTablePrivilegesResultSetMetaData"); //$NON-NLS-1$
DatabaseMetaData dbmd = conn.getMetaData();
@@ -873,6 +905,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetTables_specificTable() throws Exception {
initResultSetStreams("testGetTables_specificTable"); //$NON-NLS-1$
ResultSet rs = null;
@@ -892,6 +925,7 @@
}
}
+ @Test
public void testGetTables_specificTableTypes() throws Exception {
initResultSetStreams("testGetTables_specificTableTypes"); //$NON-NLS-1$
ResultSet rs = null;
@@ -913,6 +947,7 @@
}
}
+ @Test
public void testGetTables_specificTableMultipleTypes() throws Exception {
initResultSetStreams("testGetTables_specificTableMultipleTypes"); //$NON-NLS-1$
ResultSet rs = null;
@@ -934,6 +969,7 @@
}
}
+ @Test
public void testGetTables() throws Exception{
initResultSetStreams("testGetTables"); //$NON-NLS-1$
DatabaseMetaData dbmd = conn.getMetaData();
@@ -954,6 +990,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetTables_allTables() throws Exception {
initResultSetStreams("testGetTables_allTables"); //$NON-NLS-1$
ResultSet rs = null;
@@ -973,6 +1010,7 @@
}
}
+ @Test
public void testGetTableTypes() throws Exception {
initResultSetStreams("testGetTableTypes"); //$NON-NLS-1$
ResultSet rs = null;
@@ -991,29 +1029,7 @@
}
}
-// public void testDefect1659() throws Exception {
-// ResultSet rs = null;
-// try {
-// Statement stmt = conn.createStatement();
-// rs = stmt.executeQuery(
-// "SELECT DISTINCT NAME, IS_BUILTIN AS IsStandard, IS_BUILTIN AS IsPhysical, NAME AS TypeName, JAVA_CLASS_NAME AS JavaClass, SCALE, LENGTH AS TypeLength, lookup('SystemPhysical.NULL_TYPE_ENUM', 'NAME', 'CODE', NULL_TYPE) AS NullType, IS_SIGNED AS IsSigned, IS_AUTO_INCREMENTED AS IsAutoIncremented, IS_CASE_SENSITIVE AS IsCaseSensitive, PRECISION, RADIX, lookup('SystemPhysical.SEARCH_TYPE_ENUM', 'NAME', 'CODE', SEARCH_TYPE) AS SearchType, UUID AS UID, RUNTIME_TYPE_NAME AS RuntimeType, BASETYPE_NAME AS BaseType, DESCRIPTION " + //$NON-NLS-1$
-// "FROM SystemPhysical.DATATYPES AS DATATYPES LEFT OUTER JOIN SystemPhysical.ANNOTATIONS AS ann ON ANNOTATED_UUID = UUID "); //$NON-NLS-1$
-//
-// ResultSetMetaData rsmd = rs.getMetaData();
-// while(rs.next()) {
-// for(int i=1; i<=rsmd.getColumnCount(); i++) {
-// //System.out.print(rs.getObject(i) + " ");
-// }
-// //System.out.println();
-// }
-//
-// } finally {
-// if (rs != null) {
-// rs.close();
-// }
-// }
-// }
-
+ @Test
public void testGetTypeInfo_TotalNumber() throws Exception {
initResultSetStreams("testGetTypeInfo_TotalNumber"); //$NON-NLS-1$
ResultSet rs = null;
@@ -1033,6 +1049,7 @@
}
/** test with integer type */
+ @Test
public void testGetTypeInfo_specificType_Integer() throws Exception {
initResultSetStreams("testGetTypeInfo_specificType_Integer"); //$NON-NLS-1$
ResultSet rs = null;
@@ -1051,6 +1068,7 @@
}
}
+ @Test
public void testGetUDTs() throws Exception{
initResultSetStreams("testGetUDTs"); //$NON-NLS-1$
DatabaseMetaData dbmd = conn.getMetaData();
@@ -1071,6 +1089,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetUDTs_specificTypeName() throws Exception {
initResultSetStreams("testGetUDTs_specificTypeName"); //$NON-NLS-1$
ResultSet rs = null;
@@ -1089,6 +1108,7 @@
}
}
+ @Test
public void testGetVersionColumns() throws Exception {
initResultSetStreams("testGetVersionColumns"); //$NON-NLS-1$
DatabaseMetaData dbmd = conn.getMetaData();
@@ -1107,6 +1127,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetBestRowIdentifier() throws Exception {
initResultSetStreams("testGetBestRowIdentifier"); //$NON-NLS-1$
ResultSet rs = null;
@@ -1134,6 +1155,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetSuperTables() throws Exception {
initResultSetStreams("testSuperTables"); //$NON-NLS-1$
DatabaseMetaData dbmd = conn.getMetaData();
@@ -1146,6 +1168,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetSuperTypes() throws Exception {
initResultSetStreams("testGetSuperTypes"); //$NON-NLS-1$
DatabaseMetaData dbmd = conn.getMetaData();
@@ -1158,6 +1181,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetColumnsWithEscape() throws Exception {
DatabaseMetaData dbmd = conn.getMetaData();
ResultSet columns = dbmd.getColumns(null, "QT\\_Ora9DS", "BQT1.SmallA", "IntKey"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -1166,6 +1190,7 @@
assertFalse(columns.next());
}
+ @Test
public void testGetCrossReferenceWithEscape() throws Exception {
initResultSetStreams("testGetCrossReference"); //$NON-NLS-1$
ResultSet rs = null;
@@ -1197,6 +1222,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetExportedKeysWithEscape() throws Exception {
initResultSetStreams("testGetExportedKeys"); //$NON-NLS-1$
ResultSet rs = null;
@@ -1223,6 +1249,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetImportedKeysWithEscape() throws Exception {
initResultSetStreams("testGetImportedKeys"); //$NON-NLS-1$
ResultSet rs = null;
@@ -1252,6 +1279,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetIndexInfoWithEscape() throws Exception {
initResultSetStreams("testGetIndexInfo"); //$NON-NLS-1$
ResultSet rs = null;
@@ -1279,6 +1307,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetPrimaryKeysWithEscape() throws Exception {
initResultSetStreams("testGetPrimaryKeys"); //$NON-NLS-1$
ResultSet rs = null;
@@ -1311,6 +1340,7 @@
closeResultSetTestStreams();
}
+ @Test
public void testGetProceduresWithEscape() throws Exception {
initResultSetStreams("testGetProcedures"); //$NON-NLS-1$
ResultSet rs = null;
More information about the teiid-commits
mailing list