[teiid-commits] teiid SVN: r491 - in trunk: connector-api/src/main/java/com/metamatrix/connector/visitor/util and 51 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Feb 24 13:28:12 EST 2009


Author: shawkins
Date: 2009-02-24 13:28:11 -0500 (Tue, 24 Feb 2009)
New Revision: 491

Added:
   trunk/connectors/connector-jdbc/src/main/java/org/
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCBaseExecution.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCCapabilities.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCExecutionHelper.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCPlugin.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/JDBCPropertyNames.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/JDBCUpdateExecution.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/SimpleCapabilities.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/access/
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2ConvertModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2SQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbyConvertModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/informix/
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mm/
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLConvertModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/ConcatFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/DayWeekQuarterFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/ExtractFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/LeftOrRightFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/LocateFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/Log10FunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/MonthOrDayNameFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleConvertModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/DatePartFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/ModifiedDatePartFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLConvertModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/ssl/
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/ModFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseConvertModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/teradata/
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/BasicFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/DropFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/FunctionReplacementVisitor.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/SQLConversionVisitor.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/SubstringFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/xa/
   trunk/connectors/connector-jdbc/src/main/resources/org/
   trunk/connectors/connector-jdbc/src/main/resources/org/teiid/
   trunk/connectors/connector-jdbc/src/main/resources/org/teiid/connector/
   trunk/connectors/connector-jdbc/src/main/resources/org/teiid/connector/jdbc/
   trunk/connectors/connector-jdbc/src/test/java/org/
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/FakeConnection.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/MetadataFactory.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCSourceConnection.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/access/
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/db2/
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/db2/TestDB2ConvertModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/derby/
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/derby/TestDerbyConvertModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/impl/
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/impl/TestDropFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/impl/TestEscapeSyntaxModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/mysql/
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestDayWeekQuarterFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestExtractFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLeftOrRightFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLocateFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLog10FunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestMonthOrDayNameFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleConvertModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestSubstringFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/postgresql/
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sqlserver/
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sybase/
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/util/
Removed:
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCBaseExecution.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCCapabilities.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCConnector.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCPlugin.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCProcedureExecution.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCPropertyNames.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCQueryExecution.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCSourceConnection.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCUpdateExecution.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/SimpleCapabilities.java
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/access/
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/db2/
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/derby/
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/informix/
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/mm/
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/mysql/
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql/
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sqlserver/
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/ssl/
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sybase/
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/teradata/
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/util/
   trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/xa/
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2ConvertModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2SQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbyConvertModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLConvertModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/ConcatFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/DayWeekQuarterFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/ExtractFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/LeftOrRightFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/LocateFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/Log10FunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/MonthOrDayNameFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleConvertModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/DatePartFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/ModifiedDatePartFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLConvertModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/ModFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseConvertModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/BasicFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/DropFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/SQLConversionVisitor.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/SubstringFunctionModifier.java
   trunk/connectors/connector-jdbc/src/main/resources/com/
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/FakeConnection.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/MetadataFactory.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/TestJDBCSourceConnection.java
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/access/
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/db2/
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/derby/
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/extension/impl/
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/mysql/
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/postgresql/
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/sqlserver/
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/sybase/
   trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/util/
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/db2/TestDB2ConvertModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/derby/TestDerbyConvertModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/impl/TestDropFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/impl/TestEscapeSyntaxModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestDayWeekQuarterFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestExtractFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLeftOrRightFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLocateFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLog10FunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestMonthOrDayNameFunctionModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleConvertModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestSubstringFunctionModifier.java
Modified:
   trunk/connector-api/src/main/java/com/metamatrix/connector/api/ConnectorAnnotations.java
   trunk/connector-api/src/main/java/com/metamatrix/connector/visitor/util/CollectorVisitor.java
   trunk/connector-api/src/main/java/com/metamatrix/connector/xa/api/TransactionContext.java
   trunk/connector-api/src/main/java/com/metamatrix/connector/xa/api/XAConnection.java
   trunk/connector-api/src/main/java/com/metamatrix/connector/xa/api/XAConnector.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/access/AccessCapabilities.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/db2/DB2Capabilities.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbyCapabilities.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbySQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/informix/InformixCapabilities.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/informix/InformixSQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mm/MMCapabilities.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLCapabilities.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleCapabilities.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLCapabilities.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/sqlserver/SqlServerCapabilities.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SqlServerSQLTranslator.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/ssl/SequeLinkOracleCapabilities.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseCapabilities.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/teradata/TeradataCapabilities.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/AliasModifier.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/BindValueVisitor.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/EscapeSyntaxModifier.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/TranslatedCommand.java
   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/xa/JDBCSourceXAConnection.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/xa/XAJDBCPropertyNames.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/access/TestAccessSQLTranslator.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/db2/TestDB2SqlTranslator.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/mysql/TestMySQLTranslator.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/postgresql/TestPostgreSQLTranslator.java
   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/sybase/TestSybaseConvertModifier.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sybase/TestSybaseSQLConversionVisitor.java
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/util/TestFunctionReplacementVisitor.java
   trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialCapabilities.java
   trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialConnector.java
   trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialFunctionModifier.java
   trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialSQLTranslator.java
   trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/Request.java
   trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/RequestWorkItem.java
   trunk/engine/src/main/java/com/metamatrix/dqp/internal/transaction/TransactionContextImpl.java
   trunk/engine/src/main/java/com/metamatrix/dqp/internal/transaction/TransactionServerImpl.java
   trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/extension/TestSQLConversionVisitor.java
   trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/oracle/TestOracleSQLConversionVisitor.java
   trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/util/TestJDBCExecutionHelper.java
   trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestTPCR.java
   trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestXMLTypeTranslations.java
Log:
TEIID-164 repackaging the JDBC connector classes


Modified: trunk/connector-api/src/main/java/com/metamatrix/connector/api/ConnectorAnnotations.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/api/ConnectorAnnotations.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/api/ConnectorAnnotations.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -51,12 +51,4 @@
 		boolean enabled() default true;
 	}
 	
-	@Retention(RetentionPolicy.RUNTIME)
-	@Target({ElementType.TYPE})
-	public @interface ConnectorConfiguration {
-		boolean userIdentityCapable() default false;
-		boolean useSynchronousWorkers() default true;
-		boolean useConnectionPooling() default true;
-	}
-
 }

Modified: trunk/connector-api/src/main/java/com/metamatrix/connector/visitor/util/CollectorVisitor.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/visitor/util/CollectorVisitor.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/visitor/util/CollectorVisitor.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -42,7 +42,8 @@
         this.type = type;
     }
 
-    private void checkInstance(ILanguageObject obj) {
+    @SuppressWarnings("unchecked")
+	private void checkInstance(ILanguageObject obj) {
         if(type.isInstance(obj)) {
             this.objects.add((T)obj);
         }

Modified: trunk/connector-api/src/main/java/com/metamatrix/connector/xa/api/TransactionContext.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/xa/api/TransactionContext.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/xa/api/TransactionContext.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -29,12 +29,14 @@
  */
 public interface TransactionContext {
     
-    public static final int TRANSACTION_GLOBAL = 0;
-    public static final int TRANSACTION_LOCAL = 1;
-    public static final int TRANSACTION_REQUEST = 2;
-    public static final int TRANSACTION_BLOCK = 3;
-    public static final int TRANSACTION_NONE = 4;
-    
+	public enum Scope {
+		TRANSACTION_BLOCK,
+		TRANSACTION_GLOBAL,
+		TRANSACTION_LOCAL,
+		TRANSACTION_NONE,
+		TRANSACTION_REQUEST
+	}
+	
     public boolean isInTransaction();
     
     /** 
@@ -47,5 +49,5 @@
      */
     public String getTxnID();
     
-    public int getTransactionType();
+    public Scope getTransactionType();
 }

Modified: trunk/connector-api/src/main/java/com/metamatrix/connector/xa/api/XAConnection.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/xa/api/XAConnection.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/xa/api/XAConnection.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -31,9 +31,8 @@
 
 public interface XAConnection extends Connection{
     /**
-     * Get XAResource for this connection if the underlining data source is to be
-     * involved in a distributed transaction.
-     * @return
+     * Get XAResource for this connection
+     * @return the XAResource, never null
      */
     XAResource getXAResource() throws ConnectorException;
     

Modified: trunk/connector-api/src/main/java/com/metamatrix/connector/xa/api/XAConnector.java
===================================================================
--- trunk/connector-api/src/main/java/com/metamatrix/connector/xa/api/XAConnector.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connector-api/src/main/java/com/metamatrix/connector/xa/api/XAConnector.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -32,9 +32,7 @@
     /**
      * Obtain a connection with the connector. The connection must have XAResource in
      * order to participate in distributed transaction. The connection typically is associated
-     * with a particular security context. The connection is assumed to be pooled in 
-     * the underlying source if pooling is necessary - the connection will be closed 
-     * when execution has completed against it.  
+     * with a particular context.   
      * @param context The context of the current user that will be using this connection, 
      * may be null if this connection is for an administrative operation. 
      * @param transactionContext The context of the transaction under which the connection will be used. May be null.

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCBaseExecution.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCBaseExecution.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCBaseExecution.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,286 +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.jdbc;
-
-import java.sql.CallableStatement;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.sql.Statement;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-
-import com.metamatrix.common.util.PropertiesUtils;
-import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.api.ConnectorIdentity;
-import com.metamatrix.connector.api.ConnectorLogger;
-import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.basic.BasicExecution;
-import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
-import com.metamatrix.connector.jdbc.translator.Translator;
-import com.metamatrix.connector.language.ICommand;
-
-/**
- */
-public abstract class JDBCBaseExecution extends BasicExecution  {
-
-    // ===========================================================================================================================
-    // Fields
-    // ===========================================================================================================================
-
-    // Passed to constructor
-    protected Connection connection;
-    protected Translator sqlTranslator;
-    protected ConnectorIdentity id;
-    protected ConnectorLogger logger;
-    protected ExecutionContext context;
-
-    // Derived from properties
-    protected boolean trimString;
-    protected int fetchSize;
-
-    // Set during execution
-    protected Statement statement;
-
-    // ===========================================================================================================================
-    // Constructors
-    // ===========================================================================================================================
-
-    protected JDBCBaseExecution(Connection connection,
-                                Translator sqlTranslator,
-                                ConnectorLogger logger,
-                                Properties props,
-                                ExecutionContext context) {
-        this.connection = connection;
-        this.sqlTranslator = sqlTranslator;
-        this.logger = logger;
-        this.context = context;
-
-        String propStr = props.getProperty(JDBCPropertyNames.TRIM_STRINGS);
-        if (propStr != null) {
-            trimString = Boolean.valueOf(propStr).booleanValue();
-        }
-        
-        fetchSize = PropertiesUtils.getIntProperty(props, JDBCPropertyNames.FETCH_SIZE, context.getBatchSize());
-        int max = sqlTranslator.getMaxResultRows();
-        if (max > 0) {
-        	fetchSize = Math.min(fetchSize, max);
-        }
-    }
-
-    // ===========================================================================================================================
-    // Methods
-    // ===========================================================================================================================
-
-    private void addSql(TranslatedCommand command,
-                        StringBuffer message) {
-        String sql = command.getSql();
-        int ndx = sql.indexOf('?');
-        if (ndx >= 0) {
-            message.append(sql.substring(0, ndx));
-            int len = sql.length();
-            for (Iterator itr = command.getPreparedValues().iterator(); itr.hasNext() && ndx < len;) {
-                message.append(itr.next());
-                int nextNdx = sql.indexOf('?', ++ndx);
-                if (nextNdx >= 0) {
-                    message.append(sql.substring(ndx, nextNdx));
-                } else {
-                    message.append(sql.substring(ndx));
-                }
-                ndx = nextNdx;
-            }
-        } else {
-            message.append(sql);
-        }
-    }
-
-    /**
-     * @param error
-     * @param command
-     * @return
-     * @since 5.5
-     */
-    protected ConnectorException createAndLogError(SQLException error,
-                                                   TranslatedCommand command) {
-        ConnectorException connectorErr = createError(error, command);
-        this.logger.logError(connectorErr.getMessage());
-        return connectorErr;
-    }
-
-    /**
-     * @param error
-     * @param messageKey
-     * @param commands
-     * @return
-     * @throws ConnectorException
-     * @since 5.5
-     */
-    protected ConnectorException createAndLogError(Throwable error,
-                                                   String messageKey,
-                                                   List commands) throws ConnectorException {
-        String msg;
-        if (commands.isEmpty()) {
-            msg = error.getMessage();
-        } else {
-            msg = JDBCPlugin.Util.getString(messageKey, error.getMessage());
-            StringBuffer buf = new StringBuffer(msg);
-            for (Iterator itr = commands.iterator(); itr.hasNext();) {
-                buf.append("\n  "); //$NON-NLS-1$
-                addSql((TranslatedCommand)itr.next(), buf);
-            }
-            msg = buf.toString();
-        }
-        this.logger.logError(msg);
-        if (error instanceof ConnectorException) {
-            error = ((ConnectorException)error).getCause();
-        }
-        throw new ConnectorException(error, msg);
-    }
-
-    /**
-     * @param error
-     * @param command
-     * @return
-     * @since 5.5
-     */
-    protected ConnectorException createError(SQLException error,
-                                             TranslatedCommand command) {
-        String msg = (command == null ? error.getMessage()
-                        : JDBCPlugin.Util.getString("JDBCQueryExecution.Error_executing_query__1", //$NON-NLS-1$
-                                                    error.getMessage(), createSql(command)));
-        return new ConnectorException(error, msg);
-    }
-
-    private String createSql(TranslatedCommand command) {
-        StringBuffer msg = new StringBuffer();
-        addSql(command, msg);
-        return msg.toString();
-    }
-
-    protected TranslatedCommand translateCommand(ICommand command) throws ConnectorException {
-        TranslatedCommand translatedCommand = new TranslatedCommand(context, sqlTranslator);
-        translatedCommand.translateCommand(command);
-
-        if (translatedCommand.getSql() != null && this.logger.isDetailEnabled()) {
-            this.logger.logDetail("Source-specific command: " + translatedCommand.getSql()); //$NON-NLS-1$
-        }
-
-        return translatedCommand;
-    }
-
-    /*
-     * @see com.metamatrix.data.Execution#close()
-     */
-    public synchronized void close() throws ConnectorException {
-        try {
-            if (statement != null) {
-                statement.close();
-            }
-        } catch (SQLException e) {
-            throw new ConnectorException(e);
-        }
-    }
-
-    /*
-     * @see com.metamatrix.data.Execution#cancel()
-     */
-    public synchronized void cancel() throws ConnectorException {
-        // if both the DBMS and driver support aborting an SQL
-        try {
-            if (statement != null) {
-                statement.cancel();
-            }
-        } catch (SQLException e) {
-            // Defect 16187 - DataDirect does not support the cancel() method for
-            // Statement.cancel() for DB2 and Informix. Here we are tolerant
-            // of these and other JDBC drivers that do not support the cancel() operation.
-        }
-    }
-
-    protected void setSizeContraints(Statement statement) throws SQLException {
-        if (sqlTranslator.getMaxResultRows() > 0) {
-            statement.setMaxRows(sqlTranslator.getMaxResultRows());
-        }
-    	statement.setFetchSize(fetchSize);
-    }
-
-    protected synchronized Statement getStatement() throws SQLException {
-        if (statement != null) {
-            statement.close();
-            statement = null;
-        }
-        statement = connection.createStatement();
-        setSizeContraints(statement);
-        return statement;
-    }
-
-    protected synchronized CallableStatement getCallableStatement(String sql) throws SQLException {
-        if (statement != null) {
-            statement.close();
-            statement = null;
-        }
-        statement = connection.prepareCall(sql);
-        setSizeContraints(statement);
-        return (CallableStatement)statement;
-    }
-
-    protected synchronized PreparedStatement getPreparedStatement(String sql) throws SQLException {
-        if (statement != null) {
-            statement.close();
-            statement = null;
-        }
-        statement = connection.prepareStatement(sql);
-        setSizeContraints(statement);
-        return (PreparedStatement)statement;
-    }
-
-    /**
-     * Returns the JDBC connection used by the execution object.
-     * 
-     * @return Returns the connection.
-     * @since 4.1.1
-     */
-    public Connection getConnection() {
-        return this.connection;
-    }
-    
-    public Translator getSqlTranslator() {
-		return sqlTranslator;
-	}
-    
-    public void addStatementWarnings() throws SQLException {
-    	SQLWarning warning = this.statement.getWarnings();
-    	while (warning != null) {
-    		SQLWarning toAdd = warning;
-    		warning = toAdd.getNextWarning();
-    		toAdd.setNextException(null);
-    		if (logger.isDetailEnabled()) {
-    			logger.logDetail(context.getRequestIdentifier() + " Warning: ", warning); //$NON-NLS-1$
-    		}
-    		context.addWarning(toAdd);
-    	}
-    	this.statement.clearWarnings();
-    }
-}

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCCapabilities.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCCapabilities.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCCapabilities.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,399 +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.jdbc;
-
-import java.util.Arrays;
-import java.util.List;
-
-import com.metamatrix.connector.basic.BasicConnectorCapabilities;
-
-/**
- */
-public class JDBCCapabilities extends BasicConnectorCapabilities {
-    
-    public static final int DEFAULT_JDBC_MAX_IN_CRITERIA_SIZE = 1000;
-
-    /**
-     * 
-     */
-    public JDBCCapabilities() {
-        this.setMaxInCriteriaSize(DEFAULT_JDBC_MAX_IN_CRITERIA_SIZE);
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#getSupportedFunctions()
-     */
-    public List getSupportedFunctions() {
-        return Arrays.asList(new String[] { "+", "-", "*", "/" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-    }
-
-    /** 
-     * @see com.metamatrix.connector.basic.BasicConnectorCapabilities#getMaxInCriteriaSize()
-     * @since 4.2
-     */
-    public int getMaxInCriteriaSize() {
-        return maxInCriteriaSize;
-    }
-    
-    public void setMaxInCriteriaSize(int maxInCriteriaSize) {
-        this.maxInCriteriaSize = maxInCriteriaSize;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsAggregates()
-     */
-    public boolean supportsAggregates() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsAggregatesAvg()
-     */
-    public boolean supportsAggregatesAvg() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsAggregatesCount()
-     */
-    public boolean supportsAggregatesCount() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsAggregatesCountStar()
-     */
-    public boolean supportsAggregatesCountStar() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsAggregatesDistinct()
-     */
-    public boolean supportsAggregatesDistinct() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsAggregatesMax()
-     */
-    public boolean supportsAggregatesMax() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsAggregatesMin()
-     */
-    public boolean supportsAggregatesMin() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsAggregatesSum()
-     */
-    public boolean supportsAggregatesSum() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsAliasedGroup()
-     */
-    public boolean supportsAliasedGroup() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsAndCriteria()
-     */
-    public boolean supportsAndCriteria() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsBetweenCriteria()
-     */
-    public boolean supportsBetweenCriteria() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsCaseExpressions()
-     */
-    public boolean supportsCaseExpressions() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsCompareCriteria()
-     */
-    public boolean supportsCompareCriteria() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsCompareCriteriaEquals()
-     */
-    public boolean supportsCompareCriteriaEquals() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsCompareCriteriaGreaterThan()
-     */
-    public boolean supportsCompareCriteriaGreaterThan() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsCompareCriteriaGreaterThanOrEqual()
-     */
-    public boolean supportsCompareCriteriaGreaterThanOrEqual() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsCompareCriteriaLessThan()
-     */
-    public boolean supportsCompareCriteriaLessThan() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsCompareCriteriaLessThanOrEqual()
-     */
-    public boolean supportsCompareCriteriaLessThanOrEqual() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsCompareCriteriaNotEquals()
-     */
-    public boolean supportsCompareCriteriaNotEquals() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsCorrelatedSubqueries()
-     */
-    public boolean supportsCorrelatedSubqueries() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsCriteria()
-     */
-    public boolean supportsCriteria() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsExistsCriteria()
-     */
-    public boolean supportsExistsCriteria() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsFullOuterJoins()
-     */
-    public boolean supportsFullOuterJoins() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsInCriteria()
-     */
-    public boolean supportsInCriteria() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsInCriteriaSubquery()
-     */
-    public boolean supportsInCriteriaSubquery() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsIsNullCriteria()
-     */
-    public boolean supportsIsNullCriteria() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsJoins()
-     */
-    public boolean supportsJoins() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsLikeCriteria()
-     */
-    public boolean supportsLikeCriteria() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsLikeCriteriaEscapeCharacter()
-     */
-    public boolean supportsLikeCriteriaEscapeCharacter() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsNotCriteria()
-     */
-    public boolean supportsNotCriteria() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsOrCriteria()
-     */
-    public boolean supportsOrCriteria() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsOrderBy()
-     */
-    public boolean supportsOrderBy() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsOuterJoins()
-     */
-    public boolean supportsOuterJoins() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsQuantifiedCompareCriteria()
-     */
-    public boolean supportsQuantifiedCompareCriteria() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsQuantifiedCompareCriteriaAll()
-     */
-    public boolean supportsQuantifiedCompareCriteriaAll() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsScalarFunctions()
-     */
-    public boolean supportsScalarFunctions() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsScalarSubqueries()
-     */
-    public boolean supportsScalarSubqueries() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsSearchedCaseExpressions()
-     */
-    public boolean supportsSearchedCaseExpressions() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsSelectDistinct()
-     */
-    public boolean supportsSelectDistinct() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsSelectLiterals()
-     */
-    public boolean supportsSelectLiterals() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.ConnectorCapabilities#supportsSelfJoins()
-     */
-    public boolean supportsSelfJoins() {
-        return true;
-    }
-
-    /** 
-     * @see com.metamatrix.connector.api.ConnectorCapabilities#supportsInlineViews()
-     */
-    public boolean supportsInlineViews() {
-        return false;
-    }       
-    
-    public boolean supportsOrderByInInlineViews() {
-        return false;
-    }
-
-    /** 
-     * @see com.metamatrix.connector.api.ConnectorCapabilities#supportsQuantifiedCompareCriteriaSome()
-     */
-    public boolean supportsQuantifiedCompareCriteriaSome() {
-        return true;
-    }
-    
-    /** 
-     * @see com.metamatrix.connector.api.ConnectorCapabilities#supportsUnionOrderBy()
-     */
-    public boolean supportsUnionOrderBy() {
-        return true;
-    }
-    
-    /** 
-     * @see com.metamatrix.connector.basic.BasicConnectorCapabilities#supportsSetQueryOrderBy()
-     */
-    @Override
-    public boolean supportsSetQueryOrderBy() {
-        return true;
-    }
-    
-    /** 
-     * @see com.metamatrix.connector.api.ConnectorCapabilities#supportsUnions()
-     */
-    public boolean supportsUnions() {
-        return true;
-    }
-    
-    @Override
-    public boolean supportsBulkInsert() {
-    	return true;
-    }
-    
-    @Override
-    public boolean supportsBatchedUpdates() {
-    	return true;
-    }
-
-}

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCConnector.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCConnector.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCConnector.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,390 +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.jdbc;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.sql.Driver;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.util.Enumeration;
-import java.util.Properties;
-
-import javax.sql.DataSource;
-import javax.sql.XADataSource;
-
-import com.metamatrix.common.util.PropertiesUtils;
-import com.metamatrix.connector.api.Connection;
-import com.metamatrix.connector.api.ConnectorCapabilities;
-import com.metamatrix.connector.api.ConnectorEnvironment;
-import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.api.ConnectorLogger;
-import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.api.SingleIdentity;
-import com.metamatrix.connector.api.MappedUserIdentity;
-import com.metamatrix.connector.api.ConnectorAnnotations.ConnectionPooling;
-import com.metamatrix.connector.basic.BasicConnector;
-import com.metamatrix.connector.internal.ConnectorPropertyNames;
-import com.metamatrix.connector.jdbc.translator.Translator;
-import com.metamatrix.connector.jdbc.xa.JDBCSourceXAConnection;
-import com.metamatrix.connector.jdbc.xa.XAJDBCPropertyNames;
-import com.metamatrix.connector.xa.api.TransactionContext;
-import com.metamatrix.connector.xa.api.XAConnection;
-import com.metamatrix.connector.xa.api.XAConnector;
-import com.metamatrix.core.MetaMatrixCoreException;
-import com.metamatrix.core.util.ReflectionHelper;
-
-/**
- * JDBC implementation of Connector interface.
- */
- at ConnectionPooling
-public class JDBCConnector extends BasicConnector implements XAConnector {
-	
-    public static final String INVALID_AUTHORIZATION_SPECIFICATION_NO_SUBCLASS = "28000"; //$NON-NLS-1$
-
-	static final int NO_ISOLATION_LEVEL_SET = Integer.MIN_VALUE;
-
-	enum TransactionIsolationLevel {
-        TRANSACTION_READ_UNCOMMITTED(java.sql.Connection.TRANSACTION_READ_UNCOMMITTED),
-        TRANSACTION_READ_COMMITTED(java.sql.Connection.TRANSACTION_READ_COMMITTED),
-        TRANSACTION_REPEATABLE_READ(java.sql.Connection.TRANSACTION_REPEATABLE_READ),
-        TRANSACTION_SERIALIZABLE(java.sql.Connection.TRANSACTION_SERIALIZABLE),
-        TRANSACTION_NONE(java.sql.Connection.TRANSACTION_NONE);
-
-        private int connectionContant;
-
-        private TransactionIsolationLevel(int connectionConstant) {
-			this.connectionContant = connectionConstant;
-		}
-        
-        public int getConnectionConstant() {
-        	return connectionContant;
-        }
-	}
-	
-	protected ConnectorEnvironment environment;
-    private ConnectorLogger logger;
-    private ConnectorCapabilities capabilities;
-    private Translator sqlTranslator;
-    private DataSource ds;
-    private XADataSource xaDs;
-    private int transIsoLevel = NO_ISOLATION_LEVEL_SET;
-        
-    @Override
-    public void start(ConnectorEnvironment environment)
-    		throws ConnectorException {
-    	logger = environment.getLogger();
-        this.environment = environment;
-        
-        logger.logInfo(JDBCPlugin.Util.getString("JDBCConnector.JDBCConnector_initialized._1")); //$NON-NLS-1$
-        
-        capabilities = createCapabilities(environment, Thread.currentThread().getContextClassLoader());
-
-        Properties connectionProps = environment.getProperties();
-
-        // Get the JDBC properties ...
-        String dataSourceClassName = connectionProps.getProperty(JDBCPropertyNames.CONNECTION_SOURCE_CLASS);
-        
-        // Verify required items
-        if (dataSourceClassName == null || dataSourceClassName.trim().length() == 0) {
-            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Missing_JDBC_driver_class_name_1")); //$NON-NLS-1$
-        }
-        dataSourceClassName = dataSourceClassName.trim();
-
-        String levelStr = connectionProps.getProperty(JDBCPropertyNames.TRANSACTION_ISOLATION_LEVEL);
-        
-        if(levelStr != null && levelStr.trim().length() != 0){
-        	transIsoLevel = TransactionIsolationLevel.valueOf(levelStr.toUpperCase()).getConnectionConstant();
-        }
-        
-        try {
-            String className = environment.getProperties().getProperty(JDBCPropertyNames.EXT_TRANSLATOR_CLASS, Translator.class.getName());  
-            this.sqlTranslator = (Translator)ReflectionHelper.create(className, null, Thread.currentThread().getContextClassLoader());
-        } catch (MetaMatrixCoreException e) {
-            throw new ConnectorException(e);
-        }
-        sqlTranslator.initialize(environment);
-        
-        if (areAdminConnectionsAllowed()) {
-        	testConnection();
-        }
-
-        logger.logInfo(JDBCPlugin.Util.getString("JDBCConnector.JDBCConnector_started._4")); //$NON-NLS-1$
-    }
-    
-    private void testConnection() throws ConnectorException {
-    	Connection connection = null;
-        try {
-            connection = getConnection(null);
-        } catch (ConnectorException e) {
-            SQLException ex = (SQLException)e.getCause();
-            String sqlState = ex.getSQLState();
-            if (sqlState != null && INVALID_AUTHORIZATION_SPECIFICATION_NO_SUBCLASS.equals(sqlState)) {
-                throw e;
-            }
-            this.logger.logError(e.getMessage(), e);
-        } finally {
-        	if (connection != null) {
-        		connection.close();
-        	}
-        }
-    }
-    
-	@Override
-    public void stop() {     
-		/*
-		 * attempt to deregister drivers that may have been implicitly registered
-		 * with the driver manager
-		 */
-        Enumeration drivers = DriverManager.getDrivers();
-
-        String driverClassname = this.environment.getProperties().getProperty(JDBCPropertyNames.CONNECTION_SOURCE_CLASS);
-        boolean usingCustomClassLoader = PropertiesUtils.getBooleanProperty(this.environment.getProperties(), ConnectorPropertyNames.USING_CUSTOM_CLASSLOADER, false);
-
-        while(drivers.hasMoreElements()){
-        	Driver tempdriver = (Driver)drivers.nextElement();
-            if(tempdriver.getClass().getClassLoader() != this.getClass().getClassLoader()) {
-            	continue;
-            }
-            if(usingCustomClassLoader || tempdriver.getClass().getName().equals(driverClassname)) {
-                try {
-                    DriverManager.deregisterDriver(tempdriver);
-                } catch (Throwable e) {
-                    this.environment.getLogger().logError(e.getMessage());
-                }
-            }
-        }
-                
-        logger.logInfo(JDBCPlugin.Util.getString("JDBCConnector.JDBCConnector_stopped._3")); //$NON-NLS-1$
-    }
-    
-	@Override
-    public Connection getConnection(ExecutionContext context) throws ConnectorException {
-		DataSource dataSource = getDataSource();
-		if (dataSource == null) {
-			return getXAConnection(context, null);
-		}
-		java.sql.Connection conn = null;
-		try { 
-			if (context == null || context.getConnectorIdentity() instanceof SingleIdentity) {
-				conn = dataSource.getConnection();
-			} else if (context.getConnectorIdentity() instanceof MappedUserIdentity) {
-				MappedUserIdentity id = (MappedUserIdentity)context.getConnectorIdentity();
-				conn = dataSource.getConnection(id.getMappedUser(), id.getPassword());
-			}
-			setDefaultTransactionIsolationLevel(conn);
-		} catch (SQLException e) {
-			throw new ConnectorException(e);
-		}
-		return new JDBCSourceConnection(conn, this.environment, sqlTranslator);
-    }
-	
-	@Override
-	public XAConnection getXAConnection(
-			ExecutionContext context,
-			TransactionContext transactionContext) throws ConnectorException {
-		XADataSource xaDataSource = getXADataSource();
-		if (xaDataSource == null) {
-			throw new UnsupportedOperationException("Connector is not XA capable");
-		}
-		javax.sql.XAConnection conn = null;
-		try {
-			if (context == null || context.getConnectorIdentity() instanceof SingleIdentity) {
-				conn = xaDataSource.getXAConnection();
-			} else if (context.getConnectorIdentity() instanceof MappedUserIdentity) {
-				MappedUserIdentity id = (MappedUserIdentity)context.getConnectorIdentity();
-				conn = xaDataSource.getXAConnection(id.getMappedUser(), id.getPassword());
-			}
-			java.sql.Connection c = conn.getConnection();
-			setDefaultTransactionIsolationLevel(c);
-			return new JDBCSourceXAConnection(c, conn, this.environment, sqlTranslator);
-		} catch (SQLException e) {
-			throw new ConnectorException(e);
-		}
-	}
-
-    @Override
-	public ConnectorCapabilities getCapabilities() {
-		return capabilities;
-	}
-
-	static ConnectorCapabilities createCapabilities(ConnectorEnvironment environment, ClassLoader loader)
-		throws ConnectorException {
-		//create Capabilities
-		String className = environment.getProperties().getProperty(JDBCPropertyNames.EXT_CAPABILITY_CLASS, JDBCCapabilities.class.getName());  
-		try {
-		    ConnectorCapabilities result = (ConnectorCapabilities)ReflectionHelper.create(className, null, loader);
-		    if(result instanceof JDBCCapabilities) {
-		        String setCriteriaBatchSize = environment.getProperties().getProperty(JDBCPropertyNames.SET_CRITERIA_BATCH_SIZE);
-		        if(setCriteriaBatchSize != null) {
-		            int maxInCriteriaSize = Integer.parseInt(setCriteriaBatchSize);
-		            if(maxInCriteriaSize > 0) {
-		                ((JDBCCapabilities)result).setMaxInCriteriaSize(maxInCriteriaSize);
-		            }
-		        } 
-		    }
-		    return result;
-		} catch (Exception e) {
-			throw new ConnectorException(e);
-		}
-	}
-	
-    protected void createDataSources(String dataSourceClassName, final Properties connectionProps) throws ConnectorException {
-        // create data source
-        Object temp = null;
-        try {
-        	temp = ReflectionHelper.create(dataSourceClassName, null, Thread.currentThread().getContextClassLoader());
-        } catch (MetaMatrixCoreException e) {
-    		throw new ConnectorException(e,JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Unable_to_load_the_JDBC_driver_class_6", dataSourceClassName)); //$NON-NLS-1$
-    	}
-
-        final String url = connectionProps.getProperty(JDBCPropertyNames.URL);
-        if (url == null || url.trim().length() == 0) {
-            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Missing_JDBC_database_name_3")); //$NON-NLS-1$
-        }
-        
-    	if (temp instanceof Driver) {
-    		final Driver driver = (Driver)temp;
-    		// check URL if there is one
-            validateURL(driver, url);
-    		this.ds = (DataSource)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {DataSource.class}, new InvocationHandler() {
-    			@Override
-    			public Object invoke(Object proxy, Method method,
-    					Object[] args) throws Throwable {
-    				if (method.getName().equals("getConnection")) {
-    					Properties p = new Properties();
-    					if (args.length == 2) {
-    						p.put("user", args[0]);
-    						p.put("password", args[1]);
-    					} else {
-    						p.put("user", connectionProps.getProperty(JDBCPropertyNames.USERNAME));
-    						p.put("password", connectionProps.getProperty(JDBCPropertyNames.PASSWORD));
-    					}
-    					return driver.connect(url, p);
-    				} 
-    				throw new UnsupportedOperationException("Driver DataSource proxy only provides Connections");
-    			}
-    		});
-    	} else {
-    		parseURL(url, connectionProps);
-    		if (temp instanceof DataSource) {
-	    		this.ds = (DataSource)temp;
-	            PropertiesUtils.setBeanProperties(this.ds, connectionProps, null);
-    		} else if (temp instanceof XADataSource) {
-    			this.xaDs = (XADataSource)temp;
-    	        PropertiesUtils.setBeanProperties(this.xaDs, connectionProps, null);
-    		} else {
-    			throw new ConnectorException("Specified class is not a XADataSource, DataSource, or Driver " + dataSourceClassName);
-    		}
-    	} 
-    	if (this.ds instanceof XADataSource) {
-    		this.xaDs = (XADataSource)this.ds;
-    	}
-    }
-    
-    public DataSource getDataSource() {
-    	return ds;
-    }
-    
-    public XADataSource getXADataSource() {
-		return xaDs;
-	}
-        
-    private void validateURL(Driver driver, String url) throws ConnectorException {
-        boolean acceptsURL = false;
-        try {
-            acceptsURL = driver.acceptsURL(url);
-        } catch ( SQLException e ) {
-            throw new ConnectorException(e);
-        }
-        if(!acceptsURL ){
-            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Driver__7", driver.getClass().getName(), url)); //$NON-NLS-1$
-        }
-    }
-    
-    /**
-     * Parse URL for DataSource connection properties and add to connectionProps.
-     * @param url
-     * @param connectionProps
-     * @throws ConnectorException 
-     */
-    static void parseURL(final String url, final Properties connectionProps) throws ConnectorException {
-        // Will be: [jdbc:mmx:dbType://aHost:aPort], [DatabaseName=aDataBase], [CollectionID=aCollectionID], ...
-        final String[] urlParts = url.split(";"); //$NON-NLS-1$
-
-        // Will be: [jdbc:mmx:dbType:], [aHost:aPort]
-        final String[] protoHost = urlParts[0].split("//"); //$NON-NLS-1$
-
-        // Will be: [aHost], [aPort]
-        final String[] hostPort = protoHost[1].split(":"); //$NON-NLS-1$
-        connectionProps.setProperty(XAJDBCPropertyNames.SERVER_NAME, (String)hostPort[0]);
-        connectionProps.setProperty(XAJDBCPropertyNames.PORT_NUMBER, (String)hostPort[1]);
-
-        // For "databaseName", "SID", and all optional props
-        // (<propName1>=<propValue1>;<propName2>=<propValue2>;...)
-        for ( int i = 1; i < urlParts.length; i++ ) {
-            final String nameVal = (String) urlParts[i];
-            // Will be: [propName], [propVal]
-            final String[] aProp = nameVal.split("="); //$NON-NLS-1$
-            if ( aProp.length > 1) {
-                // Set optional prop names lower case so that we can find
-                // set method names for them when we introspect the DataSource
-                connectionProps.setProperty(aProp[0].toLowerCase(), aProp[1]);
-            }
-        }
-        
-        String serverName = connectionProps.getProperty(XAJDBCPropertyNames.SERVER_NAME);
-        String serverPort = connectionProps.getProperty(XAJDBCPropertyNames.PORT_NUMBER);
-    	if ( serverName == null || serverName.trim().length() == 0 ) {
-            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.MissingProp",  //$NON-NLS-1$
-                    XAJDBCPropertyNames.SERVER_NAME));
-        }
-        if ( serverPort == null || serverPort.trim().length() == 0 ) {
-            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.MissingProp",  //$NON-NLS-1$
-                    XAJDBCPropertyNames.PORT_NUMBER));
-        }
-        
-     // Unique resource name for this connector
-        final StringBuffer dataSourceResourceName = new StringBuffer(connectionProps.getProperty(XAJDBCPropertyNames.DATASOURCE_NAME, "XADS")); //$NON-NLS-1$
-        dataSourceResourceName.append('_'); 
-        dataSourceResourceName.append(serverName);
-        dataSourceResourceName.append('_'); 
-        dataSourceResourceName.append(connectionProps.getProperty(ConnectorPropertyNames.CONNECTOR_ID));
-        connectionProps.setProperty( XAJDBCPropertyNames.DATASOURCE_NAME, dataSourceResourceName.toString());
-    }
-    
-    public int getDefaultTransactionIsolationLevel() {
-        return this.transIsoLevel;
-    }
-    
-	protected void setDefaultTransactionIsolationLevel(java.sql.Connection sqlConn)
-			throws SQLException {
-		if(getDefaultTransactionIsolationLevel() != NO_ISOLATION_LEVEL_SET && getDefaultTransactionIsolationLevel() != java.sql.Connection.TRANSACTION_NONE){
-		    sqlConn.setTransactionIsolation(getDefaultTransactionIsolationLevel());
-		}
-	}
-        
-}

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCPlugin.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCPlugin.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCPlugin.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,45 +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.jdbc;
-
-import java.util.ResourceBundle;
-import com.metamatrix.core.BundleUtil;
-
-/**
- * CommonPlugin
- * <p>Used here in <code>data</code> to have access to the new
- * logging framework for <code>LogManager</code>.</p>
- */
-public class JDBCPlugin { // extends Plugin {
-
-    /**
-     * The plug-in identifier of this plugin
-     * (value <code>"com.metamatrix.data"</code>).
-     */
-    public static final String PLUGIN_ID = "com.metamatrix.connector.jdbc" ; //$NON-NLS-1$
-
-	public static final BundleUtil Util = new BundleUtil(PLUGIN_ID,
-	                                                     PLUGIN_ID + ".i18n", ResourceBundle.getBundle(PLUGIN_ID + ".i18n")); //$NON-NLS-1$ //$NON-NLS-2$
-}

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCProcedureExecution.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCProcedureExecution.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCProcedureExecution.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,197 +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.jdbc;
-
-import java.sql.CallableStatement;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import com.metamatrix.connector.api.ConnectorEnvironment;
-import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.api.ConnectorLogger;
-import com.metamatrix.connector.api.DataNotAvailableException;
-import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.api.ProcedureExecution;
-import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
-import com.metamatrix.connector.jdbc.translator.Translator;
-import com.metamatrix.connector.jdbc.util.JDBCExecutionHelper;
-import com.metamatrix.connector.language.ICommand;
-import com.metamatrix.connector.language.IParameter;
-import com.metamatrix.connector.language.IProcedure;
-import com.metamatrix.connector.language.IParameter.Direction;
-import com.metamatrix.connector.metadata.runtime.Element;
-import com.metamatrix.connector.metadata.runtime.RuntimeMetadata;
-
-/**
- */
-public class JDBCProcedureExecution extends JDBCQueryExecution implements ProcedureExecution {
-
-    private Map parameterIndexMap;
-    private RuntimeMetadata metadata;
-    
-    /**
-     * @param connection
-     * @param sqlTranslator
-     * @param logger
-     * @param props
-     * @param id
-     */
-    public JDBCProcedureExecution(ICommand command,
-        Connection connection,
-        Translator sqlTranslator,
-        ConnectorLogger logger,
-        Properties props,
-        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);
-
-        //translate command
-        TranslatedCommand translatedComm = translateCommand(procedure);
-        
-        //create statement or CallableStatement and execute
-        String sql = translatedComm.getSql();
-        try{
-            //create parameter index map
-            parameterIndexMap = createParameterIndexMap(procedure.getParameters(), sql);
-            CallableStatement cstmt = getCallableStatement(sql);
-            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));
-        }           
-        
-    }
-    
-    @Override
-    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$
-        }
-        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;
-        } catch (SQLException e) {
-            throw new ConnectorException(e);
-        }
-    }
-    
-}

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCPropertyNames.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCPropertyNames.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCPropertyNames.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,101 +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.jdbc;
-
-public class JDBCPropertyNames {
-    public static final String CONNECTION_SOURCE_CLASS = "Driver"; //$NON-NLS-1$
-    public static final String URL = "URL"; //$NON-NLS-1$
-    public static final String USERNAME = "User"; //$NON-NLS-1$
-    public static final String PASSWORD = "Password"; //$NON-NLS-1$
-
-    /**
-    * This is the property name of the ConnectorService property that defines
-    * whether or not String type values in Criteria statements in SQL queries to
-    * the data source should have spaces trimmed from them.
-    */
-    public static final String TRIM_STRINGS = "TrimStrings"; //$NON-NLS-1$
-
-    /**
-    * This is the property name of the ConnectorService property that defines
-    * the size of a SetCriteria (IN criteria) before the criteria is broken into 
-    * multiple queries and the results are aggregated.  0 indicates that set 
-    * criteria should never be broken.  The default value should be 0.
-    */
-    public static final String SET_CRITERIA_BATCH_SIZE = "SetCriteriaBatchSize"; //$NON-NLS-1$
-
-    /**
-     * This is the property name used to set the transaction isolation level on
-     * a connector's data source.  The value string must be the the same as one of the
-     * names of the values of the transaction isolation levels defined in
-     * <code>java.sql.Connection</code>.
-     * @see java.sql.Connection#setTransactionIsolation(int)
-     */
-    public static final String TRANSACTION_ISOLATION_LEVEL = "TransactionIsolationLevel"; //$NON-NLS-1$
-
-    /**
-     * This is the property name of the ConnectorService property that defines
-     * the time zone of the source database.  This property should only be used in 
-     * cases where the source database is in a different time zone than the 
-     * ConnectorService VM and the database/driver is not already handling 
-     * time zones correctly.
-     */
-    public static final String DATABASE_TIME_ZONE = "DatabaseTimeZone"; //$NON-NLS-1$
-
-     //***** Extension properties *****//
-    /**
-     * This property is used to specify the implementation of
-     * com.metamatrix.data.ConnectorCapabilities. 
-     */
-    public static final String EXT_CAPABILITY_CLASS= "ExtensionCapabilityClass"; //$NON-NLS-1$
-
-    /**
-     * This property is used to specify the implementation of
-     * com.metamatrix.connector.jdbc.extension.Translator
-     */
-    public static final String EXT_TRANSLATOR_CLASS= "ExtensionTranslationClass"; //$NON-NLS-1$
-
-    /**
-     * This property can be used to specify the fetch size used from the connector to
-     * its underlying source.
-     */
-    public static final String FETCH_SIZE = "FetchSize"; //$NON-NLS-1$
-
-    /**
-     * This property can be used to indicate that prepared statements should be used.
-     * This means Literals will be substituted for
-     * bind variables.
-     * @since 5.0.1 
-     */
-    public static final String USE_BIND_VARIABLES = "UseBindVariables";    //$NON-NLS-1$
-    
-    /**
-     * This property is used to turn on/off the use of the default comments like
-     * connection id and requestid in the source SQL query.
-     */
-    public static final String USE_COMMENTS_SOURCE_QUERY= "UseCommentsInSourceQuery";    //$NON-NLS-1$    
-    
-    public static final String CONNECTION_TEST_QUERY = "ConnectionTestQuery"; //$NON-NLS-1$
-    
-    public static final String IS_VALID_TIMEOUT = "IsValidTimeout"; //$NON-NLS-1$
-
-}

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCQueryExecution.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCQueryExecution.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCQueryExecution.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,195 +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.jdbc;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import com.metamatrix.connector.api.ConnectorEnvironment;
-import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.api.ConnectorLogger;
-import com.metamatrix.connector.api.DataNotAvailableException;
-import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.api.ResultSetExecution;
-import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.api.ValueTranslator;
-import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
-import com.metamatrix.connector.jdbc.translator.Translator;
-import com.metamatrix.connector.jdbc.util.JDBCExecutionHelper;
-import com.metamatrix.connector.language.ICommand;
-import com.metamatrix.connector.language.IQueryCommand;
-
-/**
- * 
- */
-public class JDBCQueryExecution extends JDBCBaseExecution implements ResultSetExecution {
-
-    // ===========================================================================================================================
-    // Fields
-    // ===========================================================================================================================
-
-    protected ResultSet results;
-    protected Class[] columnDataTypes;
-    protected ConnectorEnvironment env;
-    protected ICommand command;
-	private boolean[] transformKnown;
-	private ValueTranslator[] transforms;
-	private boolean[] trimColumn;
-	private int[] nativeTypes;
-
-    // ===========================================================================================================================
-    // Constructors
-    // ===========================================================================================================================
-
-    public JDBCQueryExecution(ICommand command, Connection connection,
-                              Translator sqlTranslator,
-                              ConnectorLogger logger,
-                              Properties props,
-                              ExecutionContext context,
-                              ConnectorEnvironment env) {
-        super(connection, sqlTranslator, logger, props, context);
-        this.command = command;
-        this.env = env;
-    }
-    
-    @Override
-    public void execute() throws ConnectorException {
-        // get column types
-        columnDataTypes = ((IQueryCommand)command).getColumnTypes();
-
-        // translate command
-        TranslatedCommand translatedComm = translateCommand(command);
-
-        String sql = translatedComm.getSql();
-
-        try {
-
-            if (!translatedComm.isPrepared()) {
-                results = getStatement().executeQuery(sql);
-            } else {
-            	PreparedStatement pstatement = getPreparedStatement(sql);
-                sqlTranslator.bindPreparedStatementValues(this.connection, pstatement, translatedComm);
-                results = pstatement.executeQuery();
-            } 
-            addStatementWarnings();
-            initResultSetInfo();
-
-        } catch (SQLException e) {
-            throw createAndLogError(e, translatedComm);
-        }
-    }
-
-	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;
-		        } 
-		    }
-		}
-
-		transformKnown = new boolean[columnDataTypes.length];
-		transforms = new ValueTranslator[columnDataTypes.length];
-	}
-    
-    @Override
-    public List next() throws ConnectorException, DataNotAvailableException {
-        try {
-            if (results.next()) {
-                // New row for result set
-                List vals = new ArrayList(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);
-                        }
-                    }
-                    vals.add(value); 
-                }
-
-                return vals;
-            } 
-        } catch (SQLException e) {
-            throw new ConnectorException(e,
-                    JDBCPlugin.Util.getString("JDBCTranslator.Unexpected_exception_translating_results___8", e.getMessage())); //$NON-NLS-1$
-        }
-        
-        return null;
-    }
-    
-    /**
-     * @see com.metamatrix.connector.jdbc.JDBCBaseExecution#close()
-     */
-    public void close() throws ConnectorException {
-        // first we would need to close the result set here then we can close
-        // the statement, using the base class.
-        if (results != null) {
-            try {
-                results.close();
-                results = null;
-            } catch (SQLException e) {
-                throw new ConnectorException(e);
-            }
-        }
-        super.close();
-    }
-
-}

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCSourceConnection.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCSourceConnection.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCSourceConnection.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,130 +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.jdbc;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import com.metamatrix.connector.api.ConnectorEnvironment;
-import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.api.ConnectorLogger;
-import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.api.ProcedureExecution;
-import com.metamatrix.connector.api.ResultSetExecution;
-import com.metamatrix.connector.api.UpdateExecution;
-import com.metamatrix.connector.jdbc.translator.Translator;
-import com.metamatrix.connector.language.ICommand;
-import com.metamatrix.connector.language.IProcedure;
-import com.metamatrix.connector.language.IQueryCommand;
-import com.metamatrix.connector.metadata.runtime.RuntimeMetadata;
-
-/**
- * 
- */
-public class JDBCSourceConnection extends com.metamatrix.connector.basic.BasicConnection {
-    protected java.sql.Connection physicalConnection;
-    protected ConnectorEnvironment environment;
-    private ConnectorLogger logger;
-    private Translator sqlTranslator;
-
-    public JDBCSourceConnection(java.sql.Connection connection, ConnectorEnvironment environment, Translator sqlTranslator) throws ConnectorException {
-        this.physicalConnection = connection;
-        this.environment = environment;
-        this.logger = environment.getLogger();
-        this.sqlTranslator = sqlTranslator;
-        this.sqlTranslator.afterConnectionCreation(connection);
-    }
-    
-    @Override
-    public ResultSetExecution createResultSetExecution(IQueryCommand command,
-    		ExecutionContext executionContext, RuntimeMetadata metadata)
-    		throws ConnectorException {
-    	return new JDBCQueryExecution(command, this.physicalConnection, sqlTranslator, logger, this.environment.getProperties(), executionContext, this.environment);
-    }
-    
-    @Override
-    public ProcedureExecution createProcedureExecution(IProcedure command,
-    		ExecutionContext executionContext, RuntimeMetadata metadata)
-    		throws ConnectorException {
-    	return new JDBCProcedureExecution(command, this.physicalConnection, sqlTranslator, logger, this.environment.getProperties(), metadata, executionContext, this.environment);
-    }
-
-    @Override
-    public UpdateExecution createUpdateExecution(ICommand command,
-    		ExecutionContext executionContext, RuntimeMetadata metadata)
-    		throws ConnectorException {
-    	return new JDBCUpdateExecution(command, this.physicalConnection, sqlTranslator, logger, this.environment.getProperties(), executionContext);    
-    }
-    
-    @Override
-    public void close() {
-		closeSourceConnection();
-	}
-
-	protected void closeSourceConnection() {
-		try {
-            this.physicalConnection.close();
-        } catch(SQLException e) {
-        	logger.logDetail("Exception during close: " + e.getMessage());
-        }
-	}
-
-    @Override
-    public boolean isAlive() {
-    	Connection connection = this.physicalConnection;
-        Statement statement = null;
-    	try {
-    		int timeout = this.sqlTranslator.getIsValidTimeout();
-    		if (timeout >= 0) {
-    			return connection.isValid(timeout);
-    		}
-            if(connection.isClosed()){
-                return false;
-            } 
-            String connectionTestQuery = sqlTranslator.getConnectionTestQuery();
-            if (connectionTestQuery != null) {
-		        statement = connection.createStatement();
-		        statement.executeQuery(connectionTestQuery);
-            }
-        } catch(SQLException e) {
-        	return false;
-        } finally {
-            if ( statement != null ) {
-                try {
-                    statement.close();
-                } catch ( SQLException e ) {
-                }
-            }
-        }
-        return true;
-    }
-    
-    @Override
-    public void closeCalled() {
-    	
-    }
-    
-}

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCUpdateExecution.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCUpdateExecution.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCUpdateExecution.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,264 +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.jdbc;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.api.ConnectorLogger;
-import com.metamatrix.connector.api.DataNotAvailableException;
-import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.api.UpdateExecution;
-import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
-import com.metamatrix.connector.jdbc.translator.Translator;
-import com.metamatrix.connector.language.IBatchedUpdates;
-import com.metamatrix.connector.language.IBulkInsert;
-import com.metamatrix.connector.language.ICommand;
-
-/**
- */
-public class JDBCUpdateExecution extends JDBCBaseExecution implements
-                                                          UpdateExecution {
-
-	private ICommand command;
-	private int[] result;
-	
-    /**
-     * @param connection
-     * @param sqlTranslator
-     * @param logger
-     * @param props
-     * @param id
-     */
-    public JDBCUpdateExecution(ICommand command, Connection connection,
-                               Translator sqlTranslator,
-                               ConnectorLogger logger,
-                               Properties props,
-                               ExecutionContext context) {
-        super(connection, sqlTranslator, logger, props, context);
-        this.command = command;
-    }
-
-    // ===========================================================================================================================
-    // Methods
-    // ===========================================================================================================================
-
-    @Override
-    public void execute() throws ConnectorException {
-        if (command instanceof IBulkInsert) {
-            result = new int [] {execute((IBulkInsert)command)};
-        } else if (command instanceof IBatchedUpdates) {
-        	result = execute(((IBatchedUpdates)command));
-        } else {
-            // translate command
-            TranslatedCommand translatedComm = translateCommand(command);
-
-            result = new int [] {executeTranslatedCommand(translatedComm)};
-        }
-    }
-
-    /**
-     * @see com.metamatrix.data.api.BatchedUpdatesExecution#execute(com.metamatrix.connector.language.ICommand[])
-     * @since 4.2
-     */
-    public int[] execute(IBatchedUpdates batchedCommand) throws ConnectorException {
-        boolean succeeded = false;
-
-        boolean commitType = getAutoCommit(null);
-        ICommand[] commands = (ICommand[])batchedCommand.getUpdateCommands().toArray(new ICommand[batchedCommand.getUpdateCommands().size()]);
-        int[] results = new int[commands.length];
-
-        try {
-            // temporarily turn the auto commit off, and set it back to what it was
-            // before at the end of the command execution.
-            if (commitType) {
-                connection.setAutoCommit(false);
-            }
-
-            List executedCmds = new ArrayList();
-            
-            TranslatedCommand previousCommand = null;
-            
-            for (int i = 0; i < commands.length; i++) {
-                TranslatedCommand command = translateCommand(commands[i]);
-                if (command.isPrepared()) {
-                    PreparedStatement pstmt = null;
-                    if (previousCommand != null && previousCommand.isPrepared() && previousCommand.getSql().equals(command.getSql())) {
-                        pstmt = (PreparedStatement)statement;
-                    } else {
-                        if (!executedCmds.isEmpty()) {
-                            executeBatch(i, results, executedCmds);
-                        }
-                        pstmt = getPreparedStatement(command.getSql());
-                    }
-                    sqlTranslator.bindPreparedStatementValues(this.connection, pstmt, command);
-                    pstmt.addBatch();
-                } else {
-                    if (previousCommand != null && previousCommand.isPrepared()) {
-                        executeBatch(i, results, executedCmds);
-                        getStatement();
-                    }
-                    if (statement == null) {
-                        getStatement();
-                    }
-                    statement.addBatch(command.getSql());
-                }
-                executedCmds.add(command);
-                previousCommand = command;
-            }
-            if (!executedCmds.isEmpty()) {
-                executeBatch(commands.length, results, executedCmds);
-            }
-            succeeded = true;
-        } catch (SQLException e) {
-            throw createAndLogError(e, null);
-        } finally {
-            if (commitType) {
-                restoreAutoCommit(!succeeded, null);
-            }
-        }
-
-        return results;
-    }
-
-    /**
-     * An implementation to bulk insert rows into single table.
-     * 
-     * @param command
-     * @return
-     * @throws ConnectorException
-     */
-    public int execute(IBulkInsert command) throws ConnectorException {
-        boolean succeeded = false;
-
-        // translate command
-        TranslatedCommand translatedComm = translateCommand(command);
-
-        // create statement or PreparedStatement and execute
-        String sql = translatedComm.getSql();
-
-        boolean commitType = getAutoCommit(translatedComm);
-        int updateCount = -1;
-        try {
-            // temporarily turn the auto commit off, and set it back to what it was
-            // before at the end of the command execution.
-            if (commitType) {
-                connection.setAutoCommit(false);
-            }
-            PreparedStatement stmt = getPreparedStatement(sql);
-            updateCount = sqlTranslator.executeStatementForBulkInsert(this.connection, stmt, translatedComm);
-            addStatementWarnings();
-            succeeded = true;
-        } catch (SQLException e) {
-            throw createAndLogError(e, translatedComm);
-        } finally {
-            if (commitType) {
-                restoreAutoCommit(!succeeded, translatedComm);
-            }
-        }
-        return updateCount;
-    }
-
-    private void executeBatch(int commandCount,
-                              int[] results,
-                              List commands) throws ConnectorException {
-        try {
-            int[] batchResults = statement.executeBatch();
-            addStatementWarnings();
-            for (int j = 0; j < batchResults.length; j++) {
-                results[commandCount - 1 - j] = batchResults[batchResults.length - 1 - j];
-            }
-            commands.clear();
-        } catch (SQLException err) {
-            throw createAndLogError(err, "JDBCQueryExecution.Error_executing_query__3", commands); //$NON-NLS-1$
-        }
-    }
-
-    /**
-     * @param translatedComm
-     * @throws ConnectorException
-     * @since 4.3
-     */
-    private int executeTranslatedCommand(TranslatedCommand translatedComm) throws ConnectorException {
-        // create statement or PreparedStatement and execute
-        String sql = translatedComm.getSql();
-
-        try {
-        	int updateCount;
-            if (!translatedComm.isPrepared()) {
-                updateCount = getStatement().executeUpdate(sql);
-            } else {
-            	PreparedStatement pstatement = getPreparedStatement(sql);
-                sqlTranslator.bindPreparedStatementValues(this.connection, pstatement, translatedComm);
-                updateCount = pstatement.executeUpdate();
-            } 
-            addStatementWarnings();
-            return updateCount;
-        } catch (SQLException err) {
-            throw createError(err, translatedComm);
-        }
-    }
-
-    /**
-     * @param command
-     * @return
-     * @throws ConnectorException
-     */
-    private boolean getAutoCommit(TranslatedCommand command) throws ConnectorException {
-        try {
-            return connection.getAutoCommit();
-        } catch (SQLException err) {
-            throw createAndLogError(err, command);
-        }
-    }
-
-    /**
-     * If the auto comm
-     * 
-     * @param exceptionOccurred
-     * @param command
-     * @throws ConnectorException
-     */
-    private void restoreAutoCommit(boolean exceptionOccurred,
-                                   TranslatedCommand command) throws ConnectorException {
-        try {
-            if (exceptionOccurred) {
-                connection.rollback();
-            }
-            connection.setAutoCommit(true);
-        } catch (SQLException err) {
-            throw createAndLogError(err, command);
-        }
-    }
-    
-    @Override
-    public int[] getUpdateCounts() throws DataNotAvailableException,
-    		ConnectorException {
-    	return result;
-    }
-}

Deleted: trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/SimpleCapabilities.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/SimpleCapabilities.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/SimpleCapabilities.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,371 +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.jdbc;
-
-import java.util.List;
-
-import com.metamatrix.connector.api.ConnectorCapabilities;
-
-/**
- * This is a "simple" capabilities class that allows criteria but no 
- * complicated joins, subqueries, etc to be passed to the connector.
- * This capabilities class may come in handy for testing and for 
- * sources that support JDBC but don't support extended JDBC capabilities.  
- */
-public class SimpleCapabilities extends JDBCCapabilities implements ConnectorCapabilities {
-
-    public SimpleCapabilities() {
-        // Max acceptable by all BQT dbs (Sybase=250, Oracle=1000)
-        setMaxInCriteriaSize(250);
-    }
-    
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsAndCriteria()
-     */
-    public boolean supportsAndCriteria() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsCompareCriteria()
-     */
-    public boolean supportsCompareCriteria() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsCompareCriteriaEquals()
-     */
-    public boolean supportsCompareCriteriaEquals() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsCompareCriteriaGreaterThan()
-     */
-    public boolean supportsCompareCriteriaGreaterThan() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsCompareCriteriaGreaterThanOrEqual()
-     */
-    public boolean supportsCompareCriteriaGreaterThanOrEqual() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsCompareCriteriaLessThan()
-     */
-    public boolean supportsCompareCriteriaLessThan() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsCompareCriteriaLessThanOrEqual()
-     */
-    public boolean supportsCompareCriteriaLessThanOrEqual() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsCompareCriteriaNotEquals()
-     */
-    public boolean supportsCompareCriteriaNotEquals() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsCriteria()
-     */
-    public boolean supportsCriteria() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsInCriteria()
-     */
-    public boolean supportsInCriteria() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsIsNullCriteria()
-     */
-    public boolean supportsIsNullCriteria() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsJoins()
-     */
-    public boolean supportsJoins() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsLikeCriteria()
-     */
-    public boolean supportsLikeCriteria() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsNotCriteria()
-     */
-    public boolean supportsNotCriteria() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsOrCriteria()
-     */
-    public boolean supportsOrCriteria() {
-        return true;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsSelectDistinct()
-     */
-    public boolean supportsSelectDistinct() {
-        return true;
-    }
-
-    /** 
-     * @see com.metamatrix.connector.api.ConnectorCapabilities#supportsSelectLiterals()
-     * @since 4.2
-     */
-    public boolean supportsSelectLiterals() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsAliasedGroup()
-     */
-    public boolean supportsAliasedGroup() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsSelfJoins()
-     */
-    public boolean supportsSelfJoins() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsOuterJoins()
-     */
-    public boolean supportsOuterJoins() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsFullOuterJoins()
-     */
-    public boolean supportsFullOuterJoins() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsBetweenCriteria()
-     */
-    public boolean supportsBetweenCriteria() {
-        return false;
-    }
-
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsLikeCriteriaEscapeCharacter()
-     */
-    public boolean supportsLikeCriteriaEscapeCharacter() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsInCriteriaSubquery()
-     */
-    public boolean supportsInCriteriaSubquery() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsExistsCriteria()
-     */
-    public boolean supportsExistsCriteria() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsQuantifiedCompareCriteria()
-     */
-    public boolean supportsQuantifiedCompareCriteria() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsQuantifiedCompareCriteriaSome()
-     */
-    public boolean supportsQuantifiedCompareCriteriaSome() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsQuantifiedCompareCriteriaAll()
-     */
-    public boolean supportsQuantifiedCompareCriteriaAll() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsOrderBy()
-     */
-    public boolean supportsOrderBy() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsAggregates()
-     */
-    public boolean supportsAggregates() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsAggregatesSum()
-     */
-    public boolean supportsAggregatesSum() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsAggregatesAvg()
-     */
-    public boolean supportsAggregatesAvg() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsAggregatesMin()
-     */
-    public boolean supportsAggregatesMin() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsAggregatesMax()
-     */
-    public boolean supportsAggregatesMax() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsAggregatesCount()
-     */
-    public boolean supportsAggregatesCount() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsAggregatesCountStar()
-     */
-    public boolean supportsAggregatesCountStar() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsAggregatesDistinct()
-     */
-    public boolean supportsAggregatesDistinct() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsScalarSubqueries()
-     */
-    public boolean supportsScalarSubqueries() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsCorrelatedSubqueries()
-     */
-    public boolean supportsCorrelatedSubqueries() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsCaseExpressions()
-     */
-    public boolean supportsCaseExpressions() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsSearchedCaseExpressions()
-     */
-    public boolean supportsSearchedCaseExpressions() {
-        return false;
-    }
-
-    /* 
-     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsScalarFunctions()
-     */
-    public boolean supportsScalarFunctions() {
-        return false;
-    }
-
-    /**
-     * Return null to indicate no functions are supported.
-     * @return null 
-     * @see com.metamatrix.connector.api.ConnectorCapabilities#getSupportedFunctions()
-     */
-    public List getSupportedFunctions() {
-        return null;
-    }
-
-    public boolean supportsInlineViews() {
-        return false;
-    }       
-
-    public boolean supportsOrderByInInlineViews() {
-        return false;
-    }
-
-    /** 
-     * @see com.metamatrix.connector.api.ConnectorCapabilities#supportsUnionOrderBy()
-     * @since 4.2
-     */
-    public boolean supportsUnionOrderBy() {
-        return false;
-    }
-    
-    /** 
-     * @see com.metamatrix.connector.api.ConnectorCapabilities#supportsUnions()
-     * @since 4.2
-     */
-    public boolean supportsUnions() {
-        return false;
-    }
-
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCBaseExecution.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCBaseExecution.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCBaseExecution.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCBaseExecution.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,287 @@
+/*
+ * 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.sql.CallableStatement;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.Statement;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+import org.teiid.connector.jdbc.translator.TranslatedCommand;
+import org.teiid.connector.jdbc.translator.Translator;
+
+import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.connector.api.ConnectorException;
+import com.metamatrix.connector.api.ConnectorIdentity;
+import com.metamatrix.connector.api.ConnectorLogger;
+import com.metamatrix.connector.api.ExecutionContext;
+import com.metamatrix.connector.basic.BasicExecution;
+import com.metamatrix.connector.language.ICommand;
+
+/**
+ */
+public abstract class JDBCBaseExecution extends BasicExecution  {
+
+    // ===========================================================================================================================
+    // Fields
+    // ===========================================================================================================================
+
+    // Passed to constructor
+    protected Connection connection;
+    protected Translator sqlTranslator;
+    protected ConnectorIdentity id;
+    protected ConnectorLogger logger;
+    protected ExecutionContext context;
+
+    // Derived from properties
+    protected boolean trimString;
+    protected int fetchSize;
+
+    // Set during execution
+    protected Statement statement;
+
+    // ===========================================================================================================================
+    // Constructors
+    // ===========================================================================================================================
+
+    protected JDBCBaseExecution(Connection connection,
+                                Translator sqlTranslator,
+                                ConnectorLogger logger,
+                                Properties props,
+                                ExecutionContext context) {
+        this.connection = connection;
+        this.sqlTranslator = sqlTranslator;
+        this.logger = logger;
+        this.context = context;
+
+        String propStr = props.getProperty(JDBCPropertyNames.TRIM_STRINGS);
+        if (propStr != null) {
+            trimString = Boolean.valueOf(propStr).booleanValue();
+        }
+        
+        fetchSize = PropertiesUtils.getIntProperty(props, JDBCPropertyNames.FETCH_SIZE, context.getBatchSize());
+        int max = sqlTranslator.getMaxResultRows();
+        if (max > 0) {
+        	fetchSize = Math.min(fetchSize, max);
+        }
+    }
+
+    // ===========================================================================================================================
+    // Methods
+    // ===========================================================================================================================
+
+    private void addSql(TranslatedCommand command,
+                        StringBuffer message) {
+        String sql = command.getSql();
+        int ndx = sql.indexOf('?');
+        if (ndx >= 0) {
+            message.append(sql.substring(0, ndx));
+            int len = sql.length();
+            for (Iterator itr = command.getPreparedValues().iterator(); itr.hasNext() && ndx < len;) {
+                message.append(itr.next());
+                int nextNdx = sql.indexOf('?', ++ndx);
+                if (nextNdx >= 0) {
+                    message.append(sql.substring(ndx, nextNdx));
+                } else {
+                    message.append(sql.substring(ndx));
+                }
+                ndx = nextNdx;
+            }
+        } else {
+            message.append(sql);
+        }
+    }
+
+    /**
+     * @param error
+     * @param command
+     * @return
+     * @since 5.5
+     */
+    protected ConnectorException createAndLogError(SQLException error,
+                                                   TranslatedCommand command) {
+        ConnectorException connectorErr = createError(error, command);
+        this.logger.logError(connectorErr.getMessage());
+        return connectorErr;
+    }
+
+    /**
+     * @param error
+     * @param messageKey
+     * @param commands
+     * @return
+     * @throws ConnectorException
+     * @since 5.5
+     */
+    protected ConnectorException createAndLogError(Throwable error,
+                                                   String messageKey,
+                                                   List commands) throws ConnectorException {
+        String msg;
+        if (commands.isEmpty()) {
+            msg = error.getMessage();
+        } else {
+            msg = JDBCPlugin.Util.getString(messageKey, error.getMessage());
+            StringBuffer buf = new StringBuffer(msg);
+            for (Iterator itr = commands.iterator(); itr.hasNext();) {
+                buf.append("\n  "); //$NON-NLS-1$
+                addSql((TranslatedCommand)itr.next(), buf);
+            }
+            msg = buf.toString();
+        }
+        this.logger.logError(msg);
+        if (error instanceof ConnectorException) {
+            error = ((ConnectorException)error).getCause();
+        }
+        throw new ConnectorException(error, msg);
+    }
+
+    /**
+     * @param error
+     * @param command
+     * @return
+     * @since 5.5
+     */
+    protected ConnectorException createError(SQLException error,
+                                             TranslatedCommand command) {
+        String msg = (command == null ? error.getMessage()
+                        : JDBCPlugin.Util.getString("JDBCQueryExecution.Error_executing_query__1", //$NON-NLS-1$
+                                                    error.getMessage(), createSql(command)));
+        return new ConnectorException(error, msg);
+    }
+
+    private String createSql(TranslatedCommand command) {
+        StringBuffer msg = new StringBuffer();
+        addSql(command, msg);
+        return msg.toString();
+    }
+
+    protected TranslatedCommand translateCommand(ICommand command) throws ConnectorException {
+        TranslatedCommand translatedCommand = new TranslatedCommand(context, sqlTranslator);
+        translatedCommand.translateCommand(command);
+
+        if (translatedCommand.getSql() != null && this.logger.isDetailEnabled()) {
+            this.logger.logDetail("Source-specific command: " + translatedCommand.getSql()); //$NON-NLS-1$
+        }
+
+        return translatedCommand;
+    }
+
+    /*
+     * @see com.metamatrix.data.Execution#close()
+     */
+    public synchronized void close() throws ConnectorException {
+        try {
+            if (statement != null) {
+                statement.close();
+            }
+        } catch (SQLException e) {
+            throw new ConnectorException(e);
+        }
+    }
+
+    /*
+     * @see com.metamatrix.data.Execution#cancel()
+     */
+    public synchronized void cancel() throws ConnectorException {
+        // if both the DBMS and driver support aborting an SQL
+        try {
+            if (statement != null) {
+                statement.cancel();
+            }
+        } catch (SQLException e) {
+            // Defect 16187 - DataDirect does not support the cancel() method for
+            // Statement.cancel() for DB2 and Informix. Here we are tolerant
+            // of these and other JDBC drivers that do not support the cancel() operation.
+        }
+    }
+
+    protected void setSizeContraints(Statement statement) throws SQLException {
+        if (sqlTranslator.getMaxResultRows() > 0) {
+            statement.setMaxRows(sqlTranslator.getMaxResultRows());
+        }
+    	statement.setFetchSize(fetchSize);
+    }
+
+    protected synchronized Statement getStatement() throws SQLException {
+        if (statement != null) {
+            statement.close();
+            statement = null;
+        }
+        statement = connection.createStatement();
+        setSizeContraints(statement);
+        return statement;
+    }
+
+    protected synchronized CallableStatement getCallableStatement(String sql) throws SQLException {
+        if (statement != null) {
+            statement.close();
+            statement = null;
+        }
+        statement = connection.prepareCall(sql);
+        setSizeContraints(statement);
+        return (CallableStatement)statement;
+    }
+
+    protected synchronized PreparedStatement getPreparedStatement(String sql) throws SQLException {
+        if (statement != null) {
+            statement.close();
+            statement = null;
+        }
+        statement = connection.prepareStatement(sql);
+        setSizeContraints(statement);
+        return (PreparedStatement)statement;
+    }
+
+    /**
+     * Returns the JDBC connection used by the execution object.
+     * 
+     * @return Returns the connection.
+     * @since 4.1.1
+     */
+    public Connection getConnection() {
+        return this.connection;
+    }
+    
+    public Translator getSqlTranslator() {
+		return sqlTranslator;
+	}
+    
+    public void addStatementWarnings() throws SQLException {
+    	SQLWarning warning = this.statement.getWarnings();
+    	while (warning != null) {
+    		SQLWarning toAdd = warning;
+    		warning = toAdd.getNextWarning();
+    		toAdd.setNextException(null);
+    		if (logger.isDetailEnabled()) {
+    			logger.logDetail(context.getRequestIdentifier() + " Warning: ", warning); //$NON-NLS-1$
+    		}
+    		context.addWarning(toAdd);
+    	}
+    	this.statement.clearWarnings();
+    }
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCBaseExecution.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCCapabilities.java (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCCapabilities.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCCapabilities.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCCapabilities.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,399 @@
+/*
+ * 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.Arrays;
+import java.util.List;
+
+import com.metamatrix.connector.basic.BasicConnectorCapabilities;
+
+/**
+ */
+public class JDBCCapabilities extends BasicConnectorCapabilities {
+    
+    public static final int DEFAULT_JDBC_MAX_IN_CRITERIA_SIZE = 1000;
+
+    /**
+     * 
+     */
+    public JDBCCapabilities() {
+        this.setMaxInCriteriaSize(DEFAULT_JDBC_MAX_IN_CRITERIA_SIZE);
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#getSupportedFunctions()
+     */
+    public List getSupportedFunctions() {
+        return Arrays.asList(new String[] { "+", "-", "*", "/" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+    }
+
+    /** 
+     * @see com.metamatrix.connector.basic.BasicConnectorCapabilities#getMaxInCriteriaSize()
+     * @since 4.2
+     */
+    public int getMaxInCriteriaSize() {
+        return maxInCriteriaSize;
+    }
+    
+    public void setMaxInCriteriaSize(int maxInCriteriaSize) {
+        this.maxInCriteriaSize = maxInCriteriaSize;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsAggregates()
+     */
+    public boolean supportsAggregates() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsAggregatesAvg()
+     */
+    public boolean supportsAggregatesAvg() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsAggregatesCount()
+     */
+    public boolean supportsAggregatesCount() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsAggregatesCountStar()
+     */
+    public boolean supportsAggregatesCountStar() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsAggregatesDistinct()
+     */
+    public boolean supportsAggregatesDistinct() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsAggregatesMax()
+     */
+    public boolean supportsAggregatesMax() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsAggregatesMin()
+     */
+    public boolean supportsAggregatesMin() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsAggregatesSum()
+     */
+    public boolean supportsAggregatesSum() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsAliasedGroup()
+     */
+    public boolean supportsAliasedGroup() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsAndCriteria()
+     */
+    public boolean supportsAndCriteria() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsBetweenCriteria()
+     */
+    public boolean supportsBetweenCriteria() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsCaseExpressions()
+     */
+    public boolean supportsCaseExpressions() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsCompareCriteria()
+     */
+    public boolean supportsCompareCriteria() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsCompareCriteriaEquals()
+     */
+    public boolean supportsCompareCriteriaEquals() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsCompareCriteriaGreaterThan()
+     */
+    public boolean supportsCompareCriteriaGreaterThan() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsCompareCriteriaGreaterThanOrEqual()
+     */
+    public boolean supportsCompareCriteriaGreaterThanOrEqual() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsCompareCriteriaLessThan()
+     */
+    public boolean supportsCompareCriteriaLessThan() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsCompareCriteriaLessThanOrEqual()
+     */
+    public boolean supportsCompareCriteriaLessThanOrEqual() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsCompareCriteriaNotEquals()
+     */
+    public boolean supportsCompareCriteriaNotEquals() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsCorrelatedSubqueries()
+     */
+    public boolean supportsCorrelatedSubqueries() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsCriteria()
+     */
+    public boolean supportsCriteria() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsExistsCriteria()
+     */
+    public boolean supportsExistsCriteria() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsFullOuterJoins()
+     */
+    public boolean supportsFullOuterJoins() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsInCriteria()
+     */
+    public boolean supportsInCriteria() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsInCriteriaSubquery()
+     */
+    public boolean supportsInCriteriaSubquery() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsIsNullCriteria()
+     */
+    public boolean supportsIsNullCriteria() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsJoins()
+     */
+    public boolean supportsJoins() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsLikeCriteria()
+     */
+    public boolean supportsLikeCriteria() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsLikeCriteriaEscapeCharacter()
+     */
+    public boolean supportsLikeCriteriaEscapeCharacter() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsNotCriteria()
+     */
+    public boolean supportsNotCriteria() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsOrCriteria()
+     */
+    public boolean supportsOrCriteria() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsOrderBy()
+     */
+    public boolean supportsOrderBy() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsOuterJoins()
+     */
+    public boolean supportsOuterJoins() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsQuantifiedCompareCriteria()
+     */
+    public boolean supportsQuantifiedCompareCriteria() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsQuantifiedCompareCriteriaAll()
+     */
+    public boolean supportsQuantifiedCompareCriteriaAll() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsScalarFunctions()
+     */
+    public boolean supportsScalarFunctions() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsScalarSubqueries()
+     */
+    public boolean supportsScalarSubqueries() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsSearchedCaseExpressions()
+     */
+    public boolean supportsSearchedCaseExpressions() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsSelectDistinct()
+     */
+    public boolean supportsSelectDistinct() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsSelectLiterals()
+     */
+    public boolean supportsSelectLiterals() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.ConnectorCapabilities#supportsSelfJoins()
+     */
+    public boolean supportsSelfJoins() {
+        return true;
+    }
+
+    /** 
+     * @see com.metamatrix.connector.api.ConnectorCapabilities#supportsInlineViews()
+     */
+    public boolean supportsInlineViews() {
+        return false;
+    }       
+    
+    public boolean supportsOrderByInInlineViews() {
+        return false;
+    }
+
+    /** 
+     * @see com.metamatrix.connector.api.ConnectorCapabilities#supportsQuantifiedCompareCriteriaSome()
+     */
+    public boolean supportsQuantifiedCompareCriteriaSome() {
+        return true;
+    }
+    
+    /** 
+     * @see com.metamatrix.connector.api.ConnectorCapabilities#supportsUnionOrderBy()
+     */
+    public boolean supportsUnionOrderBy() {
+        return true;
+    }
+    
+    /** 
+     * @see com.metamatrix.connector.basic.BasicConnectorCapabilities#supportsSetQueryOrderBy()
+     */
+    @Override
+    public boolean supportsSetQueryOrderBy() {
+        return true;
+    }
+    
+    /** 
+     * @see com.metamatrix.connector.api.ConnectorCapabilities#supportsUnions()
+     */
+    public boolean supportsUnions() {
+        return true;
+    }
+    
+    @Override
+    public boolean supportsBulkInsert() {
+    	return true;
+    }
+    
+    @Override
+    public boolean supportsBatchedUpdates() {
+    	return true;
+    }
+
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCCapabilities.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCConnector.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,391 @@
+/*
+ * 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.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.Enumeration;
+import java.util.Properties;
+
+import javax.sql.DataSource;
+import javax.sql.XADataSource;
+
+import org.teiid.connector.jdbc.translator.Translator;
+import org.teiid.connector.jdbc.xa.JDBCSourceXAConnection;
+import org.teiid.connector.jdbc.xa.XAJDBCPropertyNames;
+
+import com.metamatrix.common.util.PropertiesUtils;
+import com.metamatrix.connector.api.Connection;
+import com.metamatrix.connector.api.ConnectorCapabilities;
+import com.metamatrix.connector.api.ConnectorEnvironment;
+import com.metamatrix.connector.api.ConnectorException;
+import com.metamatrix.connector.api.ConnectorLogger;
+import com.metamatrix.connector.api.ExecutionContext;
+import com.metamatrix.connector.api.SingleIdentity;
+import com.metamatrix.connector.api.MappedUserIdentity;
+import com.metamatrix.connector.api.ConnectorAnnotations.ConnectionPooling;
+import com.metamatrix.connector.basic.BasicConnector;
+import com.metamatrix.connector.internal.ConnectorPropertyNames;
+import com.metamatrix.connector.xa.api.TransactionContext;
+import com.metamatrix.connector.xa.api.XAConnection;
+import com.metamatrix.connector.xa.api.XAConnector;
+import com.metamatrix.core.MetaMatrixCoreException;
+import com.metamatrix.core.util.ReflectionHelper;
+
+/**
+ * JDBC implementation of Connector interface.
+ */
+ at ConnectionPooling
+public class JDBCConnector extends BasicConnector implements XAConnector {
+	
+    public static final String INVALID_AUTHORIZATION_SPECIFICATION_NO_SUBCLASS = "28000"; //$NON-NLS-1$
+
+	static final int NO_ISOLATION_LEVEL_SET = Integer.MIN_VALUE;
+
+	enum TransactionIsolationLevel {
+        TRANSACTION_READ_UNCOMMITTED(java.sql.Connection.TRANSACTION_READ_UNCOMMITTED),
+        TRANSACTION_READ_COMMITTED(java.sql.Connection.TRANSACTION_READ_COMMITTED),
+        TRANSACTION_REPEATABLE_READ(java.sql.Connection.TRANSACTION_REPEATABLE_READ),
+        TRANSACTION_SERIALIZABLE(java.sql.Connection.TRANSACTION_SERIALIZABLE),
+        TRANSACTION_NONE(java.sql.Connection.TRANSACTION_NONE);
+
+        private int connectionContant;
+
+        private TransactionIsolationLevel(int connectionConstant) {
+			this.connectionContant = connectionConstant;
+		}
+        
+        public int getConnectionConstant() {
+        	return connectionContant;
+        }
+	}
+	
+	protected ConnectorEnvironment environment;
+    private ConnectorLogger logger;
+    private ConnectorCapabilities capabilities;
+    private Translator sqlTranslator;
+    private DataSource ds;
+    private XADataSource xaDs;
+    private int transIsoLevel = NO_ISOLATION_LEVEL_SET;
+        
+    @Override
+    public void start(ConnectorEnvironment environment)
+    		throws ConnectorException {
+    	logger = environment.getLogger();
+        this.environment = environment;
+        
+        logger.logInfo(JDBCPlugin.Util.getString("JDBCConnector.JDBCConnector_initialized._1")); //$NON-NLS-1$
+        
+        capabilities = createCapabilities(environment, Thread.currentThread().getContextClassLoader());
+
+        Properties connectionProps = environment.getProperties();
+
+        // Get the JDBC properties ...
+        String dataSourceClassName = connectionProps.getProperty(JDBCPropertyNames.CONNECTION_SOURCE_CLASS);
+        
+        // Verify required items
+        if (dataSourceClassName == null || dataSourceClassName.trim().length() == 0) {
+            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Missing_JDBC_driver_class_name_1")); //$NON-NLS-1$
+        }
+        dataSourceClassName = dataSourceClassName.trim();
+
+        String levelStr = connectionProps.getProperty(JDBCPropertyNames.TRANSACTION_ISOLATION_LEVEL);
+        
+        if(levelStr != null && levelStr.trim().length() != 0){
+        	transIsoLevel = TransactionIsolationLevel.valueOf(levelStr.toUpperCase()).getConnectionConstant();
+        }
+        
+        try {
+            String className = environment.getProperties().getProperty(JDBCPropertyNames.EXT_TRANSLATOR_CLASS, Translator.class.getName());  
+            this.sqlTranslator = (Translator)ReflectionHelper.create(className, null, Thread.currentThread().getContextClassLoader());
+        } catch (MetaMatrixCoreException e) {
+            throw new ConnectorException(e);
+        }
+        sqlTranslator.initialize(environment);
+        
+        if (areAdminConnectionsAllowed()) {
+        	testConnection();
+        }
+
+        logger.logInfo(JDBCPlugin.Util.getString("JDBCConnector.JDBCConnector_started._4")); //$NON-NLS-1$
+    }
+    
+    private void testConnection() throws ConnectorException {
+    	Connection connection = null;
+        try {
+            connection = getConnection(null);
+        } catch (ConnectorException e) {
+            SQLException ex = (SQLException)e.getCause();
+            String sqlState = ex.getSQLState();
+            if (sqlState != null && INVALID_AUTHORIZATION_SPECIFICATION_NO_SUBCLASS.equals(sqlState)) {
+                throw e;
+            }
+            this.logger.logError(e.getMessage(), e);
+        } finally {
+        	if (connection != null) {
+        		connection.close();
+        	}
+        }
+    }
+    
+	@Override
+    public void stop() {     
+		/*
+		 * attempt to deregister drivers that may have been implicitly registered
+		 * with the driver manager
+		 */
+        Enumeration drivers = DriverManager.getDrivers();
+
+        String driverClassname = this.environment.getProperties().getProperty(JDBCPropertyNames.CONNECTION_SOURCE_CLASS);
+        boolean usingCustomClassLoader = PropertiesUtils.getBooleanProperty(this.environment.getProperties(), ConnectorPropertyNames.USING_CUSTOM_CLASSLOADER, false);
+
+        while(drivers.hasMoreElements()){
+        	Driver tempdriver = (Driver)drivers.nextElement();
+            if(tempdriver.getClass().getClassLoader() != this.getClass().getClassLoader()) {
+            	continue;
+            }
+            if(usingCustomClassLoader || tempdriver.getClass().getName().equals(driverClassname)) {
+                try {
+                    DriverManager.deregisterDriver(tempdriver);
+                } catch (Throwable e) {
+                    this.environment.getLogger().logError(e.getMessage());
+                }
+            }
+        }
+                
+        logger.logInfo(JDBCPlugin.Util.getString("JDBCConnector.JDBCConnector_stopped._3")); //$NON-NLS-1$
+    }
+    
+	@Override
+    public Connection getConnection(ExecutionContext context) throws ConnectorException {
+		DataSource dataSource = getDataSource();
+		if (dataSource == null) {
+			return getXAConnection(context, null);
+		}
+		java.sql.Connection conn = null;
+		try { 
+			if (context == null || context.getConnectorIdentity() instanceof SingleIdentity) {
+				conn = dataSource.getConnection();
+			} else if (context.getConnectorIdentity() instanceof MappedUserIdentity) {
+				MappedUserIdentity id = (MappedUserIdentity)context.getConnectorIdentity();
+				conn = dataSource.getConnection(id.getMappedUser(), id.getPassword());
+			}
+			setDefaultTransactionIsolationLevel(conn);
+		} catch (SQLException e) {
+			throw new ConnectorException(e);
+		}
+		return new JDBCSourceConnection(conn, this.environment, sqlTranslator);
+    }
+	
+	@Override
+	public XAConnection getXAConnection(
+			ExecutionContext context,
+			TransactionContext transactionContext) throws ConnectorException {
+		XADataSource xaDataSource = getXADataSource();
+		if (xaDataSource == null) {
+			throw new UnsupportedOperationException("Connector is not XA capable");
+		}
+		javax.sql.XAConnection conn = null;
+		try {
+			if (context == null || context.getConnectorIdentity() instanceof SingleIdentity) {
+				conn = xaDataSource.getXAConnection();
+			} else if (context.getConnectorIdentity() instanceof MappedUserIdentity) {
+				MappedUserIdentity id = (MappedUserIdentity)context.getConnectorIdentity();
+				conn = xaDataSource.getXAConnection(id.getMappedUser(), id.getPassword());
+			}
+			java.sql.Connection c = conn.getConnection();
+			setDefaultTransactionIsolationLevel(c);
+			return new JDBCSourceXAConnection(c, conn, this.environment, sqlTranslator);
+		} catch (SQLException e) {
+			throw new ConnectorException(e);
+		}
+	}
+
+    @Override
+	public ConnectorCapabilities getCapabilities() {
+		return capabilities;
+	}
+
+	static ConnectorCapabilities createCapabilities(ConnectorEnvironment environment, ClassLoader loader)
+		throws ConnectorException {
+		//create Capabilities
+		String className = environment.getProperties().getProperty(JDBCPropertyNames.EXT_CAPABILITY_CLASS, JDBCCapabilities.class.getName());  
+		try {
+		    ConnectorCapabilities result = (ConnectorCapabilities)ReflectionHelper.create(className, null, loader);
+		    if(result instanceof JDBCCapabilities) {
+		        String setCriteriaBatchSize = environment.getProperties().getProperty(JDBCPropertyNames.SET_CRITERIA_BATCH_SIZE);
+		        if(setCriteriaBatchSize != null) {
+		            int maxInCriteriaSize = Integer.parseInt(setCriteriaBatchSize);
+		            if(maxInCriteriaSize > 0) {
+		                ((JDBCCapabilities)result).setMaxInCriteriaSize(maxInCriteriaSize);
+		            }
+		        } 
+		    }
+		    return result;
+		} catch (Exception e) {
+			throw new ConnectorException(e);
+		}
+	}
+	
+    protected void createDataSources(String dataSourceClassName, final Properties connectionProps) throws ConnectorException {
+        // create data source
+        Object temp = null;
+        try {
+        	temp = ReflectionHelper.create(dataSourceClassName, null, Thread.currentThread().getContextClassLoader());
+        } catch (MetaMatrixCoreException e) {
+    		throw new ConnectorException(e,JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Unable_to_load_the_JDBC_driver_class_6", dataSourceClassName)); //$NON-NLS-1$
+    	}
+
+        final String url = connectionProps.getProperty(JDBCPropertyNames.URL);
+        if (url == null || url.trim().length() == 0) {
+            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Missing_JDBC_database_name_3")); //$NON-NLS-1$
+        }
+        
+    	if (temp instanceof Driver) {
+    		final Driver driver = (Driver)temp;
+    		// check URL if there is one
+            validateURL(driver, url);
+    		this.ds = (DataSource)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {DataSource.class}, new InvocationHandler() {
+    			@Override
+    			public Object invoke(Object proxy, Method method,
+    					Object[] args) throws Throwable {
+    				if (method.getName().equals("getConnection")) {
+    					Properties p = new Properties();
+    					if (args.length == 2) {
+    						p.put("user", args[0]);
+    						p.put("password", args[1]);
+    					} else {
+    						p.put("user", connectionProps.getProperty(JDBCPropertyNames.USERNAME));
+    						p.put("password", connectionProps.getProperty(JDBCPropertyNames.PASSWORD));
+    					}
+    					return driver.connect(url, p);
+    				} 
+    				throw new UnsupportedOperationException("Driver DataSource proxy only provides Connections");
+    			}
+    		});
+    	} else {
+    		parseURL(url, connectionProps);
+    		if (temp instanceof DataSource) {
+	    		this.ds = (DataSource)temp;
+	            PropertiesUtils.setBeanProperties(this.ds, connectionProps, null);
+    		} else if (temp instanceof XADataSource) {
+    			this.xaDs = (XADataSource)temp;
+    	        PropertiesUtils.setBeanProperties(this.xaDs, connectionProps, null);
+    		} else {
+    			throw new ConnectorException("Specified class is not a XADataSource, DataSource, or Driver " + dataSourceClassName);
+    		}
+    	} 
+    	if (this.ds instanceof XADataSource) {
+    		this.xaDs = (XADataSource)this.ds;
+    	}
+    }
+    
+    public DataSource getDataSource() {
+    	return ds;
+    }
+    
+    public XADataSource getXADataSource() {
+		return xaDs;
+	}
+        
+    private void validateURL(Driver driver, String url) throws ConnectorException {
+        boolean acceptsURL = false;
+        try {
+            acceptsURL = driver.acceptsURL(url);
+        } catch ( SQLException e ) {
+            throw new ConnectorException(e);
+        }
+        if(!acceptsURL ){
+            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Driver__7", driver.getClass().getName(), url)); //$NON-NLS-1$
+        }
+    }
+    
+    /**
+     * Parse URL for DataSource connection properties and add to connectionProps.
+     * @param url
+     * @param connectionProps
+     * @throws ConnectorException 
+     */
+    static void parseURL(final String url, final Properties connectionProps) throws ConnectorException {
+        // Will be: [jdbc:mmx:dbType://aHost:aPort], [DatabaseName=aDataBase], [CollectionID=aCollectionID], ...
+        final String[] urlParts = url.split(";"); //$NON-NLS-1$
+
+        // Will be: [jdbc:mmx:dbType:], [aHost:aPort]
+        final String[] protoHost = urlParts[0].split("//"); //$NON-NLS-1$
+
+        // Will be: [aHost], [aPort]
+        final String[] hostPort = protoHost[1].split(":"); //$NON-NLS-1$
+        connectionProps.setProperty(XAJDBCPropertyNames.SERVER_NAME, (String)hostPort[0]);
+        connectionProps.setProperty(XAJDBCPropertyNames.PORT_NUMBER, (String)hostPort[1]);
+
+        // For "databaseName", "SID", and all optional props
+        // (<propName1>=<propValue1>;<propName2>=<propValue2>;...)
+        for ( int i = 1; i < urlParts.length; i++ ) {
+            final String nameVal = (String) urlParts[i];
+            // Will be: [propName], [propVal]
+            final String[] aProp = nameVal.split("="); //$NON-NLS-1$
+            if ( aProp.length > 1) {
+                // Set optional prop names lower case so that we can find
+                // set method names for them when we introspect the DataSource
+                connectionProps.setProperty(aProp[0].toLowerCase(), aProp[1]);
+            }
+        }
+        
+        String serverName = connectionProps.getProperty(XAJDBCPropertyNames.SERVER_NAME);
+        String serverPort = connectionProps.getProperty(XAJDBCPropertyNames.PORT_NUMBER);
+    	if ( serverName == null || serverName.trim().length() == 0 ) {
+            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.MissingProp",  //$NON-NLS-1$
+                    XAJDBCPropertyNames.SERVER_NAME));
+        }
+        if ( serverPort == null || serverPort.trim().length() == 0 ) {
+            throw new ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.MissingProp",  //$NON-NLS-1$
+                    XAJDBCPropertyNames.PORT_NUMBER));
+        }
+        
+     // Unique resource name for this connector
+        final StringBuffer dataSourceResourceName = new StringBuffer(connectionProps.getProperty(XAJDBCPropertyNames.DATASOURCE_NAME, "XADS")); //$NON-NLS-1$
+        dataSourceResourceName.append('_'); 
+        dataSourceResourceName.append(serverName);
+        dataSourceResourceName.append('_'); 
+        dataSourceResourceName.append(connectionProps.getProperty(ConnectorPropertyNames.CONNECTOR_ID));
+        connectionProps.setProperty( XAJDBCPropertyNames.DATASOURCE_NAME, dataSourceResourceName.toString());
+    }
+    
+    public int getDefaultTransactionIsolationLevel() {
+        return this.transIsoLevel;
+    }
+    
+	protected void setDefaultTransactionIsolationLevel(java.sql.Connection sqlConn)
+			throws SQLException {
+		if(getDefaultTransactionIsolationLevel() != NO_ISOLATION_LEVEL_SET && getDefaultTransactionIsolationLevel() != java.sql.Connection.TRANSACTION_NONE){
+		    sqlConn.setTransactionIsolation(getDefaultTransactionIsolationLevel());
+		}
+	}
+        
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCExecutionHelper.java (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/util/JDBCExecutionHelper.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCExecutionHelper.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCExecutionHelper.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,99 @@
+/*
+ * 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 com.metamatrix.connector.api.ConnectorException;
+import com.metamatrix.connector.api.ExecutionContext;
+import com.metamatrix.connector.api.TypeFacility;
+import com.metamatrix.connector.api.ValueTranslator;
+import com.metamatrix.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$        
+    }
+        
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCExecutionHelper.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCPlugin.java (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCPlugin.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCPlugin.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCPlugin.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,41 @@
+/*
+ * 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.ResourceBundle;
+import com.metamatrix.core.BundleUtil;
+
+/**
+ * CommonPlugin
+ * <p>Used here in <code>data</code> to have access to the new
+ * logging framework for <code>LogManager</code>.</p>
+ */
+public class JDBCPlugin { // extends Plugin {
+
+    public static final String PLUGIN_ID = "org.teiid.connector.jdbc" ; //$NON-NLS-1$
+
+	public static final BundleUtil Util = new BundleUtil(PLUGIN_ID,
+	                                                     PLUGIN_ID + ".i18n", ResourceBundle.getBundle(PLUGIN_ID + ".i18n")); //$NON-NLS-1$ //$NON-NLS-2$
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCPlugin.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCProcedureExecution.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCProcedureExecution.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCProcedureExecution.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCProcedureExecution.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,197 @@
+/*
+ * 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.sql.CallableStatement;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.teiid.connector.jdbc.translator.TranslatedCommand;
+import org.teiid.connector.jdbc.translator.Translator;
+
+import com.metamatrix.connector.api.ConnectorEnvironment;
+import com.metamatrix.connector.api.ConnectorException;
+import com.metamatrix.connector.api.ConnectorLogger;
+import com.metamatrix.connector.api.DataNotAvailableException;
+import com.metamatrix.connector.api.ExecutionContext;
+import com.metamatrix.connector.api.ProcedureExecution;
+import com.metamatrix.connector.language.ICommand;
+import com.metamatrix.connector.language.IParameter;
+import com.metamatrix.connector.language.IProcedure;
+import com.metamatrix.connector.language.IParameter.Direction;
+import com.metamatrix.connector.metadata.runtime.Element;
+import com.metamatrix.connector.metadata.runtime.RuntimeMetadata;
+
+/**
+ */
+public class JDBCProcedureExecution extends JDBCQueryExecution implements ProcedureExecution {
+
+    private Map parameterIndexMap;
+    private RuntimeMetadata metadata;
+    
+    /**
+     * @param connection
+     * @param sqlTranslator
+     * @param logger
+     * @param props
+     * @param id
+     */
+    public JDBCProcedureExecution(ICommand command,
+        Connection connection,
+        Translator sqlTranslator,
+        ConnectorLogger logger,
+        Properties props,
+        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);
+
+        //translate command
+        TranslatedCommand translatedComm = translateCommand(procedure);
+        
+        //create statement or CallableStatement and execute
+        String sql = translatedComm.getSql();
+        try{
+            //create parameter index map
+            parameterIndexMap = createParameterIndexMap(procedure.getParameters(), sql);
+            CallableStatement cstmt = getCallableStatement(sql);
+            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));
+        }           
+        
+    }
+    
+    @Override
+    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$
+        }
+        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;
+        } catch (SQLException e) {
+            throw new ConnectorException(e);
+        }
+    }
+    
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCProcedureExecution.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCPropertyNames.java (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCPropertyNames.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCPropertyNames.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCPropertyNames.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,101 @@
+/*
+ * 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;
+
+public class JDBCPropertyNames {
+    public static final String CONNECTION_SOURCE_CLASS = "Driver"; //$NON-NLS-1$
+    public static final String URL = "URL"; //$NON-NLS-1$
+    public static final String USERNAME = "User"; //$NON-NLS-1$
+    public static final String PASSWORD = "Password"; //$NON-NLS-1$
+
+    /**
+    * This is the property name of the ConnectorService property that defines
+    * whether or not String type values in Criteria statements in SQL queries to
+    * the data source should have spaces trimmed from them.
+    */
+    public static final String TRIM_STRINGS = "TrimStrings"; //$NON-NLS-1$
+
+    /**
+    * This is the property name of the ConnectorService property that defines
+    * the size of a SetCriteria (IN criteria) before the criteria is broken into 
+    * multiple queries and the results are aggregated.  0 indicates that set 
+    * criteria should never be broken.  The default value should be 0.
+    */
+    public static final String SET_CRITERIA_BATCH_SIZE = "SetCriteriaBatchSize"; //$NON-NLS-1$
+
+    /**
+     * This is the property name used to set the transaction isolation level on
+     * a connector's data source.  The value string must be the the same as one of the
+     * names of the values of the transaction isolation levels defined in
+     * <code>java.sql.Connection</code>.
+     * @see java.sql.Connection#setTransactionIsolation(int)
+     */
+    public static final String TRANSACTION_ISOLATION_LEVEL = "TransactionIsolationLevel"; //$NON-NLS-1$
+
+    /**
+     * This is the property name of the ConnectorService property that defines
+     * the time zone of the source database.  This property should only be used in 
+     * cases where the source database is in a different time zone than the 
+     * ConnectorService VM and the database/driver is not already handling 
+     * time zones correctly.
+     */
+    public static final String DATABASE_TIME_ZONE = "DatabaseTimeZone"; //$NON-NLS-1$
+
+     //***** Extension properties *****//
+    /**
+     * This property is used to specify the implementation of
+     * com.metamatrix.data.ConnectorCapabilities. 
+     */
+    public static final String EXT_CAPABILITY_CLASS= "ExtensionCapabilityClass"; //$NON-NLS-1$
+
+    /**
+     * This property is used to specify the implementation of
+     * com.metamatrix.connector.jdbc.extension.Translator
+     */
+    public static final String EXT_TRANSLATOR_CLASS= "ExtensionTranslationClass"; //$NON-NLS-1$
+
+    /**
+     * This property can be used to specify the fetch size used from the connector to
+     * its underlying source.
+     */
+    public static final String FETCH_SIZE = "FetchSize"; //$NON-NLS-1$
+
+    /**
+     * This property can be used to indicate that prepared statements should be used.
+     * This means Literals will be substituted for
+     * bind variables.
+     * @since 5.0.1 
+     */
+    public static final String USE_BIND_VARIABLES = "UseBindVariables";    //$NON-NLS-1$
+    
+    /**
+     * This property is used to turn on/off the use of the default comments like
+     * connection id and requestid in the source SQL query.
+     */
+    public static final String USE_COMMENTS_SOURCE_QUERY= "UseCommentsInSourceQuery";    //$NON-NLS-1$    
+    
+    public static final String CONNECTION_TEST_QUERY = "ConnectionTestQuery"; //$NON-NLS-1$
+    
+    public static final String IS_VALID_TIMEOUT = "IsValidTimeout"; //$NON-NLS-1$
+
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCPropertyNames.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCQueryExecution.java (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCQueryExecution.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCQueryExecution.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCQueryExecution.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,195 @@
+/*
+ * 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.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.teiid.connector.jdbc.translator.TranslatedCommand;
+import org.teiid.connector.jdbc.translator.Translator;
+
+import com.metamatrix.connector.api.ConnectorEnvironment;
+import com.metamatrix.connector.api.ConnectorException;
+import com.metamatrix.connector.api.ConnectorLogger;
+import com.metamatrix.connector.api.DataNotAvailableException;
+import com.metamatrix.connector.api.ExecutionContext;
+import com.metamatrix.connector.api.ResultSetExecution;
+import com.metamatrix.connector.api.TypeFacility;
+import com.metamatrix.connector.api.ValueTranslator;
+import com.metamatrix.connector.language.ICommand;
+import com.metamatrix.connector.language.IQueryCommand;
+
+/**
+ * 
+ */
+public class JDBCQueryExecution extends JDBCBaseExecution implements ResultSetExecution {
+
+    // ===========================================================================================================================
+    // Fields
+    // ===========================================================================================================================
+
+    protected ResultSet results;
+    protected Class[] columnDataTypes;
+    protected ConnectorEnvironment env;
+    protected ICommand command;
+	private boolean[] transformKnown;
+	private ValueTranslator[] transforms;
+	private boolean[] trimColumn;
+	private int[] nativeTypes;
+
+    // ===========================================================================================================================
+    // Constructors
+    // ===========================================================================================================================
+
+    public JDBCQueryExecution(ICommand command, Connection connection,
+                              Translator sqlTranslator,
+                              ConnectorLogger logger,
+                              Properties props,
+                              ExecutionContext context,
+                              ConnectorEnvironment env) {
+        super(connection, sqlTranslator, logger, props, context);
+        this.command = command;
+        this.env = env;
+    }
+    
+    @Override
+    public void execute() throws ConnectorException {
+        // get column types
+        columnDataTypes = ((IQueryCommand)command).getColumnTypes();
+
+        // translate command
+        TranslatedCommand translatedComm = translateCommand(command);
+
+        String sql = translatedComm.getSql();
+
+        try {
+
+            if (!translatedComm.isPrepared()) {
+                results = getStatement().executeQuery(sql);
+            } else {
+            	PreparedStatement pstatement = getPreparedStatement(sql);
+                sqlTranslator.bindPreparedStatementValues(this.connection, pstatement, translatedComm);
+                results = pstatement.executeQuery();
+            } 
+            addStatementWarnings();
+            initResultSetInfo();
+
+        } catch (SQLException e) {
+            throw createAndLogError(e, translatedComm);
+        }
+    }
+
+	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;
+		        } 
+		    }
+		}
+
+		transformKnown = new boolean[columnDataTypes.length];
+		transforms = new ValueTranslator[columnDataTypes.length];
+	}
+    
+    @Override
+    public List next() throws ConnectorException, DataNotAvailableException {
+        try {
+            if (results.next()) {
+                // New row for result set
+                List vals = new ArrayList(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);
+                        }
+                    }
+                    vals.add(value); 
+                }
+
+                return vals;
+            } 
+        } catch (SQLException e) {
+            throw new ConnectorException(e,
+                    JDBCPlugin.Util.getString("JDBCTranslator.Unexpected_exception_translating_results___8", e.getMessage())); //$NON-NLS-1$
+        }
+        
+        return null;
+    }
+    
+    /**
+     * @see org.teiid.connector.jdbc.JDBCBaseExecution#close()
+     */
+    public void close() throws ConnectorException {
+        // first we would need to close the result set here then we can close
+        // the statement, using the base class.
+        if (results != null) {
+            try {
+                results.close();
+                results = null;
+            } catch (SQLException e) {
+                throw new ConnectorException(e);
+            }
+        }
+        super.close();
+    }
+
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCQueryExecution.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceConnection.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCSourceConnection.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceConnection.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceConnection.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,131 @@
+/*
+ * 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.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import org.teiid.connector.jdbc.translator.Translator;
+
+import com.metamatrix.connector.api.ConnectorEnvironment;
+import com.metamatrix.connector.api.ConnectorException;
+import com.metamatrix.connector.api.ConnectorLogger;
+import com.metamatrix.connector.api.ExecutionContext;
+import com.metamatrix.connector.api.ProcedureExecution;
+import com.metamatrix.connector.api.ResultSetExecution;
+import com.metamatrix.connector.api.UpdateExecution;
+import com.metamatrix.connector.language.ICommand;
+import com.metamatrix.connector.language.IProcedure;
+import com.metamatrix.connector.language.IQueryCommand;
+import com.metamatrix.connector.metadata.runtime.RuntimeMetadata;
+
+/**
+ * 
+ */
+public class JDBCSourceConnection extends com.metamatrix.connector.basic.BasicConnection {
+    protected java.sql.Connection physicalConnection;
+    protected ConnectorEnvironment environment;
+    private ConnectorLogger logger;
+    private Translator sqlTranslator;
+
+    public JDBCSourceConnection(java.sql.Connection connection, ConnectorEnvironment environment, Translator sqlTranslator) throws ConnectorException {
+        this.physicalConnection = connection;
+        this.environment = environment;
+        this.logger = environment.getLogger();
+        this.sqlTranslator = sqlTranslator;
+        this.sqlTranslator.afterConnectionCreation(connection);
+    }
+    
+    @Override
+    public ResultSetExecution createResultSetExecution(IQueryCommand command,
+    		ExecutionContext executionContext, RuntimeMetadata metadata)
+    		throws ConnectorException {
+    	return new JDBCQueryExecution(command, this.physicalConnection, sqlTranslator, logger, this.environment.getProperties(), executionContext, this.environment);
+    }
+    
+    @Override
+    public ProcedureExecution createProcedureExecution(IProcedure command,
+    		ExecutionContext executionContext, RuntimeMetadata metadata)
+    		throws ConnectorException {
+    	return new JDBCProcedureExecution(command, this.physicalConnection, sqlTranslator, logger, this.environment.getProperties(), metadata, executionContext, this.environment);
+    }
+
+    @Override
+    public UpdateExecution createUpdateExecution(ICommand command,
+    		ExecutionContext executionContext, RuntimeMetadata metadata)
+    		throws ConnectorException {
+    	return new JDBCUpdateExecution(command, this.physicalConnection, sqlTranslator, logger, this.environment.getProperties(), executionContext);    
+    }
+    
+    @Override
+    public void close() {
+		closeSourceConnection();
+	}
+
+	protected void closeSourceConnection() {
+		try {
+            this.physicalConnection.close();
+        } catch(SQLException e) {
+        	logger.logDetail("Exception during close: " + e.getMessage());
+        }
+	}
+
+    @Override
+    public boolean isAlive() {
+    	Connection connection = this.physicalConnection;
+        Statement statement = null;
+    	try {
+    		int timeout = this.sqlTranslator.getIsValidTimeout();
+    		if (timeout >= 0) {
+    			return connection.isValid(timeout);
+    		}
+            if(connection.isClosed()){
+                return false;
+            } 
+            String connectionTestQuery = sqlTranslator.getConnectionTestQuery();
+            if (connectionTestQuery != null) {
+		        statement = connection.createStatement();
+		        statement.executeQuery(connectionTestQuery);
+            }
+        } catch(SQLException e) {
+        	return false;
+        } finally {
+            if ( statement != null ) {
+                try {
+                    statement.close();
+                } catch ( SQLException e ) {
+                }
+            }
+        }
+        return true;
+    }
+    
+    @Override
+    public void closeCalled() {
+    	
+    }
+    
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceConnection.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCUpdateExecution.java (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/JDBCUpdateExecution.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCUpdateExecution.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCUpdateExecution.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,265 @@
+/*
+ * 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.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.teiid.connector.jdbc.translator.TranslatedCommand;
+import org.teiid.connector.jdbc.translator.Translator;
+
+import com.metamatrix.connector.api.ConnectorException;
+import com.metamatrix.connector.api.ConnectorLogger;
+import com.metamatrix.connector.api.DataNotAvailableException;
+import com.metamatrix.connector.api.ExecutionContext;
+import com.metamatrix.connector.api.UpdateExecution;
+import com.metamatrix.connector.language.IBatchedUpdates;
+import com.metamatrix.connector.language.IBulkInsert;
+import com.metamatrix.connector.language.ICommand;
+
+/**
+ */
+public class JDBCUpdateExecution extends JDBCBaseExecution implements
+                                                          UpdateExecution {
+
+	private ICommand command;
+	private int[] result;
+	
+    /**
+     * @param connection
+     * @param sqlTranslator
+     * @param logger
+     * @param props
+     * @param id
+     */
+    public JDBCUpdateExecution(ICommand command, Connection connection,
+                               Translator sqlTranslator,
+                               ConnectorLogger logger,
+                               Properties props,
+                               ExecutionContext context) {
+        super(connection, sqlTranslator, logger, props, context);
+        this.command = command;
+    }
+
+    // ===========================================================================================================================
+    // Methods
+    // ===========================================================================================================================
+
+    @Override
+    public void execute() throws ConnectorException {
+        if (command instanceof IBulkInsert) {
+            result = new int [] {execute((IBulkInsert)command)};
+        } else if (command instanceof IBatchedUpdates) {
+        	result = execute(((IBatchedUpdates)command));
+        } else {
+            // translate command
+            TranslatedCommand translatedComm = translateCommand(command);
+
+            result = new int [] {executeTranslatedCommand(translatedComm)};
+        }
+    }
+
+    /**
+     * @see com.metamatrix.data.api.BatchedUpdatesExecution#execute(com.metamatrix.connector.language.ICommand[])
+     * @since 4.2
+     */
+    public int[] execute(IBatchedUpdates batchedCommand) throws ConnectorException {
+        boolean succeeded = false;
+
+        boolean commitType = getAutoCommit(null);
+        ICommand[] commands = (ICommand[])batchedCommand.getUpdateCommands().toArray(new ICommand[batchedCommand.getUpdateCommands().size()]);
+        int[] results = new int[commands.length];
+
+        try {
+            // temporarily turn the auto commit off, and set it back to what it was
+            // before at the end of the command execution.
+            if (commitType) {
+                connection.setAutoCommit(false);
+            }
+
+            List executedCmds = new ArrayList();
+            
+            TranslatedCommand previousCommand = null;
+            
+            for (int i = 0; i < commands.length; i++) {
+                TranslatedCommand command = translateCommand(commands[i]);
+                if (command.isPrepared()) {
+                    PreparedStatement pstmt = null;
+                    if (previousCommand != null && previousCommand.isPrepared() && previousCommand.getSql().equals(command.getSql())) {
+                        pstmt = (PreparedStatement)statement;
+                    } else {
+                        if (!executedCmds.isEmpty()) {
+                            executeBatch(i, results, executedCmds);
+                        }
+                        pstmt = getPreparedStatement(command.getSql());
+                    }
+                    sqlTranslator.bindPreparedStatementValues(this.connection, pstmt, command);
+                    pstmt.addBatch();
+                } else {
+                    if (previousCommand != null && previousCommand.isPrepared()) {
+                        executeBatch(i, results, executedCmds);
+                        getStatement();
+                    }
+                    if (statement == null) {
+                        getStatement();
+                    }
+                    statement.addBatch(command.getSql());
+                }
+                executedCmds.add(command);
+                previousCommand = command;
+            }
+            if (!executedCmds.isEmpty()) {
+                executeBatch(commands.length, results, executedCmds);
+            }
+            succeeded = true;
+        } catch (SQLException e) {
+            throw createAndLogError(e, null);
+        } finally {
+            if (commitType) {
+                restoreAutoCommit(!succeeded, null);
+            }
+        }
+
+        return results;
+    }
+
+    /**
+     * An implementation to bulk insert rows into single table.
+     * 
+     * @param command
+     * @return
+     * @throws ConnectorException
+     */
+    public int execute(IBulkInsert command) throws ConnectorException {
+        boolean succeeded = false;
+
+        // translate command
+        TranslatedCommand translatedComm = translateCommand(command);
+
+        // create statement or PreparedStatement and execute
+        String sql = translatedComm.getSql();
+
+        boolean commitType = getAutoCommit(translatedComm);
+        int updateCount = -1;
+        try {
+            // temporarily turn the auto commit off, and set it back to what it was
+            // before at the end of the command execution.
+            if (commitType) {
+                connection.setAutoCommit(false);
+            }
+            PreparedStatement stmt = getPreparedStatement(sql);
+            updateCount = sqlTranslator.executeStatementForBulkInsert(this.connection, stmt, translatedComm);
+            addStatementWarnings();
+            succeeded = true;
+        } catch (SQLException e) {
+            throw createAndLogError(e, translatedComm);
+        } finally {
+            if (commitType) {
+                restoreAutoCommit(!succeeded, translatedComm);
+            }
+        }
+        return updateCount;
+    }
+
+    private void executeBatch(int commandCount,
+                              int[] results,
+                              List commands) throws ConnectorException {
+        try {
+            int[] batchResults = statement.executeBatch();
+            addStatementWarnings();
+            for (int j = 0; j < batchResults.length; j++) {
+                results[commandCount - 1 - j] = batchResults[batchResults.length - 1 - j];
+            }
+            commands.clear();
+        } catch (SQLException err) {
+            throw createAndLogError(err, "JDBCQueryExecution.Error_executing_query__3", commands); //$NON-NLS-1$
+        }
+    }
+
+    /**
+     * @param translatedComm
+     * @throws ConnectorException
+     * @since 4.3
+     */
+    private int executeTranslatedCommand(TranslatedCommand translatedComm) throws ConnectorException {
+        // create statement or PreparedStatement and execute
+        String sql = translatedComm.getSql();
+
+        try {
+        	int updateCount;
+            if (!translatedComm.isPrepared()) {
+                updateCount = getStatement().executeUpdate(sql);
+            } else {
+            	PreparedStatement pstatement = getPreparedStatement(sql);
+                sqlTranslator.bindPreparedStatementValues(this.connection, pstatement, translatedComm);
+                updateCount = pstatement.executeUpdate();
+            } 
+            addStatementWarnings();
+            return updateCount;
+        } catch (SQLException err) {
+            throw createError(err, translatedComm);
+        }
+    }
+
+    /**
+     * @param command
+     * @return
+     * @throws ConnectorException
+     */
+    private boolean getAutoCommit(TranslatedCommand command) throws ConnectorException {
+        try {
+            return connection.getAutoCommit();
+        } catch (SQLException err) {
+            throw createAndLogError(err, command);
+        }
+    }
+
+    /**
+     * If the auto comm
+     * 
+     * @param exceptionOccurred
+     * @param command
+     * @throws ConnectorException
+     */
+    private void restoreAutoCommit(boolean exceptionOccurred,
+                                   TranslatedCommand command) throws ConnectorException {
+        try {
+            if (exceptionOccurred) {
+                connection.rollback();
+            }
+            connection.setAutoCommit(true);
+        } catch (SQLException err) {
+            throw createAndLogError(err, command);
+        }
+    }
+    
+    @Override
+    public int[] getUpdateCounts() throws DataNotAvailableException,
+    		ConnectorException {
+    	return result;
+    }
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCUpdateExecution.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/SimpleCapabilities.java (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/SimpleCapabilities.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/SimpleCapabilities.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/SimpleCapabilities.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,371 @@
+/*
+ * 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.List;
+
+import com.metamatrix.connector.api.ConnectorCapabilities;
+
+/**
+ * This is a "simple" capabilities class that allows criteria but no 
+ * complicated joins, subqueries, etc to be passed to the connector.
+ * This capabilities class may come in handy for testing and for 
+ * sources that support JDBC but don't support extended JDBC capabilities.  
+ */
+public class SimpleCapabilities extends JDBCCapabilities implements ConnectorCapabilities {
+
+    public SimpleCapabilities() {
+        // Max acceptable by all BQT dbs (Sybase=250, Oracle=1000)
+        setMaxInCriteriaSize(250);
+    }
+    
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsAndCriteria()
+     */
+    public boolean supportsAndCriteria() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsCompareCriteria()
+     */
+    public boolean supportsCompareCriteria() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsCompareCriteriaEquals()
+     */
+    public boolean supportsCompareCriteriaEquals() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsCompareCriteriaGreaterThan()
+     */
+    public boolean supportsCompareCriteriaGreaterThan() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsCompareCriteriaGreaterThanOrEqual()
+     */
+    public boolean supportsCompareCriteriaGreaterThanOrEqual() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsCompareCriteriaLessThan()
+     */
+    public boolean supportsCompareCriteriaLessThan() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsCompareCriteriaLessThanOrEqual()
+     */
+    public boolean supportsCompareCriteriaLessThanOrEqual() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsCompareCriteriaNotEquals()
+     */
+    public boolean supportsCompareCriteriaNotEquals() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsCriteria()
+     */
+    public boolean supportsCriteria() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsInCriteria()
+     */
+    public boolean supportsInCriteria() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsIsNullCriteria()
+     */
+    public boolean supportsIsNullCriteria() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsJoins()
+     */
+    public boolean supportsJoins() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsLikeCriteria()
+     */
+    public boolean supportsLikeCriteria() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsNotCriteria()
+     */
+    public boolean supportsNotCriteria() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsOrCriteria()
+     */
+    public boolean supportsOrCriteria() {
+        return true;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsSelectDistinct()
+     */
+    public boolean supportsSelectDistinct() {
+        return true;
+    }
+
+    /** 
+     * @see com.metamatrix.connector.api.ConnectorCapabilities#supportsSelectLiterals()
+     * @since 4.2
+     */
+    public boolean supportsSelectLiterals() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsAliasedGroup()
+     */
+    public boolean supportsAliasedGroup() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsSelfJoins()
+     */
+    public boolean supportsSelfJoins() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsOuterJoins()
+     */
+    public boolean supportsOuterJoins() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsFullOuterJoins()
+     */
+    public boolean supportsFullOuterJoins() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsBetweenCriteria()
+     */
+    public boolean supportsBetweenCriteria() {
+        return false;
+    }
+
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsLikeCriteriaEscapeCharacter()
+     */
+    public boolean supportsLikeCriteriaEscapeCharacter() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsInCriteriaSubquery()
+     */
+    public boolean supportsInCriteriaSubquery() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsExistsCriteria()
+     */
+    public boolean supportsExistsCriteria() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsQuantifiedCompareCriteria()
+     */
+    public boolean supportsQuantifiedCompareCriteria() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsQuantifiedCompareCriteriaSome()
+     */
+    public boolean supportsQuantifiedCompareCriteriaSome() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsQuantifiedCompareCriteriaAll()
+     */
+    public boolean supportsQuantifiedCompareCriteriaAll() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsOrderBy()
+     */
+    public boolean supportsOrderBy() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsAggregates()
+     */
+    public boolean supportsAggregates() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsAggregatesSum()
+     */
+    public boolean supportsAggregatesSum() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsAggregatesAvg()
+     */
+    public boolean supportsAggregatesAvg() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsAggregatesMin()
+     */
+    public boolean supportsAggregatesMin() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsAggregatesMax()
+     */
+    public boolean supportsAggregatesMax() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsAggregatesCount()
+     */
+    public boolean supportsAggregatesCount() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsAggregatesCountStar()
+     */
+    public boolean supportsAggregatesCountStar() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsAggregatesDistinct()
+     */
+    public boolean supportsAggregatesDistinct() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsScalarSubqueries()
+     */
+    public boolean supportsScalarSubqueries() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsCorrelatedSubqueries()
+     */
+    public boolean supportsCorrelatedSubqueries() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsCaseExpressions()
+     */
+    public boolean supportsCaseExpressions() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsSearchedCaseExpressions()
+     */
+    public boolean supportsSearchedCaseExpressions() {
+        return false;
+    }
+
+    /* 
+     * @see com.metamatrix.data.api.ConnectorCapabilities#supportsScalarFunctions()
+     */
+    public boolean supportsScalarFunctions() {
+        return false;
+    }
+
+    /**
+     * Return null to indicate no functions are supported.
+     * @return null 
+     * @see com.metamatrix.connector.api.ConnectorCapabilities#getSupportedFunctions()
+     */
+    public List getSupportedFunctions() {
+        return null;
+    }
+
+    public boolean supportsInlineViews() {
+        return false;
+    }       
+
+    public boolean supportsOrderByInInlineViews() {
+        return false;
+    }
+
+    /** 
+     * @see com.metamatrix.connector.api.ConnectorCapabilities#supportsUnionOrderBy()
+     * @since 4.2
+     */
+    public boolean supportsUnionOrderBy() {
+        return false;
+    }
+    
+    /** 
+     * @see com.metamatrix.connector.api.ConnectorCapabilities#supportsUnions()
+     * @since 4.2
+     */
+    public boolean supportsUnions() {
+        return false;
+    }
+
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/SimpleCapabilities.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/access (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/access)


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/access
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/access/AccessCapabilities.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/access/AccessCapabilities.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/access/AccessCapabilities.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -22,9 +22,9 @@
 
 /*
  */
-package com.metamatrix.connector.jdbc.access;
+package org.teiid.connector.jdbc.access;
 
-import com.metamatrix.connector.jdbc.JDBCCapabilities;
+import org.teiid.connector.jdbc.JDBCCapabilities;
 
 public class AccessCapabilities extends JDBCCapabilities{
     /* 

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/access/AccessSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/access/AccessSQLTranslator.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/access/AccessSQLTranslator.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -22,9 +22,10 @@
 
 /*
  */
-package com.metamatrix.connector.jdbc.access;
+package org.teiid.connector.jdbc.access;
 
-import com.metamatrix.connector.jdbc.translator.Translator;
+import org.teiid.connector.jdbc.translator.Translator;
+
 import com.metamatrix.connector.language.ILimit;
 
 public class AccessSQLTranslator extends Translator {

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2 (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/db2)


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2Capabilities.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/db2/DB2Capabilities.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2Capabilities.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -22,12 +22,13 @@
 
 /*
  */
-package com.metamatrix.connector.jdbc.db2;
+package org.teiid.connector.jdbc.db2;
 
 import java.util.ArrayList;
 import java.util.List;
+
+import org.teiid.connector.jdbc.JDBCCapabilities;
 
-import com.metamatrix.connector.jdbc.JDBCCapabilities;
 
 /**
  */

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2ConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/db2/DB2ConvertModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2ConvertModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,332 +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.jdbc.db2;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
-import com.metamatrix.connector.jdbc.translator.DropFunctionModifier;
-import com.metamatrix.connector.jdbc.translator.FunctionModifier;
-import com.metamatrix.connector.language.*;
-import com.metamatrix.connector.language.ICompareCriteria.Operator;
-
-/**
- */
-public class DB2ConvertModifier extends BasicFunctionModifier implements FunctionModifier {
-
-    private static DropFunctionModifier DROP_MODIFIER = new DropFunctionModifier();
-
-    private ILanguageFactory langFactory;
-    
-    public DB2ConvertModifier(ILanguageFactory langFactory) {
-        this.langFactory = langFactory;
-    }
-
-    public IExpression modify(IFunction function) {
-        IExpression[] args = function.getParameters();
-        Class sourceType = args[0].getType();
-        String targetTypeString = getTargetType(args[1]);
-        Class targetType = TypeFacility.getDataTypeClass(targetTypeString);
-        IExpression returnExpr = null;
-        
-        if(targetType != null) {
-        
-            // targetType is always lower-case due to getTargetType implementation
-            if(targetType.equals(TypeFacility.RUNTIME_TYPES.STRING)) { 
-                returnExpr = convertToString(args[0], sourceType);
-                
-            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.TIMESTAMP)) { 
-                returnExpr = convertToTimestamp(args[0], sourceType);
-                
-            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.DATE)) { 
-                returnExpr = convertToDate(args[0], sourceType);
-                
-            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.TIME)) { 
-                returnExpr = convertToTime(args[0], sourceType);
-                
-            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN) || 
-                            targetType.equals(TypeFacility.RUNTIME_TYPES.BYTE) || 
-                            targetType.equals(TypeFacility.RUNTIME_TYPES.SHORT)) {  
-                returnExpr = convertToSmallInt(args[0], sourceType, targetType);
-                
-            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.INTEGER)) {  
-                returnExpr = convertToInteger(args[0], sourceType);
-                
-            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.LONG) || 
-                            targetType.equals(TypeFacility.RUNTIME_TYPES.BIG_INTEGER)) {  
-                returnExpr = convertToBigInt(args[0], sourceType);
-                
-            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.FLOAT)) {  
-                returnExpr = convertToReal(args[0], sourceType);
-
-            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.DOUBLE)) {  
-                returnExpr = convertToDouble(args[0], sourceType);
-
-            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.BIG_DECIMAL)) {  
-                returnExpr = convertToBigDecimal(args[0], sourceType);
-
-            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.CHAR)) { 
-                returnExpr = convertToChar(args[0], sourceType);
-            } 
-            
-            if(returnExpr != null) {
-                return returnExpr;
-            }
-        }
-        
-        // Last resort - just drop the convert and let the db figure it out
-        return DROP_MODIFIER.modify(function);  
-    }
-
-    /** 
-     * @param expression
-     * @return
-     * @since 4.2
-     */
-    private String getTargetType(IExpression expression) {
-        if(expression != null && expression instanceof ILiteral) {
-            String target = (String) ((ILiteral)expression).getValue();
-            return target.toLowerCase();
-        } 
-        
-        return null;            
-    }
-    
-
-    /** 
-     * @param expression
-     * @param sourceType
-     * @return
-     * @since 4.2
-     */
-    private IExpression convertToString(IExpression expression,
-                                        Class sourceType) {
-        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN)) {
-            // BEFORE: convert(booleanExpression, string)
-            // AFTER:  CASE WHEN booleanExpression = 0 THEN 'false' ELSE 'true' END
-
-            ILiteral literalZero = this.langFactory.createLiteral(new Integer(0), TypeFacility.RUNTIME_TYPES.INTEGER);
-            ICompareCriteria when = this.langFactory.createCompareCriteria(Operator.EQ, expression, literalZero);
-            List whens = new ArrayList(1);
-            whens.add(when);
-            
-            ILiteral literalFalse = this.langFactory.createLiteral("false", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$
-            List thens = new ArrayList(1);
-            thens.add(literalFalse);
-            
-            ILiteral literalTrue = this.langFactory.createLiteral("true", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$
-                        
-            return this.langFactory.createSearchedCaseExpression(whens, thens, literalTrue, TypeFacility.RUNTIME_TYPES.STRING);
-            
-        } else if(sourceType.equals(TypeFacility.RUNTIME_TYPES.CHAR)) {
-            // Drop convert entirely for char
-            return null;
-            
-        } else {
-            // BEFORE: convert(EXPR, string) 
-            // AFTER:  char(EXPR) 
-            return wrapNewFunction(expression, "char", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$            
-        }
-    }
-    
-    private IExpression convertToChar(IExpression expression,
-                                        Class sourceType) {
-        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING)) {
-            ILiteral literalOne = this.langFactory.createLiteral(new Integer(1), TypeFacility.RUNTIME_TYPES.INTEGER);
-            return this.langFactory.createFunction("char", new IExpression[] { expression, literalOne }, TypeFacility.RUNTIME_TYPES.CHAR); //$NON-NLS-1$
-        } 
-        
-        return null;
-    }
-
-    private IExpression convertToSmallInt(IExpression expression,
-                                        Class sourceType, Class targetType) {
-        
-        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING) && targetType.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN)) { 
-            // BEFORE: convert(stringExpression, boolean)
-            // AFTER:  CASE WHEN stringExpression = 'true' THEN 1 ELSE 0 END
-            ILiteral literalTrue = this.langFactory.createLiteral("true", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$
-            ICompareCriteria when = this.langFactory.createCompareCriteria(Operator.EQ, expression, literalTrue);
-            List whens = new ArrayList(1);
-            whens.add(when);
-            
-            ILiteral literalOne = this.langFactory.createLiteral(new Integer(1), TypeFacility.RUNTIME_TYPES.INTEGER);
-            List thens = new ArrayList(1);
-            thens.add(literalOne);
-            
-            ILiteral literalZero = this.langFactory.createLiteral(new Integer(0), TypeFacility.RUNTIME_TYPES.INTEGER);
-                                    
-            return this.langFactory.createSearchedCaseExpression(whens, thens, literalZero, TypeFacility.RUNTIME_TYPES.STRING);
-            
-        } else if(sourceType.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN) || 
-                        sourceType.equals(TypeFacility.RUNTIME_TYPES.BYTE) || 
-                        sourceType.equals(TypeFacility.RUNTIME_TYPES.SHORT)){
-            
-            // Just drop these
-            return null;
-        }
-
-        // BEFORE: convert(expression, [boolean,byte,short])
-        // AFTER:  smallint(expression)
-        return wrapNewFunction(expression, "smallint", targetType); //$NON-NLS-1$
-    }
-
-    private IExpression convertToInteger(IExpression expression, Class sourceType) {
-          
-          if(sourceType.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN) || 
-                          sourceType.equals(TypeFacility.RUNTIME_TYPES.BYTE) || 
-                          sourceType.equals(TypeFacility.RUNTIME_TYPES.SHORT)){
-              
-              // Just drop these
-              return null;
-          } 
-
-          // BEFORE: convert(expression, integer)
-          // AFTER:  integer(expression)
-          return wrapNewFunction(expression, "integer", TypeFacility.RUNTIME_TYPES.INTEGER); //$NON-NLS-1$
-      }
-
-    private IExpression convertToBigInt(IExpression expression, Class sourceType) {
-        
-        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING) ||
-                        sourceType.equals(TypeFacility.RUNTIME_TYPES.FLOAT) || 
-                        sourceType.equals(TypeFacility.RUNTIME_TYPES.DOUBLE) || 
-                        sourceType.equals(TypeFacility.RUNTIME_TYPES.BIG_DECIMAL)){
-
-            // BEFORE: convert(expression, [long, biginteger])
-            // AFTER:  bigint(expression)
-            return wrapNewFunction(expression, "bigint", TypeFacility.RUNTIME_TYPES.LONG); //$NON-NLS-1$
-
-        } 
-
-        // Just drop anything else
-        return null;
-    }
-
-    private IExpression convertToReal(IExpression expression, Class sourceType) {
-        
-        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING) ||
-                        sourceType.equals(TypeFacility.RUNTIME_TYPES.DOUBLE) || 
-                        sourceType.equals(TypeFacility.RUNTIME_TYPES.BIG_DECIMAL)){
-
-            // BEFORE: convert(expression, [double, bigdecimal])
-            // AFTER:  real(expression)
-            return wrapNewFunction(expression, "real", TypeFacility.RUNTIME_TYPES.FLOAT); //$NON-NLS-1$
-
-        } 
-
-        // Just drop anything else
-        return null;
-    }
-
-    private IExpression convertToDouble(IExpression expression, Class sourceType) {
-        
-        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING)){
-
-            // BEFORE: convert(expression, double)
-            // AFTER:  double(expression)
-            return wrapNewFunction(expression, "double", TypeFacility.RUNTIME_TYPES.DOUBLE); //$NON-NLS-1$
-
-        } 
-
-        // Just drop anything else
-        return null;
-    }
-
-    private IExpression convertToBigDecimal(IExpression expression, Class sourceType) {
-        
-        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING)){
-
-            // BEFORE: convert(expression, bigdecimal)
-            // AFTER:  decimal(expression)
-            return wrapNewFunction(expression, "decimal", TypeFacility.RUNTIME_TYPES.BIG_DECIMAL); //$NON-NLS-1$
-
-        } 
-
-        // Just drop anything else
-        return null;
-    }
-
-    /** 
-     * @param expression
-     * @param sourceType
-     * @return
-     * @since 4.2
-     */
-    private IExpression convertToDate(IExpression expression,
-                                      Class sourceType) {
-                                
-        // BEFORE: convert(EXPR, date) 
-        // AFTER:  date(EXPR) 
-        return wrapNewFunction(expression, "date", TypeFacility.RUNTIME_TYPES.DATE); //$NON-NLS-1$
-    }
-
-    private IExpression convertToTime(IExpression expression, Class sourceType) {
-                                
-        // BEFORE: convert(EXPR, time) 
-        // AFTER:  time(EXPR) 
-        return wrapNewFunction(expression, "time", TypeFacility.RUNTIME_TYPES.DATE); //$NON-NLS-1$
-    }
-
-    private IExpression convertToTimestamp(IExpression expression,
-                                            Class sourceType) {
-        
-        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING)) {
-            // BEFORE: convert(EXPR, timestamp)
-            // AFTER:  timestamp(expr)
-            return wrapNewFunction(expression, "timestamp", TypeFacility.RUNTIME_TYPES.TIMESTAMP); //$NON-NLS-1$
-            
-        } else if(sourceType.equals(TypeFacility.RUNTIME_TYPES.DATE)) {
-            // BEFORE: convert(EXPR, timestamp)
-            // AFTER:  timestamp(EXPR, '00:00:00')
-            ILiteral timeString = this.langFactory.createLiteral("00:00:00", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$
-            return this.langFactory.createFunction("timestamp", new IExpression[] {expression, timeString}, TypeFacility.RUNTIME_TYPES.TIMESTAMP);             //$NON-NLS-1$
-            
-        } else if(sourceType.equals(TypeFacility.RUNTIME_TYPES.TIME)) {
-            // BEFORE: convert(EXPR, timestamp)
-            // AFTER:  timestamp('1970-01-01', EXPR)
-            ILiteral dateString = this.langFactory.createLiteral("1970-01-01", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$
-            return this.langFactory.createFunction("timestamp", new IExpression[] {dateString, expression}, TypeFacility.RUNTIME_TYPES.TIMESTAMP);             //$NON-NLS-1$
-        }
-        
-        return null;
-    }
-    
-    /** 
-     * @param expression
-     * @param functionName
-     * @param outputType
-     * @return
-     * @since 4.2
-     */
-    private IFunction wrapNewFunction(IExpression expression,
-                                      String functionName,
-                                      Class outputType) {
-        return langFactory.createFunction(functionName, 
-            new IExpression[] { expression },
-            outputType);
-    }
-
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2ConvertModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/db2/DB2ConvertModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2ConvertModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2ConvertModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,334 @@
+/*
+ * 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.db2;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.connector.jdbc.translator.BasicFunctionModifier;
+import org.teiid.connector.jdbc.translator.DropFunctionModifier;
+import org.teiid.connector.jdbc.translator.FunctionModifier;
+
+import com.metamatrix.connector.api.TypeFacility;
+import com.metamatrix.connector.language.*;
+import com.metamatrix.connector.language.ICompareCriteria.Operator;
+
+/**
+ */
+public class DB2ConvertModifier extends BasicFunctionModifier implements FunctionModifier {
+
+    private static DropFunctionModifier DROP_MODIFIER = new DropFunctionModifier();
+
+    private ILanguageFactory langFactory;
+    
+    public DB2ConvertModifier(ILanguageFactory langFactory) {
+        this.langFactory = langFactory;
+    }
+
+    public IExpression modify(IFunction function) {
+        List<IExpression> args = function.getParameters();
+        Class sourceType = args.get(0).getType();
+        String targetTypeString = getTargetType(args.get(1));
+        Class targetType = TypeFacility.getDataTypeClass(targetTypeString);
+        IExpression returnExpr = null;
+        
+        if(targetType != null) {
+        
+            // targetType is always lower-case due to getTargetType implementation
+            if(targetType.equals(TypeFacility.RUNTIME_TYPES.STRING)) { 
+                returnExpr = convertToString(args.get(0), sourceType);
+                
+            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.TIMESTAMP)) { 
+                returnExpr = convertToTimestamp(args.get(0), sourceType);
+                
+            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.DATE)) { 
+                returnExpr = convertToDate(args.get(0), sourceType);
+                
+            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.TIME)) { 
+                returnExpr = convertToTime(args.get(0), sourceType);
+                
+            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN) || 
+                            targetType.equals(TypeFacility.RUNTIME_TYPES.BYTE) || 
+                            targetType.equals(TypeFacility.RUNTIME_TYPES.SHORT)) {  
+                returnExpr = convertToSmallInt(args.get(0), sourceType, targetType);
+                
+            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.INTEGER)) {  
+                returnExpr = convertToInteger(args.get(0), sourceType);
+                
+            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.LONG) || 
+                            targetType.equals(TypeFacility.RUNTIME_TYPES.BIG_INTEGER)) {  
+                returnExpr = convertToBigInt(args.get(0), sourceType);
+                
+            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.FLOAT)) {  
+                returnExpr = convertToReal(args.get(0), sourceType);
+
+            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.DOUBLE)) {  
+                returnExpr = convertToDouble(args.get(0), sourceType);
+
+            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.BIG_DECIMAL)) {  
+                returnExpr = convertToBigDecimal(args.get(0), sourceType);
+
+            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.CHAR)) { 
+                returnExpr = convertToChar(args.get(0), sourceType);
+            } 
+            
+            if(returnExpr != null) {
+                return returnExpr;
+            }
+        }
+        
+        // Last resort - just drop the convert and let the db figure it out
+        return DROP_MODIFIER.modify(function);  
+    }
+
+    /** 
+     * @param expression
+     * @return
+     * @since 4.2
+     */
+    private String getTargetType(IExpression expression) {
+        if(expression != null && expression instanceof ILiteral) {
+            String target = (String) ((ILiteral)expression).getValue();
+            return target.toLowerCase();
+        } 
+        
+        return null;            
+    }
+    
+
+    /** 
+     * @param expression
+     * @param sourceType
+     * @return
+     * @since 4.2
+     */
+    private IExpression convertToString(IExpression expression,
+                                        Class sourceType) {
+        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN)) {
+            // BEFORE: convert(booleanExpression, string)
+            // AFTER:  CASE WHEN booleanExpression = 0 THEN 'false' ELSE 'true' END
+
+            ILiteral literalZero = this.langFactory.createLiteral(new Integer(0), TypeFacility.RUNTIME_TYPES.INTEGER);
+            ICompareCriteria when = this.langFactory.createCompareCriteria(Operator.EQ, expression, literalZero);
+            List whens = new ArrayList(1);
+            whens.add(when);
+            
+            ILiteral literalFalse = this.langFactory.createLiteral("false", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$
+            List thens = new ArrayList(1);
+            thens.add(literalFalse);
+            
+            ILiteral literalTrue = this.langFactory.createLiteral("true", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$
+                        
+            return this.langFactory.createSearchedCaseExpression(whens, thens, literalTrue, TypeFacility.RUNTIME_TYPES.STRING);
+            
+        } else if(sourceType.equals(TypeFacility.RUNTIME_TYPES.CHAR)) {
+            // Drop convert entirely for char
+            return null;
+            
+        } else {
+            // BEFORE: convert(EXPR, string) 
+            // AFTER:  char(EXPR) 
+            return wrapNewFunction(expression, "char", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$            
+        }
+    }
+    
+    private IExpression convertToChar(IExpression expression,
+                                        Class sourceType) {
+        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING)) {
+            ILiteral literalOne = this.langFactory.createLiteral(new Integer(1), TypeFacility.RUNTIME_TYPES.INTEGER);
+            return this.langFactory.createFunction("char", Arrays.asList(expression, literalOne), TypeFacility.RUNTIME_TYPES.CHAR); //$NON-NLS-1$
+        } 
+        
+        return null;
+    }
+
+    private IExpression convertToSmallInt(IExpression expression,
+                                        Class sourceType, Class targetType) {
+        
+        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING) && targetType.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN)) { 
+            // BEFORE: convert(stringExpression, boolean)
+            // AFTER:  CASE WHEN stringExpression = 'true' THEN 1 ELSE 0 END
+            ILiteral literalTrue = this.langFactory.createLiteral("true", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$
+            ICompareCriteria when = this.langFactory.createCompareCriteria(Operator.EQ, expression, literalTrue);
+            List whens = new ArrayList(1);
+            whens.add(when);
+            
+            ILiteral literalOne = this.langFactory.createLiteral(new Integer(1), TypeFacility.RUNTIME_TYPES.INTEGER);
+            List thens = new ArrayList(1);
+            thens.add(literalOne);
+            
+            ILiteral literalZero = this.langFactory.createLiteral(new Integer(0), TypeFacility.RUNTIME_TYPES.INTEGER);
+                                    
+            return this.langFactory.createSearchedCaseExpression(whens, thens, literalZero, TypeFacility.RUNTIME_TYPES.STRING);
+            
+        } else if(sourceType.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN) || 
+                        sourceType.equals(TypeFacility.RUNTIME_TYPES.BYTE) || 
+                        sourceType.equals(TypeFacility.RUNTIME_TYPES.SHORT)){
+            
+            // Just drop these
+            return null;
+        }
+
+        // BEFORE: convert(expression, [boolean,byte,short])
+        // AFTER:  smallint(expression)
+        return wrapNewFunction(expression, "smallint", targetType); //$NON-NLS-1$
+    }
+
+    private IExpression convertToInteger(IExpression expression, Class sourceType) {
+          
+          if(sourceType.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN) || 
+                          sourceType.equals(TypeFacility.RUNTIME_TYPES.BYTE) || 
+                          sourceType.equals(TypeFacility.RUNTIME_TYPES.SHORT)){
+              
+              // Just drop these
+              return null;
+          } 
+
+          // BEFORE: convert(expression, integer)
+          // AFTER:  integer(expression)
+          return wrapNewFunction(expression, "integer", TypeFacility.RUNTIME_TYPES.INTEGER); //$NON-NLS-1$
+      }
+
+    private IExpression convertToBigInt(IExpression expression, Class sourceType) {
+        
+        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING) ||
+                        sourceType.equals(TypeFacility.RUNTIME_TYPES.FLOAT) || 
+                        sourceType.equals(TypeFacility.RUNTIME_TYPES.DOUBLE) || 
+                        sourceType.equals(TypeFacility.RUNTIME_TYPES.BIG_DECIMAL)){
+
+            // BEFORE: convert(expression, [long, biginteger])
+            // AFTER:  bigint(expression)
+            return wrapNewFunction(expression, "bigint", TypeFacility.RUNTIME_TYPES.LONG); //$NON-NLS-1$
+
+        } 
+
+        // Just drop anything else
+        return null;
+    }
+
+    private IExpression convertToReal(IExpression expression, Class sourceType) {
+        
+        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING) ||
+                        sourceType.equals(TypeFacility.RUNTIME_TYPES.DOUBLE) || 
+                        sourceType.equals(TypeFacility.RUNTIME_TYPES.BIG_DECIMAL)){
+
+            // BEFORE: convert(expression, [double, bigdecimal])
+            // AFTER:  real(expression)
+            return wrapNewFunction(expression, "real", TypeFacility.RUNTIME_TYPES.FLOAT); //$NON-NLS-1$
+
+        } 
+
+        // Just drop anything else
+        return null;
+    }
+
+    private IExpression convertToDouble(IExpression expression, Class sourceType) {
+        
+        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING)){
+
+            // BEFORE: convert(expression, double)
+            // AFTER:  double(expression)
+            return wrapNewFunction(expression, "double", TypeFacility.RUNTIME_TYPES.DOUBLE); //$NON-NLS-1$
+
+        } 
+
+        // Just drop anything else
+        return null;
+    }
+
+    private IExpression convertToBigDecimal(IExpression expression, Class sourceType) {
+        
+        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING)){
+
+            // BEFORE: convert(expression, bigdecimal)
+            // AFTER:  decimal(expression)
+            return wrapNewFunction(expression, "decimal", TypeFacility.RUNTIME_TYPES.BIG_DECIMAL); //$NON-NLS-1$
+
+        } 
+
+        // Just drop anything else
+        return null;
+    }
+
+    /** 
+     * @param expression
+     * @param sourceType
+     * @return
+     * @since 4.2
+     */
+    private IExpression convertToDate(IExpression expression,
+                                      Class sourceType) {
+                                
+        // BEFORE: convert(EXPR, date) 
+        // AFTER:  date(EXPR) 
+        return wrapNewFunction(expression, "date", TypeFacility.RUNTIME_TYPES.DATE); //$NON-NLS-1$
+    }
+
+    private IExpression convertToTime(IExpression expression, Class sourceType) {
+                                
+        // BEFORE: convert(EXPR, time) 
+        // AFTER:  time(EXPR) 
+        return wrapNewFunction(expression, "time", TypeFacility.RUNTIME_TYPES.DATE); //$NON-NLS-1$
+    }
+
+    private IExpression convertToTimestamp(IExpression expression,
+                                            Class sourceType) {
+        
+        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING)) {
+            // BEFORE: convert(EXPR, timestamp)
+            // AFTER:  timestamp(expr)
+            return wrapNewFunction(expression, "timestamp", TypeFacility.RUNTIME_TYPES.TIMESTAMP); //$NON-NLS-1$
+            
+        } else if(sourceType.equals(TypeFacility.RUNTIME_TYPES.DATE)) {
+            // BEFORE: convert(EXPR, timestamp)
+            // AFTER:  timestamp(EXPR, '00:00:00')
+            ILiteral timeString = this.langFactory.createLiteral("00:00:00", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$
+            return this.langFactory.createFunction("timestamp", Arrays.asList(expression, timeString), TypeFacility.RUNTIME_TYPES.TIMESTAMP);             //$NON-NLS-1$
+            
+        } else if(sourceType.equals(TypeFacility.RUNTIME_TYPES.TIME)) {
+            // BEFORE: convert(EXPR, timestamp)
+            // AFTER:  timestamp('1970-01-01', EXPR)
+            ILiteral dateString = this.langFactory.createLiteral("1970-01-01", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$
+            return this.langFactory.createFunction("timestamp", Arrays.asList(dateString, expression), TypeFacility.RUNTIME_TYPES.TIMESTAMP);             //$NON-NLS-1$
+        }
+        
+        return null;
+    }
+    
+    /** 
+     * @param expression
+     * @param functionName
+     * @param outputType
+     * @return
+     * @since 4.2
+     */
+    private IFunction wrapNewFunction(IExpression expression,
+                                      String functionName,
+                                      Class outputType) {
+        return langFactory.createFunction(functionName, 
+            Arrays.asList(expression),
+            outputType);
+    }
+
+}

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2SQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/db2/DB2SQLTranslator.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2SQLTranslator.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,87 +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.jdbc.db2;
-
-import java.util.Arrays;
-
-import com.metamatrix.connector.api.ConnectorEnvironment;
-import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.api.SourceSystemFunctions;
-import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.translator.AliasModifier;
-import com.metamatrix.connector.jdbc.translator.Translator;
-import com.metamatrix.connector.language.ICommand;
-import com.metamatrix.connector.language.IJoin;
-import com.metamatrix.connector.language.ILimit;
-import com.metamatrix.connector.language.ILiteral;
-import com.metamatrix.connector.language.ICompareCriteria.Operator;
-import com.metamatrix.connector.language.IJoin.JoinType;
-import com.metamatrix.connector.visitor.framework.HierarchyVisitor;
-
-/**
- */
-public class DB2SQLTranslator extends Translator {
-
-	@Override
-	public void initialize(ConnectorEnvironment env) throws ConnectorException {
-		super.initialize(env);
-        registerFunctionModifier(SourceSystemFunctions.CONVERT, new DB2ConvertModifier(getLanguageFactory())); //$NON-NLS-1$
-        registerFunctionModifier(SourceSystemFunctions.CHAR, new AliasModifier("chr")); //$NON-NLS-1$ //$NON-NLS-2$
-        registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new AliasModifier("day")); //$NON-NLS-1$ //$NON-NLS-2$        
-        registerFunctionModifier(SourceSystemFunctions.IFNULL, new AliasModifier("coalesce")); //$NON-NLS-1$ //$NON-NLS-2$
-        registerFunctionModifier(SourceSystemFunctions.SUBSTRING, new AliasModifier("substr")); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-	
-	@Override
-	public String addLimitString(String queryCommand, ILimit limit) {
-		return queryCommand + " FETCH FIRST " + limit.getRowLimit() + " ROWS ONLY"; //$NON-NLS-1$
-	}
-	
-	@Override
-	public ICommand modifyCommand(ICommand command, ExecutionContext context)
-			throws ConnectorException {
-		HierarchyVisitor hierarchyVisitor = new HierarchyVisitor() {
-			@Override
-			public void visit(IJoin obj) {
-				if (obj.getJoinType() != JoinType.CROSS_JOIN) {
-					return;
-				}
-				ILiteral one = getLanguageFactory().createLiteral(1, TypeFacility.RUNTIME_TYPES.INTEGER);
-				obj.setCriteria(Arrays.asList(getLanguageFactory().createCompareCriteria(Operator.EQ, one, one)));
-				obj.setJoinType(JoinType.INNER_JOIN);
-			}
-		};
-		
-		command.acceptVisitor(hierarchyVisitor);
-		return command;
-	}
-	
-	@Override
-	public String getDefaultConnectionTestQuery() {
-		return "Select 'x' from sysibm.systables where 1 = 2"; //$NON-NLS-1$
-	}
-    
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2SQLTranslator.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/db2/DB2SQLTranslator.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2SQLTranslator.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/db2/DB2SQLTranslator.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,86 @@
+/*
+ * 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.db2;
+
+import org.teiid.connector.jdbc.translator.AliasModifier;
+import org.teiid.connector.jdbc.translator.Translator;
+
+import com.metamatrix.connector.api.ConnectorEnvironment;
+import com.metamatrix.connector.api.ConnectorException;
+import com.metamatrix.connector.api.ExecutionContext;
+import com.metamatrix.connector.api.SourceSystemFunctions;
+import com.metamatrix.connector.api.TypeFacility;
+import com.metamatrix.connector.language.ICommand;
+import com.metamatrix.connector.language.IJoin;
+import com.metamatrix.connector.language.ILimit;
+import com.metamatrix.connector.language.ILiteral;
+import com.metamatrix.connector.language.ICompareCriteria.Operator;
+import com.metamatrix.connector.language.IJoin.JoinType;
+import com.metamatrix.connector.visitor.framework.HierarchyVisitor;
+
+/**
+ */
+public class DB2SQLTranslator extends Translator {
+
+	@Override
+	public void initialize(ConnectorEnvironment env) throws ConnectorException {
+		super.initialize(env);
+        registerFunctionModifier(SourceSystemFunctions.CONVERT, new DB2ConvertModifier(getLanguageFactory())); //$NON-NLS-1$
+        registerFunctionModifier(SourceSystemFunctions.CHAR, new AliasModifier("chr")); //$NON-NLS-1$ //$NON-NLS-2$
+        registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new AliasModifier("day")); //$NON-NLS-1$ //$NON-NLS-2$        
+        registerFunctionModifier(SourceSystemFunctions.IFNULL, new AliasModifier("coalesce")); //$NON-NLS-1$ //$NON-NLS-2$
+        registerFunctionModifier(SourceSystemFunctions.SUBSTRING, new AliasModifier("substr")); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+	
+	@Override
+	public String addLimitString(String queryCommand, ILimit limit) {
+		return queryCommand + " FETCH FIRST " + limit.getRowLimit() + " ROWS ONLY"; //$NON-NLS-1$
+	}
+	
+	@Override
+	public ICommand modifyCommand(ICommand command, ExecutionContext context)
+			throws ConnectorException {
+		HierarchyVisitor hierarchyVisitor = new HierarchyVisitor() {
+			@Override
+			public void visit(IJoin obj) {
+				if (obj.getJoinType() != JoinType.CROSS_JOIN) {
+					return;
+				}
+				ILiteral one = getLanguageFactory().createLiteral(1, TypeFacility.RUNTIME_TYPES.INTEGER);
+				obj.getCriteria().add(getLanguageFactory().createCompareCriteria(Operator.EQ, one, one));
+				obj.setJoinType(JoinType.INNER_JOIN);
+			}
+		};
+		
+		command.acceptVisitor(hierarchyVisitor);
+		return command;
+	}
+	
+	@Override
+	public String getDefaultConnectionTestQuery() {
+		return "Select 'x' from sysibm.systables where 1 = 2"; //$NON-NLS-1$
+	}
+    
+}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/derby)


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbyCapabilities.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/derby/DerbyCapabilities.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbyCapabilities.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -20,12 +20,13 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.jdbc.derby;
+package org.teiid.connector.jdbc.derby;
 
 import java.util.ArrayList;
 import java.util.List;
+
+import org.teiid.connector.jdbc.JDBCCapabilities;
 
-import com.metamatrix.connector.jdbc.JDBCCapabilities;
 
 
 /** 

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbyConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/derby/DerbyConvertModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbyConvertModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,370 +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.jdbc.derby;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
-import com.metamatrix.connector.jdbc.translator.DropFunctionModifier;
-import com.metamatrix.connector.jdbc.translator.FunctionModifier;
-import com.metamatrix.connector.language.*;
-import com.metamatrix.connector.language.ICompareCriteria.Operator;
-
-/**
- */
-public class DerbyConvertModifier extends BasicFunctionModifier implements FunctionModifier {
-
-    private static DropFunctionModifier DROP_MODIFIER = new DropFunctionModifier();
-
-    private ILanguageFactory langFactory;
-    
-    public DerbyConvertModifier(ILanguageFactory langFactory) {
-        this.langFactory = langFactory;
-    }
-
-    /** 
-     * @see com.metamatrix.connector.jdbc.translator.BasicFunctionModifier#translate(com.metamatrix.connector.language.IFunction)
-     * @since 5.0
-     */
-    public List translate(IFunction function) {
-        // For anything that doesn't get modified to some other function, translate the convert(expr, type)
-        // to cast(expr as type).
-        
-        List parts = new ArrayList();
-        parts.add("cast("); //$NON-NLS-1$
-        parts.add(function.getParameters()[0]);
-        parts.add(" as ");         //$NON-NLS-1$
-        ILiteral type = (ILiteral) function.getParameters()[1];        
-        parts.add(type.getValue());
-        parts.add(")"); //$NON-NLS-1$
-        
-        return parts;
-    }
-    
-    public IExpression modify(IFunction function) {
-        IExpression[] args = function.getParameters();
-        Class sourceType = args[0].getType();
-        String targetTypeString = getTargetType(args[1]);
-        Class targetType = TypeFacility.getDataTypeClass(targetTypeString);
-        IExpression returnExpr = null;
-        
-        if(targetType != null) {
-        
-            // targetType is always lower-case due to getTargetType implementation
-            if(targetType.equals(TypeFacility.RUNTIME_TYPES.STRING)) { 
-                returnExpr = convertToString(args[0], sourceType);
-                
-            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.TIMESTAMP)) { 
-                returnExpr = convertToTimestamp(args[0], sourceType);
-                
-            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.DATE)) { 
-                returnExpr = convertToDate(args[0], sourceType);
-                
-            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.TIME)) { 
-                returnExpr = convertToTime(args[0], sourceType);
-                
-            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN) || 
-                            targetType.equals(TypeFacility.RUNTIME_TYPES.BYTE) || 
-                            targetType.equals(TypeFacility.RUNTIME_TYPES.SHORT)) {  
-                returnExpr = convertToSmallInt(args[0], sourceType, targetType);
-                
-            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.INTEGER)) {  
-                returnExpr = convertToInteger(args[0], sourceType);
-                
-            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.LONG) || 
-                            targetType.equals(TypeFacility.RUNTIME_TYPES.BIG_INTEGER)) {  
-                returnExpr = convertToBigInt(args[0], sourceType);
-                
-            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.FLOAT)) {  
-                returnExpr = convertToFloat(args[0], sourceType);
-
-            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.DOUBLE)) {  
-                returnExpr = convertToDouble(args[0], sourceType);
-
-            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.BIG_DECIMAL)) {  
-                returnExpr = convertToBigDecimal(args[0], sourceType);
-
-            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.CHAR)) { 
-                returnExpr = convertToChar(args[0], sourceType);
-            } 
-            
-            if(returnExpr != null) {
-                return returnExpr;
-            }
-        }
-        
-        // Last resort - just drop the convert and let the db figure it out
-        return DROP_MODIFIER.modify(function);  
-    }
-
-    /** 
-     * @param expression
-     * @return
-     * @since 4.2
-     */
-    private String getTargetType(IExpression expression) {
-        if(expression != null && expression instanceof ILiteral) {
-            String target = (String) ((ILiteral)expression).getValue();
-            return target.toLowerCase();
-        } 
-        
-        return null;            
-    }
-    
-
-    /** 
-     * @param expression
-     * @param sourceType
-     * @return
-     * @since 4.2
-     */
-    private IExpression convertToString(IExpression expression,
-                                        Class sourceType) {
-        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN)) {
-            // BEFORE: convert(booleanExpression, string)
-            // AFTER:  CASE WHEN booleanExpression = 0 THEN 'false' ELSE 'true' END
-
-            ILiteral literalZero = this.langFactory.createLiteral(new Integer(0), TypeFacility.RUNTIME_TYPES.INTEGER);
-            ICompareCriteria when = this.langFactory.createCompareCriteria(Operator.EQ, expression, literalZero);
-            List whens = new ArrayList(1);
-            whens.add(when);
-            
-            ILiteral literalFalse = this.langFactory.createLiteral("false", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$
-            List thens = new ArrayList(1);
-            thens.add(literalFalse);
-            
-            ILiteral literalTrue = this.langFactory.createLiteral("true", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$
-                        
-            return this.langFactory.createSearchedCaseExpression(whens, thens, literalTrue, TypeFacility.RUNTIME_TYPES.STRING);
-            
-        } else if(sourceType.equals(TypeFacility.RUNTIME_TYPES.CHAR)) {
-            // Drop convert entirely for char
-            return null;
-            
-        } else {
-            // BEFORE: convert(EXPR, string) 
-            // AFTER:  char(EXPR) 
-            return wrapNewFunction(expression, "char", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$            
-        }
-    }
-    
-    private IExpression convertToChar(IExpression expression,
-                                        Class sourceType) {
-        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING)) {
-            ILiteral literalOne = this.langFactory.createLiteral(new Integer(1), TypeFacility.RUNTIME_TYPES.INTEGER);
-            return this.langFactory.createFunction("char", new IExpression[] { expression, literalOne }, TypeFacility.RUNTIME_TYPES.CHAR); //$NON-NLS-1$
-        } 
-        
-        return null;
-    }
-
-    private IExpression convertToSmallInt(IExpression expression,
-                                        Class sourceType, Class targetType) {
-        
-        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING) && targetType.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN)) { 
-            // BEFORE: convert(stringExpression, boolean)
-            // AFTER:  CASE WHEN stringExpression = 'true' THEN 1 ELSE 0 END
-            ILiteral literalTrue = this.langFactory.createLiteral("true", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$
-            ICompareCriteria when = this.langFactory.createCompareCriteria(Operator.EQ, expression, literalTrue);
-            List whens = new ArrayList(1);
-            whens.add(when);
-            
-            ILiteral literalOne = this.langFactory.createLiteral(new Integer(1), TypeFacility.RUNTIME_TYPES.INTEGER);
-            List thens = new ArrayList(1);
-            thens.add(literalOne);
-            
-            ILiteral literalZero = this.langFactory.createLiteral(new Integer(0), TypeFacility.RUNTIME_TYPES.INTEGER);
-                                    
-            return this.langFactory.createSearchedCaseExpression(whens, thens, literalZero, TypeFacility.RUNTIME_TYPES.STRING);
-            
-        } else if(sourceType.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN) || 
-                        sourceType.equals(TypeFacility.RUNTIME_TYPES.BYTE) || 
-                        sourceType.equals(TypeFacility.RUNTIME_TYPES.SHORT)){
-            
-            // Just drop these
-            return null;
-        }
-
-        // BEFORE: convert(expression, [boolean,byte,short])
-        // AFTER:  smallint(expression)
-        return wrapNewFunction(expression, "smallint", targetType); //$NON-NLS-1$
-    }
-
-    private IExpression convertToInteger(IExpression expression, Class sourceType) {
-          
-          if(sourceType.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN) || 
-                          sourceType.equals(TypeFacility.RUNTIME_TYPES.BYTE) || 
-                          sourceType.equals(TypeFacility.RUNTIME_TYPES.SHORT)){
-              
-              // Just drop these
-              return null;
-          } 
-
-          // BEFORE: convert(expression, integer)
-          // AFTER:  integer(expression)
-          return wrapNewFunction(expression, "integer", TypeFacility.RUNTIME_TYPES.INTEGER); //$NON-NLS-1$
-      }
-
-    private IExpression convertToBigInt(IExpression expression, Class sourceType) {
-        
-        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING) ||
-                        sourceType.equals(TypeFacility.RUNTIME_TYPES.FLOAT) || 
-                        sourceType.equals(TypeFacility.RUNTIME_TYPES.DOUBLE) || 
-                        sourceType.equals(TypeFacility.RUNTIME_TYPES.BIG_DECIMAL)){
-
-            // BEFORE: convert(expression, [long, biginteger])
-            // AFTER:  bigint(expression)
-            return wrapNewFunction(expression, "bigint", TypeFacility.RUNTIME_TYPES.LONG); //$NON-NLS-1$
-
-        } 
-
-        // Just drop anything else
-        return null;
-    }
-
-    private IExpression convertToFloat(IExpression expression, Class sourceType) {
-        
-        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING)){
-
-            // BEFORE: convert(string_expr, float)
-            // AFTER:  cast(cast(string_expr as decimal) as float)
-            IFunction inner = langFactory.createFunction("convert",  //$NON-NLS-1$
-                new IExpression[] { expression, langFactory.createLiteral("decimal", TypeFacility.RUNTIME_TYPES.STRING) },  //$NON-NLS-1$
-                TypeFacility.RUNTIME_TYPES.BIG_DECIMAL);
-
-            IFunction outer = langFactory.createFunction("convert",  //$NON-NLS-1$
-                new IExpression[] { inner, langFactory.createLiteral("float", TypeFacility.RUNTIME_TYPES.STRING) },  //$NON-NLS-1$
-                TypeFacility.RUNTIME_TYPES.FLOAT);
-
-            return outer; 
-
-        } else if(sourceType.equals(TypeFacility.RUNTIME_TYPES.DOUBLE) || 
-                        sourceType.equals(TypeFacility.RUNTIME_TYPES.BIG_DECIMAL)) {
-        
-            // BEFORE: convert(num_expr, float)
-            // AFTER:  cast(num_expr as float)
-            return langFactory.createFunction("convert",  //$NON-NLS-1$
-                new IExpression[] { expression, langFactory.createLiteral("float", TypeFacility.RUNTIME_TYPES.STRING) },  //$NON-NLS-1$
-                TypeFacility.RUNTIME_TYPES.FLOAT);
-        }
-
-        // Just drop anything else
-        return null;
-    }
-
-    private IExpression convertToDouble(IExpression expression, Class sourceType) {
-
-        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING)){
-            // BEFORE: convert(string_expr, double)
-            // AFTER:  cast(cast(string_expr as decimal) as double)
-            IFunction inner = langFactory.createFunction("convert",  //$NON-NLS-1$
-                new IExpression[] { expression, langFactory.createLiteral("decimal", TypeFacility.RUNTIME_TYPES.STRING) },  //$NON-NLS-1$
-                TypeFacility.RUNTIME_TYPES.BIG_DECIMAL);
-
-            return langFactory.createFunction("convert",  //$NON-NLS-1$
-                new IExpression[] { inner, langFactory.createLiteral("double", TypeFacility.RUNTIME_TYPES.STRING) },  //$NON-NLS-1$
-                TypeFacility.RUNTIME_TYPES.DOUBLE);
-        }
-
-        // Just drop anything else
-        return null;
-    }
-
-    private IExpression convertToBigDecimal(IExpression expression, Class sourceType) {
-        
-        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING)){
-            // BEFORE: convert(string_expr, bigdecimal)
-            // AFTER:  cast(string_expr as decimal)
-            return langFactory.createFunction("convert",  //$NON-NLS-1$
-                new IExpression[] { expression, langFactory.createLiteral("decimal", TypeFacility.RUNTIME_TYPES.STRING) },  //$NON-NLS-1$
-                TypeFacility.RUNTIME_TYPES.BIG_DECIMAL);
-        }
-
-        // Just drop anything else
-        return null;
-    }
-
-    /** 
-     * @param expression
-     * @param sourceType
-     * @return
-     * @since 4.2
-     */
-    private IExpression convertToDate(IExpression expression,
-                                      Class sourceType) {
-                                
-        // BEFORE: convert(EXPR, date) 
-        // AFTER:  date(EXPR) 
-        return wrapNewFunction(expression, "date", TypeFacility.RUNTIME_TYPES.DATE); //$NON-NLS-1$
-    }
-
-    private IExpression convertToTime(IExpression expression,
-                                      Class sourceType) {
-                                
-        // BEFORE: convert(EXPR, time) 
-        // AFTER:  time(EXPR) 
-        return wrapNewFunction(expression, "time", TypeFacility.RUNTIME_TYPES.DATE); //$NON-NLS-1$
-    }
-
-    private IExpression convertToTimestamp(IExpression expression,
-                                            Class sourceType) {
-        
-        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING)) {
-            // BEFORE: convert(EXPR, timestamp)
-            // AFTER:  timestamp(expr)
-            return wrapNewFunction(expression, "timestamp", TypeFacility.RUNTIME_TYPES.TIMESTAMP); //$NON-NLS-1$
-            
-        } else if(sourceType.equals(TypeFacility.RUNTIME_TYPES.DATE)) {
-            // BEFORE: convert(EXPR, timestamp)
-            // AFTER:  timestamp(EXPR, '00:00:00')
-            ILiteral timeString = this.langFactory.createLiteral("00:00:00", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$
-            return this.langFactory.createFunction("timestamp", new IExpression[] {expression, timeString}, TypeFacility.RUNTIME_TYPES.TIMESTAMP);             //$NON-NLS-1$
-            
-        } else if(sourceType.equals(TypeFacility.RUNTIME_TYPES.TIME)) {
-            // BEFORE: convert(EXPR, timestamp)
-            // AFTER:  timestamp(EXPR, '1970-01-01', EXPR)
-            ILiteral dateString = this.langFactory.createLiteral("1970-01-01", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$
-            return this.langFactory.createFunction("timestamp", new IExpression[] {dateString, expression}, TypeFacility.RUNTIME_TYPES.TIMESTAMP);             //$NON-NLS-1$
-        }
-        
-        return null;
-    }
-    
-    /** 
-     * @param expression
-     * @param functionName
-     * @param outputType
-     * @return
-     * @since 4.2
-     */
-    private IFunction wrapNewFunction(IExpression expression,
-                                      String functionName,
-                                      Class outputType) {
-        return langFactory.createFunction(functionName, 
-            new IExpression[] { expression },
-            outputType);
-    }
-
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbyConvertModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/derby/DerbyConvertModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbyConvertModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbyConvertModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,372 @@
+/*
+ * 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.derby;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.connector.jdbc.translator.BasicFunctionModifier;
+import org.teiid.connector.jdbc.translator.DropFunctionModifier;
+import org.teiid.connector.jdbc.translator.FunctionModifier;
+
+import com.metamatrix.connector.api.TypeFacility;
+import com.metamatrix.connector.language.*;
+import com.metamatrix.connector.language.ICompareCriteria.Operator;
+
+/**
+ */
+public class DerbyConvertModifier extends BasicFunctionModifier implements FunctionModifier {
+
+    private static DropFunctionModifier DROP_MODIFIER = new DropFunctionModifier();
+
+    private ILanguageFactory langFactory;
+    
+    public DerbyConvertModifier(ILanguageFactory langFactory) {
+        this.langFactory = langFactory;
+    }
+
+    /** 
+     * @see org.teiid.connector.jdbc.translator.BasicFunctionModifier#translate(com.metamatrix.connector.language.IFunction)
+     * @since 5.0
+     */
+    public List translate(IFunction function) {
+        // For anything that doesn't get modified to some other function, translate the convert(expr, type)
+        // to cast(expr as type).
+        
+        List parts = new ArrayList();
+        parts.add("cast("); //$NON-NLS-1$
+        parts.add(function.getParameters().get(0));
+        parts.add(" as ");         //$NON-NLS-1$
+        ILiteral type = (ILiteral) function.getParameters().get(1);        
+        parts.add(type.getValue());
+        parts.add(")"); //$NON-NLS-1$
+        
+        return parts;
+    }
+    
+    public IExpression modify(IFunction function) {
+        List<IExpression> args = function.getParameters();
+        Class sourceType = args.get(0).getType();
+        String targetTypeString = getTargetType(args.get(1));
+        Class targetType = TypeFacility.getDataTypeClass(targetTypeString);
+        IExpression returnExpr = null;
+        
+        if(targetType != null) {
+        
+            // targetType is always lower-case due to getTargetType implementation
+            if(targetType.equals(TypeFacility.RUNTIME_TYPES.STRING)) { 
+                returnExpr = convertToString(args.get(0), sourceType);
+                
+            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.TIMESTAMP)) { 
+                returnExpr = convertToTimestamp(args.get(0), sourceType);
+                
+            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.DATE)) { 
+                returnExpr = convertToDate(args.get(0), sourceType);
+                
+            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.TIME)) { 
+                returnExpr = convertToTime(args.get(0), sourceType);
+                
+            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN) || 
+                            targetType.equals(TypeFacility.RUNTIME_TYPES.BYTE) || 
+                            targetType.equals(TypeFacility.RUNTIME_TYPES.SHORT)) {  
+                returnExpr = convertToSmallInt(args.get(0), sourceType, targetType);
+                
+            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.INTEGER)) {  
+                returnExpr = convertToInteger(args.get(0), sourceType);
+                
+            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.LONG) || 
+                            targetType.equals(TypeFacility.RUNTIME_TYPES.BIG_INTEGER)) {  
+                returnExpr = convertToBigInt(args.get(0), sourceType);
+                
+            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.FLOAT)) {  
+                returnExpr = convertToFloat(args.get(0), sourceType);
+
+            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.DOUBLE)) {  
+                returnExpr = convertToDouble(args.get(0), sourceType);
+
+            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.BIG_DECIMAL)) {  
+                returnExpr = convertToBigDecimal(args.get(0), sourceType);
+
+            } else if(targetType.equals(TypeFacility.RUNTIME_TYPES.CHAR)) { 
+                returnExpr = convertToChar(args.get(0), sourceType);
+            } 
+            
+            if(returnExpr != null) {
+                return returnExpr;
+            }
+        }
+        
+        // Last resort - just drop the convert and let the db figure it out
+        return DROP_MODIFIER.modify(function);  
+    }
+
+    /** 
+     * @param expression
+     * @return
+     * @since 4.2
+     */
+    private String getTargetType(IExpression expression) {
+        if(expression != null && expression instanceof ILiteral) {
+            String target = (String) ((ILiteral)expression).getValue();
+            return target.toLowerCase();
+        } 
+        
+        return null;            
+    }
+    
+
+    /** 
+     * @param expression
+     * @param sourceType
+     * @return
+     * @since 4.2
+     */
+    private IExpression convertToString(IExpression expression,
+                                        Class sourceType) {
+        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN)) {
+            // BEFORE: convert(booleanExpression, string)
+            // AFTER:  CASE WHEN booleanExpression = 0 THEN 'false' ELSE 'true' END
+
+            ILiteral literalZero = this.langFactory.createLiteral(new Integer(0), TypeFacility.RUNTIME_TYPES.INTEGER);
+            ICompareCriteria when = this.langFactory.createCompareCriteria(Operator.EQ, expression, literalZero);
+            List whens = new ArrayList(1);
+            whens.add(when);
+            
+            ILiteral literalFalse = this.langFactory.createLiteral("false", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$
+            List thens = new ArrayList(1);
+            thens.add(literalFalse);
+            
+            ILiteral literalTrue = this.langFactory.createLiteral("true", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$
+                        
+            return this.langFactory.createSearchedCaseExpression(whens, thens, literalTrue, TypeFacility.RUNTIME_TYPES.STRING);
+            
+        } else if(sourceType.equals(TypeFacility.RUNTIME_TYPES.CHAR)) {
+            // Drop convert entirely for char
+            return null;
+            
+        } else {
+            // BEFORE: convert(EXPR, string) 
+            // AFTER:  char(EXPR) 
+            return wrapNewFunction(expression, "char", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$            
+        }
+    }
+    
+    private IExpression convertToChar(IExpression expression,
+                                        Class sourceType) {
+        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING)) {
+            ILiteral literalOne = this.langFactory.createLiteral(new Integer(1), TypeFacility.RUNTIME_TYPES.INTEGER);
+            return this.langFactory.createFunction("char", Arrays.asList( expression, literalOne ), TypeFacility.RUNTIME_TYPES.CHAR); //$NON-NLS-1$
+        } 
+        
+        return null;
+    }
+
+    private IExpression convertToSmallInt(IExpression expression,
+                                        Class sourceType, Class targetType) {
+        
+        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING) && targetType.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN)) { 
+            // BEFORE: convert(stringExpression, boolean)
+            // AFTER:  CASE WHEN stringExpression = 'true' THEN 1 ELSE 0 END
+            ILiteral literalTrue = this.langFactory.createLiteral("true", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$
+            ICompareCriteria when = this.langFactory.createCompareCriteria(Operator.EQ, expression, literalTrue);
+            List whens = new ArrayList(1);
+            whens.add(when);
+            
+            ILiteral literalOne = this.langFactory.createLiteral(new Integer(1), TypeFacility.RUNTIME_TYPES.INTEGER);
+            List thens = new ArrayList(1);
+            thens.add(literalOne);
+            
+            ILiteral literalZero = this.langFactory.createLiteral(new Integer(0), TypeFacility.RUNTIME_TYPES.INTEGER);
+                                    
+            return this.langFactory.createSearchedCaseExpression(whens, thens, literalZero, TypeFacility.RUNTIME_TYPES.STRING);
+            
+        } else if(sourceType.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN) || 
+                        sourceType.equals(TypeFacility.RUNTIME_TYPES.BYTE) || 
+                        sourceType.equals(TypeFacility.RUNTIME_TYPES.SHORT)){
+            
+            // Just drop these
+            return null;
+        }
+
+        // BEFORE: convert(expression, [boolean,byte,short])
+        // AFTER:  smallint(expression)
+        return wrapNewFunction(expression, "smallint", targetType); //$NON-NLS-1$
+    }
+
+    private IExpression convertToInteger(IExpression expression, Class sourceType) {
+          
+          if(sourceType.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN) || 
+                          sourceType.equals(TypeFacility.RUNTIME_TYPES.BYTE) || 
+                          sourceType.equals(TypeFacility.RUNTIME_TYPES.SHORT)){
+              
+              // Just drop these
+              return null;
+          } 
+
+          // BEFORE: convert(expression, integer)
+          // AFTER:  integer(expression)
+          return wrapNewFunction(expression, "integer", TypeFacility.RUNTIME_TYPES.INTEGER); //$NON-NLS-1$
+      }
+
+    private IExpression convertToBigInt(IExpression expression, Class sourceType) {
+        
+        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING) ||
+                        sourceType.equals(TypeFacility.RUNTIME_TYPES.FLOAT) || 
+                        sourceType.equals(TypeFacility.RUNTIME_TYPES.DOUBLE) || 
+                        sourceType.equals(TypeFacility.RUNTIME_TYPES.BIG_DECIMAL)){
+
+            // BEFORE: convert(expression, [long, biginteger])
+            // AFTER:  bigint(expression)
+            return wrapNewFunction(expression, "bigint", TypeFacility.RUNTIME_TYPES.LONG); //$NON-NLS-1$
+
+        } 
+
+        // Just drop anything else
+        return null;
+    }
+
+    private IExpression convertToFloat(IExpression expression, Class sourceType) {
+        
+        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING)){
+
+            // BEFORE: convert(string_expr, float)
+            // AFTER:  cast(cast(string_expr as decimal) as float)
+            IFunction inner = langFactory.createFunction("convert",  //$NON-NLS-1$
+                Arrays.asList( expression, langFactory.createLiteral("decimal", TypeFacility.RUNTIME_TYPES.STRING) ),  //$NON-NLS-1$
+                TypeFacility.RUNTIME_TYPES.BIG_DECIMAL);
+
+            IFunction outer = langFactory.createFunction("convert",  //$NON-NLS-1$
+                Arrays.asList( inner, langFactory.createLiteral("float", TypeFacility.RUNTIME_TYPES.STRING) ),  //$NON-NLS-1$
+                TypeFacility.RUNTIME_TYPES.FLOAT);
+
+            return outer; 
+
+        } else if(sourceType.equals(TypeFacility.RUNTIME_TYPES.DOUBLE) || 
+                        sourceType.equals(TypeFacility.RUNTIME_TYPES.BIG_DECIMAL)) {
+        
+            // BEFORE: convert(num_expr, float)
+            // AFTER:  cast(num_expr as float)
+            return langFactory.createFunction("convert",  //$NON-NLS-1$
+                Arrays.asList( expression, langFactory.createLiteral("float", TypeFacility.RUNTIME_TYPES.STRING) ),  //$NON-NLS-1$
+                TypeFacility.RUNTIME_TYPES.FLOAT);
+        }
+
+        // Just drop anything else
+        return null;
+    }
+
+    private IExpression convertToDouble(IExpression expression, Class sourceType) {
+
+        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING)){
+            // BEFORE: convert(string_expr, double)
+            // AFTER:  cast(cast(string_expr as decimal) as double)
+            IFunction inner = langFactory.createFunction("convert",  //$NON-NLS-1$
+                Arrays.asList( expression, langFactory.createLiteral("decimal", TypeFacility.RUNTIME_TYPES.STRING) ),  //$NON-NLS-1$
+                TypeFacility.RUNTIME_TYPES.BIG_DECIMAL);
+
+            return langFactory.createFunction("convert",  //$NON-NLS-1$
+                Arrays.asList( inner, langFactory.createLiteral("double", TypeFacility.RUNTIME_TYPES.STRING) ),  //$NON-NLS-1$
+                TypeFacility.RUNTIME_TYPES.DOUBLE);
+        }
+
+        // Just drop anything else
+        return null;
+    }
+
+    private IExpression convertToBigDecimal(IExpression expression, Class sourceType) {
+        
+        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING)){
+            // BEFORE: convert(string_expr, bigdecimal)
+            // AFTER:  cast(string_expr as decimal)
+            return langFactory.createFunction("convert",  //$NON-NLS-1$
+                Arrays.asList( expression, langFactory.createLiteral("decimal", TypeFacility.RUNTIME_TYPES.STRING) ),  //$NON-NLS-1$
+                TypeFacility.RUNTIME_TYPES.BIG_DECIMAL);
+        }
+
+        // Just drop anything else
+        return null;
+    }
+
+    /** 
+     * @param expression
+     * @param sourceType
+     * @return
+     * @since 4.2
+     */
+    private IExpression convertToDate(IExpression expression,
+                                      Class sourceType) {
+                                
+        // BEFORE: convert(EXPR, date) 
+        // AFTER:  date(EXPR) 
+        return wrapNewFunction(expression, "date", TypeFacility.RUNTIME_TYPES.DATE); //$NON-NLS-1$
+    }
+
+    private IExpression convertToTime(IExpression expression,
+                                      Class sourceType) {
+                                
+        // BEFORE: convert(EXPR, time) 
+        // AFTER:  time(EXPR) 
+        return wrapNewFunction(expression, "time", TypeFacility.RUNTIME_TYPES.DATE); //$NON-NLS-1$
+    }
+
+    private IExpression convertToTimestamp(IExpression expression,
+                                            Class sourceType) {
+        
+        if(sourceType.equals(TypeFacility.RUNTIME_TYPES.STRING)) {
+            // BEFORE: convert(EXPR, timestamp)
+            // AFTER:  timestamp(expr)
+            return wrapNewFunction(expression, "timestamp", TypeFacility.RUNTIME_TYPES.TIMESTAMP); //$NON-NLS-1$
+            
+        } else if(sourceType.equals(TypeFacility.RUNTIME_TYPES.DATE)) {
+            // BEFORE: convert(EXPR, timestamp)
+            // AFTER:  timestamp(EXPR, '00:00:00')
+            ILiteral timeString = this.langFactory.createLiteral("00:00:00", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$
+            return this.langFactory.createFunction("timestamp", Arrays.asList(expression, timeString), TypeFacility.RUNTIME_TYPES.TIMESTAMP);             //$NON-NLS-1$
+            
+        } else if(sourceType.equals(TypeFacility.RUNTIME_TYPES.TIME)) {
+            // BEFORE: convert(EXPR, timestamp)
+            // AFTER:  timestamp(EXPR, '1970-01-01', EXPR)
+            ILiteral dateString = this.langFactory.createLiteral("1970-01-01", TypeFacility.RUNTIME_TYPES.STRING); //$NON-NLS-1$
+            return this.langFactory.createFunction("timestamp", Arrays.asList(dateString, expression), TypeFacility.RUNTIME_TYPES.TIMESTAMP);             //$NON-NLS-1$
+        }
+        
+        return null;
+    }
+    
+    /** 
+     * @param expression
+     * @param functionName
+     * @param outputType
+     * @return
+     * @since 4.2
+     */
+    private IFunction wrapNewFunction(IExpression expression,
+                                      String functionName,
+                                      Class outputType) {
+        return langFactory.createFunction(functionName, 
+            Arrays.asList( expression ),
+            outputType);
+    }
+
+}

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbySQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/derby/DerbySQLTranslator.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/derby/DerbySQLTranslator.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -20,14 +20,15 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.jdbc.derby;
+package org.teiid.connector.jdbc.derby;
 
+import org.teiid.connector.jdbc.translator.AliasModifier;
+import org.teiid.connector.jdbc.translator.EscapeSyntaxModifier;
+import org.teiid.connector.jdbc.translator.Translator;
+
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.SourceSystemFunctions;
-import com.metamatrix.connector.jdbc.translator.AliasModifier;
-import com.metamatrix.connector.jdbc.translator.EscapeSyntaxModifier;
-import com.metamatrix.connector.jdbc.translator.Translator;
 
 
 /** 

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/informix (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/informix)


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/informix
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/informix/InformixCapabilities.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/informix/InformixCapabilities.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/informix/InformixCapabilities.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -22,12 +22,13 @@
 
 /*
  */
-package com.metamatrix.connector.jdbc.informix;
+package org.teiid.connector.jdbc.informix;
 
 import java.util.*;
 
-import com.metamatrix.connector.jdbc.JDBCCapabilities;
+import org.teiid.connector.jdbc.JDBCCapabilities;
 
+
 /**
  */
 public class InformixCapabilities extends JDBCCapabilities {

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/informix/InformixSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/informix/InformixSQLTranslator.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/informix/InformixSQLTranslator.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -22,13 +22,14 @@
 
 /*
  */
-package com.metamatrix.connector.jdbc.informix;
+package org.teiid.connector.jdbc.informix;
 
+import org.teiid.connector.jdbc.translator.DropFunctionModifier;
+import org.teiid.connector.jdbc.translator.Translator;
+
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.SourceSystemFunctions;
-import com.metamatrix.connector.jdbc.translator.DropFunctionModifier;
-import com.metamatrix.connector.jdbc.translator.Translator;
 
 /**
  */

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mm (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/mm)


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mm
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mm/MMCapabilities.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/mm/MMCapabilities.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mm/MMCapabilities.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -22,13 +22,14 @@
 
 /*
  */
-package com.metamatrix.connector.jdbc.mm;
+package org.teiid.connector.jdbc.mm;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import com.metamatrix.connector.jdbc.JDBCCapabilities;
+import org.teiid.connector.jdbc.JDBCCapabilities;
 
+
 /** 
  * @since 4.3
  */

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/mysql)


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLCapabilities.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/mysql/MySQLCapabilities.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLCapabilities.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -20,12 +20,13 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.jdbc.mysql;
+package org.teiid.connector.jdbc.mysql;
 
 import java.util.ArrayList;
 import java.util.List;
+
+import org.teiid.connector.jdbc.JDBCCapabilities;
 
-import com.metamatrix.connector.jdbc.JDBCCapabilities;
 
 
 /** 

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/mysql/MySQLConvertModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLConvertModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,184 +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.jdbc.mysql;
-
-import java.util.Arrays;
-import java.util.List;
-
-import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
-import com.metamatrix.connector.jdbc.translator.DropFunctionModifier;
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.ILanguageFactory;
-import com.metamatrix.connector.language.ILiteral;
-import com.metamatrix.connector.language.ICompareCriteria.Operator;
-
-
-/** 
- * @since 4.3
- */
-class MySQLConvertModifier extends BasicFunctionModifier {
-    
-    private static DropFunctionModifier DROP_MODIFIER = new DropFunctionModifier();
-    
-    private ILanguageFactory langFactory;
-    
-    MySQLConvertModifier(ILanguageFactory langFactory) {
-        this.langFactory = langFactory;
-    }
-
-    public List translate(IFunction function) {
-        return null;
-    }
-
-    public IExpression modify(IFunction function) {
-        IExpression[] args = function.getParameters();
-
-        if (args[0] != null && args[0] instanceof ILiteral && ((ILiteral)args[0]).getValue() == null ) {
-            if (args[1] != null && args[1] instanceof ILiteral) {
-                // This is a convert(null, ...) or cast(null as ...)
-                return DROP_MODIFIER.modify(function);
-            }
-        } 
-        
-        if (args[1] != null && args[1] instanceof ILiteral) {
-            String target = ((String)((ILiteral)args[1]).getValue()).toLowerCase();
-            if (target.equals("string")) {  //$NON-NLS-1$ 
-                return convertToString(function);
-            } else if (target.equals("byte") || //$NON-NLS-1$
-                       target.equals("short") || //$NON-NLS-1$
-                       target.equals("integer")) {  //$NON-NLS-1$ 
-                return convertToNativeType(function, "SIGNED INTEGER"); //$NON-NLS-1$
-            } else if (target.equals("long") || //$NON-NLS-1$
-                       target.equals("biginteger")) { //$NON-NLS-1$ 
-                return convertToNativeType(function, "SIGNED"); //$NON-NLS-1$
-            } else if (target.equals("float") || //$NON-NLS-1$
-                       target.equals("double") || //$NON-NLS-1$
-                       target.equals("bigdecimal")) { //$NON-NLS-1$ 
-                return convertToNumeric(function); 
-            } else if (target.equals("date")) { //$NON-NLS-1$ 
-                return convertToDateTime("DATE", args[0], java.sql.Date.class); //$NON-NLS-1$
-            } else if (target.equals("time")) { //$NON-NLS-1$ 
-                return convertToDateTime("TIME", args[0], java.sql.Time.class); //$NON-NLS-1$
-            } else if (target.equals("timestamp")) { //$NON-NLS-1$ 
-                return convertToDateTime("TIMESTAMP", args[0], java.sql.Timestamp.class); //$NON-NLS-1$
-            } else if (target.equals("char")) { //$NON-NLS-1$ 
-                return convertToNativeType(function, "CHAR (1)"); //$NON-NLS-1$
-            } else if (target.equals("boolean")) {  //$NON-NLS-1$ 
-                return convertToBoolean(function);
-            }
-        }
-        return DROP_MODIFIER.modify(function); 
-    }
-    
-    private IExpression convertToString(IFunction function) {
-        int srcCode = getSrcCode(function);
-        switch(srcCode) {
-            case BOOLEAN:
-                // convert(booleanSrc, string) --> CASE WHEN booleanSrc THEN '1' ELSE '0' END
-                List when = Arrays.asList(langFactory.createCompareCriteria(Operator.EQ, function.getParameters()[0], langFactory.createLiteral(Boolean.TRUE, Boolean.class)));
-                List then = Arrays.asList(new IExpression[] {langFactory.createLiteral("1", String.class)}); //$NON-NLS-1$
-                IExpression elseExpr = langFactory.createLiteral("0", String.class); //$NON-NLS-1$
-                return langFactory.createSearchedCaseExpression(when, then, elseExpr, String.class);
-            case BYTE:
-            case SHORT:
-            case INTEGER:
-            case LONG:
-            case BIGINTEGER:
-            case FLOAT:
-            case DOUBLE:
-            case BIGDECIMAL:
-                // convert(src, string) --> convert(src, CHAR)
-                return convertToNativeType(function, "CHAR"); //$NON-NLS-1$
-            case DATE:
-                // convert (dateSrc, string) --> date_format(dateSrc, '%Y-%m-%d')
-                return convertDateTimeToString(function, "%Y-%m-%d"); //$NON-NLS-1$
-            case TIME:
-                // convert (timeSrc, string) --> date_format(timeSrc, '%H:%i:%S')
-                return convertDateTimeToString(function, "%H:%i:%S"); //$NON-NLS-1$
-            case TIMESTAMP:    
-                // convert (tsSrc, string) --> date_format(tsSrc, '%Y-%m-%d %H:%i:%S.%f')
-                return convertDateTimeToString(function, "%Y-%m-%d %H:%i:%S.%f"); //$NON-NLS-1$
-            default:
-                return DROP_MODIFIER.modify(function);
-        }
-    }
-    
-    private IExpression convertToNativeType(IFunction function, String targetType) {
-        IExpression[] args = function.getParameters();
-        function.setName("convert"); //$NON-NLS-1$
-        args[1] = langFactory.createLiteral(targetType, String.class);
-        function.setParameters(args);
-        return function;
-    }
-    
-    /**
-     * In version 5.1 and after, we can simple use convert(x, DECIMAL), but for backward compatibility we must do (x + 0.0)
-     * @param function
-     * @return
-     * @since 4.3
-     */
-    private IExpression convertToNumeric(IFunction function) {
-        // convert(x, float/double/bigdecimal) --> (x + 0.0)
-        return langFactory.createFunction("+", //$NON-NLS-1$
-                                          new IExpression[] {function.getParameters()[0],
-                                                             langFactory.createLiteral(new Double(0.0), Double.class)},
-                                          Double.class);
-    }
-    
-    private IExpression convertToDateTime(String functionName, IExpression value, Class targetType) {
-        return langFactory.createFunction(functionName,
-                                           new IExpression[] {value},
-                                           targetType);
-    }
-    
-    private IExpression convertToBoolean(IFunction function) {
-        int srcCode = getSrcCode(function);
-        switch(srcCode) {
-            case STRING:
-                // convert(src, boolean) --> CASE src WHEN 'true' THEN 1 ELSE 0 END
-                // convert(booleanSrc, string) --> CASE WHEN booleanSrc THEN '1' ELSE '0' END
-                List when = Arrays.asList(langFactory.createCompareCriteria(Operator.EQ, function.getParameters()[0], langFactory.createLiteral("true", String.class)));
-                List then = Arrays.asList(new IExpression[] {langFactory.createLiteral(Integer.valueOf(1), Integer.class)}); //$NON-NLS-1$
-                IExpression elseExpr = langFactory.createLiteral(Integer.valueOf(0), Integer.class); //$NON-NLS-1$
-                return langFactory.createSearchedCaseExpression(when, then, elseExpr, String.class);
-            default:
-                return DROP_MODIFIER.modify(function);
-        }
-    }
-    
-    private IFunction convertDateTimeToString(IFunction function, String format) {
-        // convert (date, string) --> date_format(date, format)
-        IExpression[] args = function.getParameters();
-        function.setName("date_format"); //$NON-NLS-1$
-        args[1] = langFactory.createLiteral(format, String.class); 
-        function.setParameters(args);
-        return function;
-    }
-    
-    private int getSrcCode(IFunction function) {
-        IExpression[] args = function.getParameters();
-        Class srcType = args[0].getType();
-        return ((Integer) typeMap.get(srcType)).intValue();
-    }         
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLConvertModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/mysql/MySQLConvertModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLConvertModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLConvertModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,185 @@
+/*
+ * 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.mysql;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.connector.jdbc.translator.BasicFunctionModifier;
+import org.teiid.connector.jdbc.translator.DropFunctionModifier;
+
+import com.metamatrix.connector.language.ICompareCriteria;
+import com.metamatrix.connector.language.ICriteria;
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageFactory;
+import com.metamatrix.connector.language.ILiteral;
+import com.metamatrix.connector.language.ICompareCriteria.Operator;
+
+
+/** 
+ * @since 4.3
+ */
+class MySQLConvertModifier extends BasicFunctionModifier {
+    
+    private static DropFunctionModifier DROP_MODIFIER = new DropFunctionModifier();
+    
+    private ILanguageFactory langFactory;
+    
+    MySQLConvertModifier(ILanguageFactory langFactory) {
+        this.langFactory = langFactory;
+    }
+
+    public List translate(IFunction function) {
+        return null;
+    }
+
+    public IExpression modify(IFunction function) {
+        List<IExpression> args = function.getParameters();
+
+        if (args.get(0) != null && args.get(0) instanceof ILiteral && ((ILiteral)args.get(0)).getValue() == null ) {
+            if (args.get(1) != null && args.get(1) instanceof ILiteral) {
+                // This is a convert(null, ...) or cast(null as ...)
+                return DROP_MODIFIER.modify(function);
+            }
+        } 
+        
+        if (args.get(1) != null && args.get(1) instanceof ILiteral) {
+            String target = ((String)((ILiteral)args.get(1)).getValue()).toLowerCase();
+            if (target.equals("string")) {  //$NON-NLS-1$ 
+                return convertToString(function);
+            } else if (target.equals("byte") || //$NON-NLS-1$
+                       target.equals("short") || //$NON-NLS-1$
+                       target.equals("integer")) {  //$NON-NLS-1$ 
+                return convertToNativeType(function, "SIGNED INTEGER"); //$NON-NLS-1$
+            } else if (target.equals("long") || //$NON-NLS-1$
+                       target.equals("biginteger")) { //$NON-NLS-1$ 
+                return convertToNativeType(function, "SIGNED"); //$NON-NLS-1$
+            } else if (target.equals("float") || //$NON-NLS-1$
+                       target.equals("double") || //$NON-NLS-1$
+                       target.equals("bigdecimal")) { //$NON-NLS-1$ 
+                return convertToNumeric(function); 
+            } else if (target.equals("date")) { //$NON-NLS-1$ 
+                return convertToDateTime("DATE", args.get(0), java.sql.Date.class); //$NON-NLS-1$
+            } else if (target.equals("time")) { //$NON-NLS-1$ 
+                return convertToDateTime("TIME", args.get(0), java.sql.Time.class); //$NON-NLS-1$
+            } else if (target.equals("timestamp")) { //$NON-NLS-1$ 
+                return convertToDateTime("TIMESTAMP", args.get(0), java.sql.Timestamp.class); //$NON-NLS-1$
+            } else if (target.equals("char")) { //$NON-NLS-1$ 
+                return convertToNativeType(function, "CHAR (1)"); //$NON-NLS-1$
+            } else if (target.equals("boolean")) {  //$NON-NLS-1$ 
+                return convertToBoolean(function);
+            }
+        }
+        return DROP_MODIFIER.modify(function); 
+    }
+    
+    private IExpression convertToString(IFunction function) {
+        int srcCode = getSrcCode(function);
+        switch(srcCode) {
+            case BOOLEAN:
+                // convert(booleanSrc, string) --> CASE WHEN booleanSrc THEN '1' ELSE '0' END
+                List<ICompareCriteria> when = Arrays.asList(langFactory.createCompareCriteria(Operator.EQ, function.getParameters().get(0), langFactory.createLiteral(Boolean.TRUE, Boolean.class)));
+                List<ILiteral> then = Arrays.asList(langFactory.createLiteral("1", String.class)); //$NON-NLS-1$
+                IExpression elseExpr = langFactory.createLiteral("0", String.class); //$NON-NLS-1$
+                return langFactory.createSearchedCaseExpression(when, then, elseExpr, String.class);
+            case BYTE:
+            case SHORT:
+            case INTEGER:
+            case LONG:
+            case BIGINTEGER:
+            case FLOAT:
+            case DOUBLE:
+            case BIGDECIMAL:
+                // convert(src, string) --> convert(src, CHAR)
+                return convertToNativeType(function, "CHAR"); //$NON-NLS-1$
+            case DATE:
+                // convert (dateSrc, string) --> date_format(dateSrc, '%Y-%m-%d')
+                return convertDateTimeToString(function, "%Y-%m-%d"); //$NON-NLS-1$
+            case TIME:
+                // convert (timeSrc, string) --> date_format(timeSrc, '%H:%i:%S')
+                return convertDateTimeToString(function, "%H:%i:%S"); //$NON-NLS-1$
+            case TIMESTAMP:    
+                // convert (tsSrc, string) --> date_format(tsSrc, '%Y-%m-%d %H:%i:%S.%f')
+                return convertDateTimeToString(function, "%Y-%m-%d %H:%i:%S.%f"); //$NON-NLS-1$
+            default:
+                return DROP_MODIFIER.modify(function);
+        }
+    }
+    
+    private IExpression convertToNativeType(IFunction function, String targetType) {
+        List<IExpression> args = function.getParameters();
+        function.setName("convert"); //$NON-NLS-1$
+        args.set(1, langFactory.createLiteral(targetType, String.class));
+        return function;
+    }
+    
+    /**
+     * In version 5.1 and after, we can simple use convert(x, DECIMAL), but for backward compatibility we must do (x + 0.0)
+     * @param function
+     * @return
+     * @since 4.3
+     */
+    private IExpression convertToNumeric(IFunction function) {
+        // convert(x, float/double/bigdecimal) --> (x + 0.0)
+        return langFactory.createFunction("+", //$NON-NLS-1$
+                                          Arrays.asList(function.getParameters().get(0),
+                                                             langFactory.createLiteral(new Double(0.0), Double.class)),
+                                          Double.class);
+    }
+    
+    private IExpression convertToDateTime(String functionName, IExpression value, Class targetType) {
+        return langFactory.createFunction(functionName,
+                                           Arrays.asList(value),
+                                           targetType);
+    }
+    
+    private IExpression convertToBoolean(IFunction function) {
+        int srcCode = getSrcCode(function);
+        switch(srcCode) {
+            case STRING:
+                // convert(src, boolean) --> CASE src WHEN 'true' THEN 1 ELSE 0 END
+                // convert(booleanSrc, string) --> CASE WHEN booleanSrc THEN '1' ELSE '0' END
+                List<ICompareCriteria> when = Arrays.asList(langFactory.createCompareCriteria(Operator.EQ, function.getParameters().get(0), langFactory.createLiteral("true", String.class)));
+                List<ILiteral> then = Arrays.asList(langFactory.createLiteral(Integer.valueOf(1), Integer.class)); //$NON-NLS-1$
+                IExpression elseExpr = langFactory.createLiteral(Integer.valueOf(0), Integer.class); //$NON-NLS-1$
+                return langFactory.createSearchedCaseExpression(when, then, elseExpr, String.class);
+            default:
+                return DROP_MODIFIER.modify(function);
+        }
+    }
+    
+    private IFunction convertDateTimeToString(IFunction function, String format) {
+        // convert (date, string) --> date_format(date, format)
+        List<IExpression> args = function.getParameters();
+        function.setName("date_format"); //$NON-NLS-1$
+        args.set(1, langFactory.createLiteral(format, String.class)); 
+        return function;
+    }
+    
+    private int getSrcCode(IFunction function) {
+        List<IExpression> args = function.getParameters();
+        Class srcType = args.get(0).getType();
+        return ((Integer) typeMap.get(srcType)).intValue();
+    }         
+}

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/mysql/MySQLTranslator.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLTranslator.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -20,7 +20,7 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.jdbc.mysql;
+package org.teiid.connector.jdbc.mysql;
 
 import java.sql.Connection;
 import java.sql.Date;
@@ -29,10 +29,11 @@
 import java.sql.Time;
 import java.sql.Timestamp;
 
+import org.teiid.connector.jdbc.translator.Translator;
+
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.SourceSystemFunctions;
-import com.metamatrix.connector.jdbc.translator.Translator;
 
 
 /** 

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle)


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/ConcatFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/ConcatFunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/ConcatFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,119 +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.jdbc.oracle;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
-import com.metamatrix.connector.language.ICriteria;
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.ILanguageFactory;
-import com.metamatrix.connector.language.ILiteral;
-import com.metamatrix.connector.language.ICompoundCriteria.Operator;
-
-
-/**
- * This Function modifier used to support ANSI concat on Oracle 9i.
- * TODO: this is no longer necessary on Oracle 10g and later. 
- * <code>
- * CONCAT(a, b) ==> CASE WHEN (a is NULL OR b is NULL) THEN NULL ELSE CONCAT(a, b)
- * </code>   
- */
-public class ConcatFunctionModifier extends BasicFunctionModifier {
-    private ILanguageFactory langFactory;
-    
-    /** 
-     * @param langFactory
-     */
-    public ConcatFunctionModifier(ILanguageFactory langFactory) {
-        this.langFactory = langFactory;
-    }
-
-    /** 
-     * @see com.metamatrix.connector.jdbc.translator.BasicFunctionModifier#modify(com.metamatrix.connector.language.IFunction)
-     */
-    public IExpression modify(IFunction function) {
-        List when = new ArrayList();
-        IExpression a = function.getParameters()[0];
-        IExpression b = function.getParameters()[1];
-        List crits = new ArrayList();
-        
-        ILiteral nullValue = langFactory.createLiteral(null, TypeFacility.RUNTIME_TYPES.STRING);
-        if (isNull(a)) {
-        	return nullValue;
-        } else if (!isNotNull(a)) {
-        	crits.add(langFactory.createIsNullCriteria(a, false));
-        }
-        if (isNull(b)) {
-        	return nullValue;
-        } else if (!isNotNull(b)) {
-        	crits.add(langFactory.createIsNullCriteria(b, false));
-        }
-        
-        ICriteria crit = null;
-        
-        if (crits.isEmpty()) {
-        	return function;
-        } else if (crits.size() == 1) {
-        	crit = (ICriteria)crits.get(0);
-        } else {
-        	crit = langFactory.createCompoundCriteria(Operator.OR, crits);
-        }
-        when.add(crit);
-        List then = Arrays.asList(new IExpression[] {nullValue}); 
-        return langFactory.createSearchedCaseExpression(when, then, function, TypeFacility.RUNTIME_TYPES.STRING);
-    }
-    
-    private boolean isNotNull(IExpression expr) {
-    	if (expr instanceof ILiteral) {
-    		ILiteral literal = (ILiteral)expr;
-    		return literal.getValue() != null;
-    	}
-    	if (expr instanceof IFunction) {
-    		IFunction function = (IFunction)expr;
-    		if (function.getName().equalsIgnoreCase("NVL") || function.getName().equalsIgnoreCase("IFNULL")) { //$NON-NLS-1$ //$NON-NLS-2$
-    			return isNotNull(function.getParameters()[1]);
-    		}
-    	}
-    	return false;
-    }
-    
-    private boolean isNull(IExpression expr) {
-    	if (expr instanceof ILiteral) {
-    		ILiteral literal = (ILiteral)expr;
-    		return literal.getValue() == null;
-    	}
-    	return false;
-    }
-        
-    /** 
-     * @see com.metamatrix.connector.jdbc.translator.BasicFunctionModifier#translate(com.metamatrix.connector.language.IFunction)
-     */
-    public List translate(IFunction function) {
-        return null; //allow default translation
-    }
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/ConcatFunctionModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/ConcatFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/ConcatFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/ConcatFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,121 @@
+/*
+ * 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.oracle;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.connector.jdbc.translator.BasicFunctionModifier;
+
+import com.metamatrix.connector.api.SourceSystemFunctions;
+import com.metamatrix.connector.api.TypeFacility;
+import com.metamatrix.connector.language.ICriteria;
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageFactory;
+import com.metamatrix.connector.language.ILiteral;
+import com.metamatrix.connector.language.ICompoundCriteria.Operator;
+
+
+/**
+ * This Function modifier used to support ANSI concat on Oracle 9i.
+ * TODO: this is no longer necessary on Oracle 10g and later. 
+ * <code>
+ * CONCAT(a, b) ==> CASE WHEN (a is NULL OR b is NULL) THEN NULL ELSE CONCAT(a, b)
+ * </code>   
+ */
+public class ConcatFunctionModifier extends BasicFunctionModifier {
+    private ILanguageFactory langFactory;
+    
+    /** 
+     * @param langFactory
+     */
+    public ConcatFunctionModifier(ILanguageFactory langFactory) {
+        this.langFactory = langFactory;
+    }
+
+    /** 
+     * @see org.teiid.connector.jdbc.translator.BasicFunctionModifier#modify(com.metamatrix.connector.language.IFunction)
+     */
+    public IExpression modify(IFunction function) {
+        List when = new ArrayList();
+        IExpression a = function.getParameters().get(0);
+        IExpression b = function.getParameters().get(1);
+        List crits = new ArrayList();
+        
+        ILiteral nullValue = langFactory.createLiteral(null, TypeFacility.RUNTIME_TYPES.STRING);
+        if (isNull(a)) {
+        	return nullValue;
+        } else if (!isNotNull(a)) {
+        	crits.add(langFactory.createIsNullCriteria(a, false));
+        }
+        if (isNull(b)) {
+        	return nullValue;
+        } else if (!isNotNull(b)) {
+        	crits.add(langFactory.createIsNullCriteria(b, false));
+        }
+        
+        ICriteria crit = null;
+        
+        if (crits.isEmpty()) {
+        	return function;
+        } else if (crits.size() == 1) {
+        	crit = (ICriteria)crits.get(0);
+        } else {
+        	crit = langFactory.createCompoundCriteria(Operator.OR, crits);
+        }
+        when.add(crit);
+        List then = Arrays.asList(new IExpression[] {nullValue}); 
+        return langFactory.createSearchedCaseExpression(when, then, function, TypeFacility.RUNTIME_TYPES.STRING);
+    }
+    
+    private boolean isNotNull(IExpression expr) {
+    	if (expr instanceof ILiteral) {
+    		ILiteral literal = (ILiteral)expr;
+    		return literal.getValue() != null;
+    	}
+    	if (expr instanceof IFunction) {
+    		IFunction function = (IFunction)expr;
+    		if (function.getName().equalsIgnoreCase("NVL") || function.getName().equalsIgnoreCase(SourceSystemFunctions.IFNULL)) { //$NON-NLS-1$
+    			return isNotNull(function.getParameters().get(0));
+    		}
+    	}
+    	return false;
+    }
+    
+    private boolean isNull(IExpression expr) {
+    	if (expr instanceof ILiteral) {
+    		ILiteral literal = (ILiteral)expr;
+    		return literal.getValue() == null;
+    	}
+    	return false;
+    }
+        
+    /** 
+     * @see org.teiid.connector.jdbc.translator.BasicFunctionModifier#translate(com.metamatrix.connector.language.IFunction)
+     */
+    public List translate(IFunction function) {
+        return null; //allow default translation
+    }
+}

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/DayWeekQuarterFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/DayWeekQuarterFunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/DayWeekQuarterFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,65 +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.jdbc.oracle;
-
-import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
-import com.metamatrix.connector.jdbc.translator.FunctionModifier;
-import com.metamatrix.connector.language.*;
-
-/**
- * This a method for multiple use. It can be used for:
- * 1) dayofyear
- * 2) dayofmonth
- * 3) dayofweek
- * 4) week
- * 5) quarter
- */
-public class DayWeekQuarterFunctionModifier extends BasicFunctionModifier implements FunctionModifier {
-    private ILanguageFactory langFactory;
-    private String format;
-    
-    public DayWeekQuarterFunctionModifier(ILanguageFactory langFactory, String format) {
-        this.langFactory = langFactory;
-        this.format = format;
-    }
-    
-    /* 
-     * @see com.metamatrix.connector.jdbc.extension.FunctionModifier#modify(com.metamatrix.data.language.IFunction)
-     */
-    public IExpression modify(IFunction function) {
-        IExpression[] args = function.getParameters();
-
-        IFunction inner = langFactory.createFunction("TO_CHAR",  //$NON-NLS-1$
-            new IExpression[] { 
-                args[0], 
-                langFactory.createLiteral(format, String.class)},  
-                String.class);
-            
-        IFunction outer = langFactory.createFunction("TO_NUMBER",  //$NON-NLS-1$
-            new IExpression[] {inner},  
-                Integer.class);
-                                
-        return outer;    
-    }
-}
-

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/DayWeekQuarterFunctionModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/DayWeekQuarterFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/DayWeekQuarterFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/DayWeekQuarterFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,69 @@
+/*
+ * 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.oracle;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.connector.jdbc.translator.BasicFunctionModifier;
+import org.teiid.connector.jdbc.translator.FunctionModifier;
+
+import com.metamatrix.connector.language.*;
+
+/**
+ * This a method for multiple use. It can be used for:
+ * 1) dayofyear
+ * 2) dayofmonth
+ * 3) dayofweek
+ * 4) week
+ * 5) quarter
+ */
+public class DayWeekQuarterFunctionModifier extends BasicFunctionModifier implements FunctionModifier {
+    private ILanguageFactory langFactory;
+    private String format;
+    
+    public DayWeekQuarterFunctionModifier(ILanguageFactory langFactory, String format) {
+        this.langFactory = langFactory;
+        this.format = format;
+    }
+    
+    /* 
+     * @see com.metamatrix.connector.jdbc.extension.FunctionModifier#modify(com.metamatrix.data.language.IFunction)
+     */
+    public IExpression modify(IFunction function) {
+        List<IExpression> args = function.getParameters();
+
+        IFunction inner = langFactory.createFunction("TO_CHAR",  //$NON-NLS-1$
+            Arrays.asList( 
+                args.get(0), 
+                langFactory.createLiteral(format, String.class)),  
+                String.class);
+            
+        IFunction outer = langFactory.createFunction("TO_NUMBER",  //$NON-NLS-1$
+            Arrays.asList(inner),  
+                Integer.class);
+                                
+        return outer;    
+    }
+}
+

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/ExtractFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/ExtractFunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/ExtractFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,62 +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.jdbc.oracle;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
-import com.metamatrix.connector.jdbc.translator.FunctionModifier;
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-
-/**
- * Convert the YEAR/MONTH/DAY etc. function into an equivalent Oracle function.  
- * Format: EXTRACT(YEAR from Element) or EXTRACT(YEAR from DATE '2004-03-03')
- */
-public class ExtractFunctionModifier extends BasicFunctionModifier implements FunctionModifier {
-    public static final String SPACE = " ";  //$NON-NLS-1$
-    
-    private String target;
-    
-    public ExtractFunctionModifier(String target) {
-        this.target = target;
-    }
-    
-    public List translate(IFunction function) {
-        StringBuffer buffer = new StringBuffer();
-        IExpression[] args = function.getParameters();
-        
-        List objs = new ArrayList();
-        buffer.append("EXTRACT("); //$NON-NLS-1$
-        buffer.append(target);
-        buffer.append(SPACE);
-        buffer.append("FROM"); //$NON-NLS-1$
-
-        buffer.append(SPACE);               
-        buffer.append(args[0]);
-        buffer.append(")"); //$NON-NLS-1$
-        objs.add(buffer.toString());
-        return objs;
-    }    
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/ExtractFunctionModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/ExtractFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/ExtractFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/ExtractFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,63 @@
+/*
+ * 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.oracle;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.teiid.connector.jdbc.translator.BasicFunctionModifier;
+import org.teiid.connector.jdbc.translator.FunctionModifier;
+
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+
+/**
+ * Convert the YEAR/MONTH/DAY etc. function into an equivalent Oracle function.  
+ * Format: EXTRACT(YEAR from Element) or EXTRACT(YEAR from DATE '2004-03-03')
+ */
+public class ExtractFunctionModifier extends BasicFunctionModifier implements FunctionModifier {
+    public static final String SPACE = " ";  //$NON-NLS-1$
+    
+    private String target;
+    
+    public ExtractFunctionModifier(String target) {
+        this.target = target;
+    }
+    
+    public List translate(IFunction function) {
+        StringBuffer buffer = new StringBuffer();
+        List<IExpression> args = function.getParameters();
+        
+        List objs = new ArrayList();
+        buffer.append("EXTRACT("); //$NON-NLS-1$
+        buffer.append(target);
+        buffer.append(SPACE);
+        buffer.append("FROM"); //$NON-NLS-1$
+
+        buffer.append(SPACE);               
+        buffer.append(args.get(0));
+        buffer.append(")"); //$NON-NLS-1$
+        objs.add(buffer.toString());
+        return objs;
+    }    
+}

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/LeftOrRightFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/LeftOrRightFunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/LeftOrRightFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,69 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.connector.jdbc.oracle;
-
-import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
-import com.metamatrix.connector.jdbc.translator.FunctionModifier;
-import com.metamatrix.connector.language.*;
-
-/**
- * Convert left(string, count) --> substr(string, 1, count)
- * or right(string, count) --> substr(string, -1 * count) - we lack a way to express a unary negation
- */
-public class LeftOrRightFunctionModifier extends BasicFunctionModifier implements FunctionModifier {
-    private ILanguageFactory langFactory;
-    
-    public LeftOrRightFunctionModifier(ILanguageFactory langFactory) {
-        this.langFactory = langFactory;
-    }
-    
-    /* 
-     * @see com.metamatrix.connector.jdbc.extension.FunctionModifier#modify(com.metamatrix.data.language.IFunction)
-     */
-    public IExpression modify(IFunction function) {
-        IExpression[] args = function.getParameters();
-        IFunction func = null;
-        
-        if (function.getName().equalsIgnoreCase("left")) { //$NON-NLS-1$
-            func = langFactory.createFunction("SUBSTR",  //$NON-NLS-1$
-                new IExpression[] {
-                    args[0], 
-                    langFactory.createLiteral(Integer.valueOf(1), TypeFacility.RUNTIME_TYPES.INTEGER),
-                    args[1]},
-                    String.class);   
-        } else if (function.getName().equalsIgnoreCase("right")) { //$NON-NLS-1$
-            IFunction negIndex = langFactory.createFunction("*",  //$NON-NLS-1$
-                new IExpression[] {langFactory.createLiteral(Integer.valueOf(-1), TypeFacility.RUNTIME_TYPES.INTEGER), args[1]},
-                Integer.class);
-                            
-            func = langFactory.createFunction("SUBSTR",  //$NON-NLS-1$
-                new IExpression[] {
-                    args[0], 
-                    negIndex},
-                    String.class);      
-        }
-
-        return func;    
-    }
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/LeftOrRightFunctionModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/LeftOrRightFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/LeftOrRightFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/LeftOrRightFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,73 @@
+/*
+ * 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.oracle;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.connector.jdbc.translator.BasicFunctionModifier;
+import org.teiid.connector.jdbc.translator.FunctionModifier;
+
+import com.metamatrix.connector.api.TypeFacility;
+import com.metamatrix.connector.language.*;
+
+/**
+ * Convert left(string, count) --> substr(string, 1, count)
+ * or right(string, count) --> substr(string, -1 * count) - we lack a way to express a unary negation
+ */
+public class LeftOrRightFunctionModifier extends BasicFunctionModifier implements FunctionModifier {
+    private ILanguageFactory langFactory;
+    
+    public LeftOrRightFunctionModifier(ILanguageFactory langFactory) {
+        this.langFactory = langFactory;
+    }
+    
+    /* 
+     * @see com.metamatrix.connector.jdbc.extension.FunctionModifier#modify(com.metamatrix.data.language.IFunction)
+     */
+    public IExpression modify(IFunction function) {
+        List<IExpression> args = function.getParameters();
+        IFunction func = null;
+        
+        if (function.getName().equalsIgnoreCase("left")) { //$NON-NLS-1$
+            func = langFactory.createFunction("SUBSTR",  //$NON-NLS-1$
+                Arrays.asList(
+                    args.get(0), 
+                    langFactory.createLiteral(Integer.valueOf(1), TypeFacility.RUNTIME_TYPES.INTEGER),
+                    args.get(1)),
+                    String.class);   
+        } else if (function.getName().equalsIgnoreCase("right")) { //$NON-NLS-1$
+            IFunction negIndex = langFactory.createFunction("*",  //$NON-NLS-1$
+                Arrays.asList(langFactory.createLiteral(Integer.valueOf(-1), TypeFacility.RUNTIME_TYPES.INTEGER), args.get(1)),
+                Integer.class);
+                            
+            func = langFactory.createFunction("SUBSTR",  //$NON-NLS-1$
+                Arrays.asList(
+                    args.get(0), 
+                    negIndex),
+                    String.class);      
+        }
+
+        return func;    
+    }
+}

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/LocateFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/LocateFunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/LocateFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,77 +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.jdbc.oracle;
-
-import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
-import com.metamatrix.connector.jdbc.translator.FunctionModifier;
-import com.metamatrix.connector.language.*;
-
-/**
- * Modify the locate function to use the Oracle instr function.
- * 
- * locate(sub, str) -> instr(str, sub)
- * 
- * locate(sub, str, start) -> instr(str, sub, start+1)
- */
-public class LocateFunctionModifier extends BasicFunctionModifier implements FunctionModifier {
-
-    private ILanguageFactory langFactory;
-    
-    public LocateFunctionModifier(ILanguageFactory langFactory) {
-        this.langFactory = langFactory;
-    }
-
-    /* 
-     * @see com.metamatrix.connector.jdbc.extension.FunctionModifier#modify(com.metamatrix.data.language.IFunction)
-     */
-    public IExpression modify(IFunction function) {
-        IExpression[] args = function.getParameters();     
-        IExpression[] instrArgs = new IExpression[args.length];
-        instrArgs[0] = args[1];
-        instrArgs[1] = args[0];
-        
-        if(args.length == 3) {
-            if(args[2] instanceof ILiteral) {
-                ILiteral indexConst = (ILiteral)args[2];
-                if(indexConst.getValue() == null) {
-                    instrArgs[2] = args[2];
-                } else {
-                    // Just modify the constant
-                    Integer index = (Integer) ((ILiteral)args[2]).getValue();
-                    instrArgs[2] = langFactory.createLiteral(new Integer(index.intValue()+1), Integer.class);
-                }
-            } else {
-                // Make plus function since this involves an element or function
-                IFunction plusFunction = langFactory.createFunction("+",  //$NON-NLS-1$
-                    new IExpression[] { args[2], langFactory.createLiteral(new Integer(1), Integer.class) },
-                    Integer.class);
-                instrArgs[2] = plusFunction;
-            }   
-        }
-                
-        IFunction instrFunction = langFactory.createFunction("instr", instrArgs, Integer.class); //$NON-NLS-1$
-        
-        return instrFunction;           
-    }
-
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/LocateFunctionModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/LocateFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/LocateFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/LocateFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,79 @@
+/*
+ * 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.oracle;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.connector.jdbc.translator.BasicFunctionModifier;
+import org.teiid.connector.jdbc.translator.FunctionModifier;
+
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageFactory;
+import com.metamatrix.connector.language.ILiteral;
+
+/**
+ * Modify the locate function to use the Oracle instr function.
+ * 
+ * locate(sub, str) -> instr(str, sub)
+ * 
+ * locate(sub, str, start) -> instr(str, sub, start+1)
+ */
+public class LocateFunctionModifier extends BasicFunctionModifier implements FunctionModifier {
+
+    private ILanguageFactory langFactory;
+    
+    public LocateFunctionModifier(ILanguageFactory langFactory) {
+        this.langFactory = langFactory;
+    }
+
+    /* 
+     * @see com.metamatrix.connector.jdbc.extension.FunctionModifier#modify(com.metamatrix.data.language.IFunction)
+     */
+    public IExpression modify(IFunction function) {
+    	function.setName("instr"); //$NON-NLS-1$
+        List<IExpression> args = function.getParameters();    
+        IExpression expr = args.get(0);
+        args.set(0, args.get(1));
+        args.set(1, expr);
+        if(args.size() == 3) {
+            if(args.get(2) instanceof ILiteral) {
+                ILiteral indexConst = (ILiteral)args.get(2);
+                if(indexConst.getValue() != null) {
+                    // Just modify the constant
+                    Integer index = (Integer) indexConst.getValue();
+                    args.set(2, langFactory.createLiteral(new Integer(index.intValue()+1), Integer.class));
+                }
+            } else {
+                // Make plus function since this involves an element or function
+                IFunction plusFunction = langFactory.createFunction("+",  //$NON-NLS-1$
+                    Arrays.asList( args.get(2), langFactory.createLiteral(new Integer(1), Integer.class) ),
+                    Integer.class);
+                args.set(2, plusFunction);
+            }   
+        }        
+        return function;           
+    }
+
+}

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/Log10FunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/Log10FunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/Log10FunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,49 +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.jdbc.oracle;
-
-import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
-import com.metamatrix.connector.jdbc.translator.FunctionModifier;
-import com.metamatrix.connector.language.*;
-
-public class Log10FunctionModifier extends BasicFunctionModifier implements FunctionModifier {
-    
-    private ILanguageFactory languageFactory;
-
-    public Log10FunctionModifier(ILanguageFactory languageFactory) {
-        this.languageFactory = languageFactory;
-    }
-
-    public IExpression modify(IFunction function) {
-        function.setName("log"); //$NON-NLS-1$
-        
-        IExpression[] args = function.getParameters();
-        IExpression[] newArgs = new IExpression[args.length+1];
-        newArgs[1] = args[0];
-        newArgs[0] = languageFactory.createLiteral(new Integer(10), Integer.class);
-        function.setParameters(newArgs); 
-        
-        return function;
-    }
-
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/Log10FunctionModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/Log10FunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/Log10FunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/Log10FunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,49 @@
+/*
+ * 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.oracle;
+
+import java.util.List;
+
+import org.teiid.connector.jdbc.translator.BasicFunctionModifier;
+import org.teiid.connector.jdbc.translator.FunctionModifier;
+
+import com.metamatrix.connector.language.*;
+
+public class Log10FunctionModifier extends BasicFunctionModifier implements FunctionModifier {
+    
+    private ILanguageFactory languageFactory;
+
+    public Log10FunctionModifier(ILanguageFactory languageFactory) {
+        this.languageFactory = languageFactory;
+    }
+
+    public IExpression modify(IFunction function) {
+        function.setName("log"); //$NON-NLS-1$
+        
+        List<IExpression> args = function.getParameters();
+        args.add(args.get(0));
+        args.set(0, languageFactory.createLiteral(new Integer(10), Integer.class));
+        return function;
+    }
+
+}

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/MonthOrDayNameFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/MonthOrDayNameFunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/MonthOrDayNameFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,60 +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.jdbc.oracle;
-
-import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
-import com.metamatrix.connector.jdbc.translator.FunctionModifier;
-import com.metamatrix.connector.language.*;
-
-/**
- * Convert the MONTHNAME etc. function into an equivalent Oracle function.  
- * Format: to_char(timestampvalue/dayvalue, 'Month'/'Day') 
- */
-public class MonthOrDayNameFunctionModifier extends BasicFunctionModifier implements FunctionModifier {
-    private ILanguageFactory langFactory;
-    private String format;
-    
-    public MonthOrDayNameFunctionModifier(ILanguageFactory langFactory, String format) {
-        this.langFactory = langFactory;
-        this.format = format;
-    }
-    
-    /* 
-     * @see com.metamatrix.connector.jdbc.extension.FunctionModifier#modify(com.metamatrix.data.language.IFunction)
-     */
-    public IExpression modify(IFunction function) {
-        IExpression[] args = function.getParameters();
-    
-        IFunction func = langFactory.createFunction("TO_CHAR",  //$NON-NLS-1$
-            new IExpression[] { 
-                args[0], 
-                langFactory.createLiteral(format, String.class)},  
-            String.class);
-        
-        // For some reason, these values have trailing spaces
-        IFunction trimFunc = langFactory.createFunction("RTRIM",  //$NON-NLS-1$
-            new IExpression[] { func }, String.class);
-        
-        return trimFunc;    
-    }
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/MonthOrDayNameFunctionModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/MonthOrDayNameFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/MonthOrDayNameFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/MonthOrDayNameFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.connector.jdbc.oracle;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.connector.jdbc.translator.BasicFunctionModifier;
+import org.teiid.connector.jdbc.translator.FunctionModifier;
+
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageFactory;
+
+/**
+ * Convert the MONTHNAME etc. function into an equivalent Oracle function.  
+ * Format: to_char(timestampvalue/dayvalue, 'Month'/'Day') 
+ */
+public class MonthOrDayNameFunctionModifier extends BasicFunctionModifier implements FunctionModifier {
+    private ILanguageFactory langFactory;
+    private String format;
+    
+    public MonthOrDayNameFunctionModifier(ILanguageFactory langFactory, String format) {
+        this.langFactory = langFactory;
+        this.format = format;
+    }
+    
+    /* 
+     * @see com.metamatrix.connector.jdbc.extension.FunctionModifier#modify(com.metamatrix.data.language.IFunction)
+     */
+    public IExpression modify(IFunction function) {
+        List<IExpression> args = function.getParameters();
+    
+        IFunction func = langFactory.createFunction("TO_CHAR",  //$NON-NLS-1$
+            Arrays.asList( 
+                args.get(0), 
+                langFactory.createLiteral(format, String.class)),  
+            String.class);
+        
+        // For some reason, these values have trailing spaces
+        IFunction trimFunc = langFactory.createFunction("RTRIM",  //$NON-NLS-1$
+            Arrays.asList( func ), String.class);
+        
+        return trimFunc;    
+    }
+}

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleCapabilities.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleCapabilities.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleCapabilities.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -22,11 +22,12 @@
 
 /*
  */
-package com.metamatrix.connector.jdbc.oracle;
+package org.teiid.connector.jdbc.oracle;
 
 import java.util.*;
+
+import org.teiid.connector.jdbc.JDBCCapabilities;
 
-import com.metamatrix.connector.jdbc.JDBCCapabilities;
 
 /**
  */

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleConvertModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleConvertModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,541 +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.jdbc.oracle;
-
-import java.util.List;
-
-import com.metamatrix.connector.api.ConnectorLogger;
-import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
-import com.metamatrix.connector.jdbc.translator.DropFunctionModifier;
-import com.metamatrix.connector.jdbc.translator.FunctionModifier;
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.ILanguageFactory;
-import com.metamatrix.connector.language.ILiteral;
-
-/**
- */
-public class OracleConvertModifier extends BasicFunctionModifier implements FunctionModifier {     
-    private static DropFunctionModifier DROP_MODIFIER = new DropFunctionModifier();
-    private ILanguageFactory langFactory;
-    
-    public OracleConvertModifier(ILanguageFactory langFactory, ConnectorLogger logger) {
-        this.langFactory = langFactory;
-    }
-
-    /**
-     * Intentionally return null, rely on the SQLStringVisitor being used by caller
-     * (Oracle or Oracle8 SQLConversionVisitor (SQLConversionVisitor))
-     * @see com.metamatrix.connector.jdbc.translator.FunctionModifier#translate(com.metamatrix.connector.language.IFunction)
-     */
-    public List translate(IFunction function) {
-        return null;
-    }    
-    
-    public IExpression modify(IFunction function) {
-        IExpression[] args = function.getParameters();
-        IExpression modified = null;
-
-        String target = ((String)((ILiteral)args[1]).getValue()).toLowerCase();
-        if (target.equals("string")) {  //$NON-NLS-1$ 
-            modified = convertToString(function);
-        } else if (target.equals("short")) {  //$NON-NLS-1$ 
-            modified = convertToShort(function);
-        } else if (target.equals("integer")) { //$NON-NLS-1$ 
-            modified = convertToInteger(function);
-        } else if (target.equals("long")) { //$NON-NLS-1$ 
-            modified = convertToLong(function);
-        } else if (target.equals("biginteger")) { //$NON-NLS-1$ 
-            modified = convertToBigInteger(function);
-        } else if (target.equals("float")) { //$NON-NLS-1$ 
-            modified = convertToFloat(function);
-        } else if (target.equals("double")) { //$NON-NLS-1$ 
-            modified = convertToDouble(function);
-        } else if (target.equals("bigdecimal")) { //$NON-NLS-1$ 
-            modified = convertToBigDecimal(function);
-        } else if (target.equals("date")) { //$NON-NLS-1$ 
-            modified = convertToDate(function);
-        } else if (target.equals("time")) { //$NON-NLS-1$ 
-            modified = convertToTime(function);
-        } else if (target.equals("timestamp")) { //$NON-NLS-1$ 
-            modified = convertToTimestamp(function);
-        } else if (target.equals("char")) { //$NON-NLS-1$ 
-            modified = convertToChar(function);
-        } else if (target.equals("boolean")) {  //$NON-NLS-1$ 
-            modified = convertToBoolean(function);
-        } else if (target.equals("byte")) {  //$NON-NLS-1$ 
-            modified = convertToByte(function);
-        } else {
-            modified = DROP_MODIFIER.modify(function);          
-        }
-        return modified;
-    }
-    
-    private IExpression convertToDate(IFunction function) {
-        IExpression convert = null;
-        IExpression[] args = function.getParameters();
-        Class srcType = args[0].getType();
-        int srcCode = getSrcCode(srcType);
-
-        switch(srcCode) {
-            case STRING:
-                // convert(STRING, date) --> to_date(STRING, format)
-                String format = "YYYY-MM-DD";  //$NON-NLS-1$ 
-                convert = dateTypeHelper("to_date", new IExpression[] {args[0],  //$NON-NLS-1$ 
-                    langFactory.createLiteral(format, String.class)}, java.sql.Date.class);
-                break;
-            case TIMESTAMP:
-                // convert(TSELEMENT, date) --> trunc(TSELEMENT) 
-                convert = dateTypeHelper("trunc", new IExpression[] {args[0]}, java.sql.Date.class);  //$NON-NLS-1$ 
-                break;
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }
-
-    /**
-     * TODO: need to remove the prepend 1970-01-01 and the {ts''}
-     * @param function
-     * @return IExpression
-     */
-    private IExpression convertToTime(IFunction function) {
-        IExpression convert = null;
-        IExpression[] args = function.getParameters();
-        Class srcType = args[0].getType();
-        String format = "YYYY-MM-DD HH24:MI:SS";  //$NON-NLS-1$ 
-        
-        int srcCode = getSrcCode(srcType);
-        switch(srcCode) {
-            case STRING:
-                //convert(STRING, time) --> to_date('1970-01-01 ' || to_char(timevalue, 'HH24:MI:SS'), 'YYYY-MM-DD HH24:MI:SS')
-                IFunction inner0 = langFactory.createFunction("to_char",  //$NON-NLS-1$
-                    new IExpression[] { 
-                        args[0],
-                        langFactory.createLiteral("HH24:MI:SS", String.class)},  //$NON-NLS-1$
-                        String.class); 
-                        
-                IExpression prependedPart0 = langFactory.createFunction("||",  //$NON-NLS-1$
-                new IExpression[] {
-                    langFactory.createLiteral("1970-01-01 ", String.class),  //$NON-NLS-1$
-                    inner0},
-                    String.class);    
-                    
-                convert = langFactory.createFunction("to_date",  //$NON-NLS-1$
-                    new IExpression[] {prependedPart0,
-                        langFactory.createLiteral(format, String.class)}, 
-                        java.sql.Time.class);   
-                break;                                                                 
-            case TIMESTAMP:
-                // convert(timestamp, time) 
-                // --> to_date(('1970-01-01 ' || to_char(timestampvalue, 'HH24:MI:SS'))),  
-                //         'YYYY-MM-DD HH24:MI:SS') 
-                IFunction inner = langFactory.createFunction("to_char",  //$NON-NLS-1$
-                    new IExpression[] { 
-                        args[0],
-                        langFactory.createLiteral("HH24:MI:SS", String.class)},  //$NON-NLS-1$
-                        String.class); 
-                
-                IExpression prependedPart =  langFactory.createFunction("||",  //$NON-NLS-1$
-                    new IExpression[] {
-                        langFactory.createLiteral("1970-01-01 ", String.class),  //$NON-NLS-1$
-                        inner},
-                        String.class);
-                                          
-                convert = langFactory.createFunction("to_date",  //$NON-NLS-1$
-                    new IExpression[] {prependedPart,
-                        langFactory.createLiteral(format, String.class)}, 
-                        java.sql.Time.class);                                     
-                break;
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }    
-    
-    private IExpression convertToTimestamp(IFunction function) {
-        IExpression convert = null;
-        IExpression[] args = function.getParameters();
-        Class srcType = args[0].getType();
-        int srcCode = getSrcCode(srcType);
-        switch(srcCode) {
-            case STRING:
-                // convert(STRING, timestamp) --> to_date(timestampvalue, 'YYYY-MM-DD HH24:MI:SS.FF')))  
-                String format = "YYYY-MM-DD HH24:MI:SS.FF";  //$NON-NLS-1$
-                convert = dateTypeHelper("to_timestamp", new IExpression[] {args[0],  //$NON-NLS-1$ 
-                    langFactory.createLiteral(format, String.class)}, java.sql.Timestamp.class);
-                break;
-            case TIME:
-            case DATE:
-            	convert = dateTypeHelper("cast", new IExpression[] {args[0],  //$NON-NLS-1$ 
-                        langFactory.createLiteral("timestamp", String.class)}, java.sql.Timestamp.class); //$NON-NLS-1$
-                break; 
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }
-    
-    private IExpression convertToChar(IFunction function) {
-        // two cases: 
-        //          1) 2-byte: convert(string, char) --> cast(stringkey AS char(2))
-        //          2) single bit: just drop
-        // TODO: case 1)
-        return  DROP_MODIFIER.modify(function);         
-    }
-
-    private IExpression convertToString(IFunction function) {
-        IExpression convert = null;
-        IExpression[] args = function.getParameters();
-        String format = null;
-
-        int srcCode = getSrcCode(function);
-        switch(srcCode) { // convert(input, string) --> to_char(input)
-            case BOOLEAN:
-                convert = langFactory.createFunction("decode", new IExpression[]  //$NON-NLS-1$
-                    {   args[0],
-                        langFactory.createLiteral(new Integer(0), Integer.class),
-                        langFactory.createLiteral("false", String.class), //$NON-NLS-1$
-                        langFactory.createLiteral(new Integer(1), Integer.class),
-                        langFactory.createLiteral("true", String.class) },  //$NON-NLS-1$
-                    String.class);
-                
-                break;
-            case BYTE:
-            case SHORT:
-            case INTEGER:
-            case LONG:
-            case BIGINTEGER:
-            case FLOAT:
-            case DOUBLE:
-            case BIGDECIMAL:
-                convert = createStringFunction(args[0]);
-                break;
-            // convert(input, string) --> to_char(input, format)
-            case DATE:
-                format = "YYYY-MM-DD"; //$NON-NLS-1$
-                convert = createStringFunction(args[0], format); 
-                break;
-            case TIME:
-                format = "HH24:MI:SS"; //$NON-NLS-1$
-                convert = createStringFunction(args[0], format); 
-                break;
-            case TIMESTAMP:
-                convert = createStringFunction(args[0], "YYYY-MM-DD HH24:MI:SS.FF"); //$NON-NLS-1$ 
-                break;
-            default:
-                convert = DROP_MODIFIER.modify(function);
-                break;
-        }
-        
-        return convert;
-    }
-    
-    private IExpression convertToBoolean(IFunction function) {
-        IExpression convert = null;
-        int srcCode = getSrcCode(function);
-        switch(srcCode) {
-            case STRING:
-                // convert(src, boolean) --> decode(string, 'true', 1, 'false', 0)
-                convert = booleanHelper(function);  
-                break;  
-            case BYTE:
-            case SHORT:
-            case INTEGER:
-            case LONG:
-            case BIGINTEGER:
-            case FLOAT:
-            case DOUBLE:
-            case BIGDECIMAL:
-            default:
-                convert = DROP_MODIFIER.modify(function);
-                break;
-        }
-        
-        return convert;
-    }
-    
-    private IExpression convertToByte(IFunction function) {
-        IExpression convert = null;
-        int srcCode = getSrcCode(function);
-
-        switch(srcCode) {
-            case STRING:
-                convert = stringSrcHelper(function);
-                break;  
-            case BOOLEAN:
-            case SHORT: 
-            case INTEGER:
-            case LONG:
-            case BIGINTEGER:                     
-            case FLOAT:
-            case DOUBLE:
-            case BIGDECIMAL:
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }
-    
-    private IExpression convertToShort(IFunction function) {
-        IExpression convert = null;
-        int srcCode = getSrcCode(function);
-
-        switch(srcCode) {
-            case STRING:
-                convert = stringSrcHelper(function);
-                break;  
-            case BOOLEAN:
-            case BYTE:
-            case INTEGER:
-            case LONG:
-            case BIGINTEGER:
-            case FLOAT:
-            case DOUBLE:
-            case BIGDECIMAL:
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }
-    
-    private IExpression convertToInteger(IFunction function) {
-        IExpression convert = null;
-        int srcCode = getSrcCode(function);
-
-        switch(srcCode) {
-            case STRING:
-                convert = stringSrcHelper(function);
-                break;  
-            case BOOLEAN:
-            case LONG:
-            case BIGINTEGER:
-            case FLOAT:
-            case DOUBLE:
-            case BIGDECIMAL:
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }
-
-    private IExpression convertToLong(IFunction function) {
-        IExpression convert = null;
-        int srcCode = getSrcCode(function);
-
-        switch(srcCode) {
-            case STRING:
-                convert = stringSrcHelper(function);
-                break;  
-            case BOOLEAN:
-            case BIGINTEGER:
-            case FLOAT:
-            case DOUBLE:
-            case BIGDECIMAL:
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }
-    
-    private IExpression convertToBigInteger(IFunction function) {
-        IExpression convert = null;
-        int srcCode = getSrcCode(function);
-
-        switch(srcCode) {
-            case STRING:
-                convert = stringSrcHelper(function);
-                break;  
-            case BOOLEAN:
-            case FLOAT:
-            case DOUBLE:
-            case BIGDECIMAL:
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }
-    
-    private IExpression convertToFloat(IFunction function) {
-        IExpression convert = null;
-        int srcCode = getSrcCode(function);
-
-        switch(srcCode) {
-            case STRING:
-                convert = stringSrcHelper(function);
-                break;  
-            case BOOLEAN:
-            case DOUBLE: 
-            case BIGDECIMAL:
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }   
-       
-    private IExpression convertToDouble(IFunction function) {
-        IExpression convert = null;
-        int srcCode = getSrcCode(function);
-
-        switch(srcCode) {
-            case STRING:
-                convert = stringSrcHelper(function);
-                break;  
-            case BOOLEAN:
-            case BIGDECIMAL:   
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }
-    
-    private IExpression convertToBigDecimal(IFunction function) {
-        IExpression convert = null;
-        int srcCode = getSrcCode(function);
-
-        switch(srcCode) {
-            case STRING:
-                convert = stringSrcHelper(function);
-                break;  
-            case BOOLEAN:
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }  
-
-    private IFunction dateTypeHelper(String functionName, IExpression[] args, Class target) {
-        IFunction convert = langFactory.createFunction(functionName,  
-            args, target);
-        return convert;          
-    }
-       
-    private IFunction booleanHelper(IFunction function) {
-        // using decode(value, 'true', 1, 'false', 0)
-        IExpression[] args = function.getParameters();
-       
-        IExpression[] modified = new IExpression[] {
-            args[0],
-            langFactory.createLiteral("true", String.class), //$NON-NLS-1$ 
-            langFactory.createLiteral(new Byte((byte)1), Byte.class),
-            langFactory.createLiteral("false", String.class), //$NON-NLS-1$ 
-            langFactory.createLiteral(new Byte((byte)0), Byte.class)                        
-        };
-        
-        return langFactory.createFunction("decode", //$NON-NLS-1$
-            modified, java.lang.Boolean.class);  
-    }
-            
-    private IExpression stringSrcHelper(IFunction function) {
-        IExpression convert = null;
-        IExpression[] args = function.getParameters();
-        // switch the target type
-        String functionName = "to_number"; //$NON-NLS-1$
-        int targetCode = getTargetCode(function.getType());
-        switch(targetCode) {
-            case BYTE:
-                convert = createFunction(functionName, args[0], Byte.class);
-                break;
-            case SHORT:
-                convert = createFunction(functionName, args[0], Short.class);
-                break;                    
-            case INTEGER:
-                convert = createFunction(functionName, args[0], Integer.class);
-                break;
-            case LONG:
-                convert = createFunction(functionName, args[0], Long.class);
-                break;           
-            case BIGINTEGER:
-                convert = createFunction(functionName, args[0], java.math.BigInteger.class);
-                break;    
-            case FLOAT:
-                convert = createFunction(functionName, args[0], Float.class);
-                break;
-            case DOUBLE:
-                convert = createFunction(functionName, args[0], Double.class);
-                break;
-            case BIGDECIMAL:
-                convert = createFunction(functionName, args[0], java.math.BigDecimal.class);
-                break;   
-            default:
-                convert = DROP_MODIFIER.modify(function);
-                break;               
-        }             
-        return convert;
-    } 
-          
-    private IFunction createFunction(String functionName, IExpression args0, Class targetClass) {
-        IFunction created = langFactory.createFunction(functionName,
-            new IExpression[] {args0}, targetClass);
-        return created;            
-    }
-
-    private IFunction createStringFunction(IExpression args0, String format) {
-        IFunction created = langFactory.createFunction("to_char", //$NON-NLS-1$ 
-            new IExpression[] {args0, langFactory.createLiteral(format, String.class)}, 
-            String.class);
-        return created;            
-    }
-    
-    private IFunction createStringFunction(IExpression args) {
-        IFunction created = langFactory.createFunction("to_char", //$NON-NLS-1$ 
-            new IExpression[] { args }, String.class); 
-        return created;
-    }
-    
-    private int getSrcCode(IFunction function) {
-        IExpression[] args = function.getParameters();
-        Class srcType = args[0].getType();
-        return ((Integer) typeMap.get(srcType)).intValue();
-    }
-    
-    private int getSrcCode(Class source) {
-        return ((Integer) typeMap.get(source)).intValue();
-    }
-    
-    private int getTargetCode(Class target) {
-        return ((Integer) typeMap.get(target)).intValue();
-    }           
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleConvertModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleConvertModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleConvertModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleConvertModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,541 @@
+/*
+ * 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.oracle;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.connector.jdbc.translator.BasicFunctionModifier;
+import org.teiid.connector.jdbc.translator.DropFunctionModifier;
+import org.teiid.connector.jdbc.translator.FunctionModifier;
+
+import com.metamatrix.connector.api.ConnectorLogger;
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageFactory;
+import com.metamatrix.connector.language.ILiteral;
+
+/**
+ */
+public class OracleConvertModifier extends BasicFunctionModifier implements FunctionModifier {     
+    private static DropFunctionModifier DROP_MODIFIER = new DropFunctionModifier();
+    private ILanguageFactory langFactory;
+    
+    public OracleConvertModifier(ILanguageFactory langFactory, ConnectorLogger logger) {
+        this.langFactory = langFactory;
+    }
+
+    /**
+     * Intentionally return null, rely on the SQLStringVisitor being used by caller
+     * (Oracle or Oracle8 SQLConversionVisitor (SQLConversionVisitor))
+     * @see org.teiid.connector.jdbc.translator.FunctionModifier#translate(com.metamatrix.connector.language.IFunction)
+     */
+    public List translate(IFunction function) {
+        return null;
+    }    
+    
+    public IExpression modify(IFunction function) {
+        List<IExpression> args = function.getParameters();
+        IExpression modified = null;
+
+        String target = ((String)((ILiteral)args.get(1)).getValue()).toLowerCase();
+        if (target.equals("string")) {  //$NON-NLS-1$ 
+            modified = convertToString(function);
+        } else if (target.equals("short")) {  //$NON-NLS-1$ 
+            modified = convertToShort(function);
+        } else if (target.equals("integer")) { //$NON-NLS-1$ 
+            modified = convertToInteger(function);
+        } else if (target.equals("long")) { //$NON-NLS-1$ 
+            modified = convertToLong(function);
+        } else if (target.equals("biginteger")) { //$NON-NLS-1$ 
+            modified = convertToBigInteger(function);
+        } else if (target.equals("float")) { //$NON-NLS-1$ 
+            modified = convertToFloat(function);
+        } else if (target.equals("double")) { //$NON-NLS-1$ 
+            modified = convertToDouble(function);
+        } else if (target.equals("bigdecimal")) { //$NON-NLS-1$ 
+            modified = convertToBigDecimal(function);
+        } else if (target.equals("date")) { //$NON-NLS-1$ 
+            modified = convertToDate(function);
+        } else if (target.equals("time")) { //$NON-NLS-1$ 
+            modified = convertToTime(function);
+        } else if (target.equals("timestamp")) { //$NON-NLS-1$ 
+            modified = convertToTimestamp(function);
+        } else if (target.equals("char")) { //$NON-NLS-1$ 
+            modified = convertToChar(function);
+        } else if (target.equals("boolean")) {  //$NON-NLS-1$ 
+            modified = convertToBoolean(function);
+        } else if (target.equals("byte")) {  //$NON-NLS-1$ 
+            modified = convertToByte(function);
+        } else {
+            modified = DROP_MODIFIER.modify(function);          
+        }
+        return modified;
+    }
+    
+    private IExpression convertToDate(IFunction function) {
+        IExpression convert = null;
+        List<IExpression> args = function.getParameters();
+        Class srcType = args.get(0).getType();
+        int srcCode = getSrcCode(srcType);
+
+        switch(srcCode) {
+            case STRING:
+                // convert(STRING, date) --> to_date(STRING, format)
+                String format = "YYYY-MM-DD";  //$NON-NLS-1$ 
+                convert = dateTypeHelper("to_date", Arrays.asList(args.get(0),  //$NON-NLS-1$ 
+                    langFactory.createLiteral(format, String.class)), java.sql.Date.class);
+                break;
+            case TIMESTAMP:
+                // convert(TSELEMENT, date) --> trunc(TSELEMENT) 
+                convert = dateTypeHelper("trunc", Arrays.asList(args.get(0)), java.sql.Date.class);  //$NON-NLS-1$ 
+                break;
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }
+
+    /**
+     * TODO: need to remove the prepend 1970-01-01 and the {ts''}
+     * @param function
+     * @return IExpression
+     */
+    private IExpression convertToTime(IFunction function) {
+        IExpression convert = null;
+        List<IExpression> args = function.getParameters();
+        Class srcType = args.get(0).getType();
+        String format = "YYYY-MM-DD HH24:MI:SS";  //$NON-NLS-1$ 
+        
+        int srcCode = getSrcCode(srcType);
+        switch(srcCode) {
+            case STRING:
+                //convert(STRING, time) --> to_date('1970-01-01 ' || to_char(timevalue, 'HH24:MI:SS'), 'YYYY-MM-DD HH24:MI:SS')
+                IFunction inner0 = langFactory.createFunction("to_char",  //$NON-NLS-1$
+                    Arrays.asList( 
+                        args.get(0),
+                        langFactory.createLiteral("HH24:MI:SS", String.class)),  //$NON-NLS-1$
+                        String.class); 
+                        
+                IExpression prependedPart0 = langFactory.createFunction("||",  //$NON-NLS-1$
+                Arrays.asList(
+                    langFactory.createLiteral("1970-01-01 ", String.class),  //$NON-NLS-1$
+                    inner0),
+                    String.class);    
+                    
+                convert = langFactory.createFunction("to_date",  //$NON-NLS-1$
+                    Arrays.asList(prependedPart0,
+                        langFactory.createLiteral(format, String.class)), 
+                        java.sql.Time.class);   
+                break;                                                                 
+            case TIMESTAMP:
+                // convert(timestamp, time) 
+                // --> to_date(('1970-01-01 ' || to_char(timestampvalue, 'HH24:MI:SS'))),  
+                //         'YYYY-MM-DD HH24:MI:SS') 
+                IFunction inner = langFactory.createFunction("to_char",  //$NON-NLS-1$
+                    Arrays.asList( 
+                        args.get(0),
+                        langFactory.createLiteral("HH24:MI:SS", String.class)),  //$NON-NLS-1$
+                        String.class); 
+                
+                IExpression prependedPart =  langFactory.createFunction("||",  //$NON-NLS-1$
+                    Arrays.asList(
+                        langFactory.createLiteral("1970-01-01 ", String.class),  //$NON-NLS-1$
+                        inner),
+                        String.class);
+                                          
+                convert = langFactory.createFunction("to_date",  //$NON-NLS-1$
+                    Arrays.asList(prependedPart,
+                        langFactory.createLiteral(format, String.class)), 
+                        java.sql.Time.class);                                     
+                break;
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }    
+    
+    private IExpression convertToTimestamp(IFunction function) {
+        IExpression convert = null;
+        List<IExpression> args = function.getParameters();
+        Class srcType = args.get(0).getType();
+        int srcCode = getSrcCode(srcType);
+        switch(srcCode) {
+            case STRING:
+                // convert(STRING, timestamp) --> to_date(timestampvalue, 'YYYY-MM-DD HH24:MI:SS.FF')))  
+                String format = "YYYY-MM-DD HH24:MI:SS.FF";  //$NON-NLS-1$
+                convert = dateTypeHelper("to_timestamp", Arrays.asList(args.get(0),  //$NON-NLS-1$ 
+                    langFactory.createLiteral(format, String.class)), java.sql.Timestamp.class);
+                break;
+            case TIME:
+            case DATE:
+            	convert = dateTypeHelper("cast", Arrays.asList(args.get(0),  //$NON-NLS-1$ 
+                        langFactory.createLiteral("timestamp", String.class)), java.sql.Timestamp.class); //$NON-NLS-1$
+                break; 
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }
+    
+    private IExpression convertToChar(IFunction function) {
+        // two cases: 
+        //          1) 2-byte: convert(string, char) --> cast(stringkey AS char(2))
+        //          2) single bit: just drop
+        // TODO: case 1)
+        return  DROP_MODIFIER.modify(function);         
+    }
+
+    private IExpression convertToString(IFunction function) {
+        IExpression convert = null;
+        List<IExpression> args = function.getParameters();
+        String format = null;
+
+        int srcCode = getSrcCode(function);
+        switch(srcCode) { // convert(input, string) --> to_char(input)
+            case BOOLEAN:
+                convert = langFactory.createFunction("decode", Arrays.asList( //$NON-NLS-1$
+                        args.get(0),
+                        langFactory.createLiteral(new Integer(0), Integer.class),
+                        langFactory.createLiteral("false", String.class), //$NON-NLS-1$
+                        langFactory.createLiteral(new Integer(1), Integer.class),
+                        langFactory.createLiteral("true", String.class) ),  //$NON-NLS-1$
+                    String.class);
+                
+                break;
+            case BYTE:
+            case SHORT:
+            case INTEGER:
+            case LONG:
+            case BIGINTEGER:
+            case FLOAT:
+            case DOUBLE:
+            case BIGDECIMAL:
+                convert = createStringFunction(args.get(0));
+                break;
+            // convert(input, string) --> to_char(input, format)
+            case DATE:
+                format = "YYYY-MM-DD"; //$NON-NLS-1$
+                convert = createStringFunction(args.get(0), format); 
+                break;
+            case TIME:
+                format = "HH24:MI:SS"; //$NON-NLS-1$
+                convert = createStringFunction(args.get(0), format); 
+                break;
+            case TIMESTAMP:
+                convert = createStringFunction(args.get(0), "YYYY-MM-DD HH24:MI:SS.FF"); //$NON-NLS-1$ 
+                break;
+            default:
+                convert = DROP_MODIFIER.modify(function);
+                break;
+        }
+        
+        return convert;
+    }
+    
+    private IExpression convertToBoolean(IFunction function) {
+        IExpression convert = null;
+        int srcCode = getSrcCode(function);
+        switch(srcCode) {
+            case STRING:
+                // convert(src, boolean) --> decode(string, 'true', 1, 'false', 0)
+                convert = booleanHelper(function);  
+                break;  
+            case BYTE:
+            case SHORT:
+            case INTEGER:
+            case LONG:
+            case BIGINTEGER:
+            case FLOAT:
+            case DOUBLE:
+            case BIGDECIMAL:
+            default:
+                convert = DROP_MODIFIER.modify(function);
+                break;
+        }
+        
+        return convert;
+    }
+    
+    private IExpression convertToByte(IFunction function) {
+        IExpression convert = null;
+        int srcCode = getSrcCode(function);
+
+        switch(srcCode) {
+            case STRING:
+                convert = stringSrcHelper(function);
+                break;  
+            case BOOLEAN:
+            case SHORT: 
+            case INTEGER:
+            case LONG:
+            case BIGINTEGER:                     
+            case FLOAT:
+            case DOUBLE:
+            case BIGDECIMAL:
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }
+    
+    private IExpression convertToShort(IFunction function) {
+        IExpression convert = null;
+        int srcCode = getSrcCode(function);
+
+        switch(srcCode) {
+            case STRING:
+                convert = stringSrcHelper(function);
+                break;  
+            case BOOLEAN:
+            case BYTE:
+            case INTEGER:
+            case LONG:
+            case BIGINTEGER:
+            case FLOAT:
+            case DOUBLE:
+            case BIGDECIMAL:
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }
+    
+    private IExpression convertToInteger(IFunction function) {
+        IExpression convert = null;
+        int srcCode = getSrcCode(function);
+
+        switch(srcCode) {
+            case STRING:
+                convert = stringSrcHelper(function);
+                break;  
+            case BOOLEAN:
+            case LONG:
+            case BIGINTEGER:
+            case FLOAT:
+            case DOUBLE:
+            case BIGDECIMAL:
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }
+
+    private IExpression convertToLong(IFunction function) {
+        IExpression convert = null;
+        int srcCode = getSrcCode(function);
+
+        switch(srcCode) {
+            case STRING:
+                convert = stringSrcHelper(function);
+                break;  
+            case BOOLEAN:
+            case BIGINTEGER:
+            case FLOAT:
+            case DOUBLE:
+            case BIGDECIMAL:
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }
+    
+    private IExpression convertToBigInteger(IFunction function) {
+        IExpression convert = null;
+        int srcCode = getSrcCode(function);
+
+        switch(srcCode) {
+            case STRING:
+                convert = stringSrcHelper(function);
+                break;  
+            case BOOLEAN:
+            case FLOAT:
+            case DOUBLE:
+            case BIGDECIMAL:
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }
+    
+    private IExpression convertToFloat(IFunction function) {
+        IExpression convert = null;
+        int srcCode = getSrcCode(function);
+
+        switch(srcCode) {
+            case STRING:
+                convert = stringSrcHelper(function);
+                break;  
+            case BOOLEAN:
+            case DOUBLE: 
+            case BIGDECIMAL:
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }   
+       
+    private IExpression convertToDouble(IFunction function) {
+        IExpression convert = null;
+        int srcCode = getSrcCode(function);
+
+        switch(srcCode) {
+            case STRING:
+                convert = stringSrcHelper(function);
+                break;  
+            case BOOLEAN:
+            case BIGDECIMAL:   
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }
+    
+    private IExpression convertToBigDecimal(IFunction function) {
+        IExpression convert = null;
+        int srcCode = getSrcCode(function);
+
+        switch(srcCode) {
+            case STRING:
+                convert = stringSrcHelper(function);
+                break;  
+            case BOOLEAN:
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }  
+
+    private IFunction dateTypeHelper(String functionName, List<IExpression> args, Class target) {
+        IFunction convert = langFactory.createFunction(functionName,  
+            args, target);
+        return convert;          
+    }
+       
+    private IFunction booleanHelper(IFunction function) {
+        // using decode(value, 'true', 1, 'false', 0)
+        List<IExpression> args = function.getParameters();
+       
+        return langFactory.createFunction("decode", //$NON-NLS-1$
+        		Arrays.asList(
+        	            args.get(0),
+        	            langFactory.createLiteral("true", String.class), //$NON-NLS-1$ 
+        	            langFactory.createLiteral(new Byte((byte)1), Byte.class),
+        	            langFactory.createLiteral("false", String.class), //$NON-NLS-1$ 
+        	            langFactory.createLiteral(new Byte((byte)0), Byte.class)                        
+        	        ), java.lang.Boolean.class);  
+    }
+            
+    private IExpression stringSrcHelper(IFunction function) {
+        IExpression convert = null;
+        List<IExpression> args = function.getParameters();
+        // switch the target type
+        String functionName = "to_number"; //$NON-NLS-1$
+        int targetCode = getTargetCode(function.getType());
+        switch(targetCode) {
+            case BYTE:
+                convert = createFunction(functionName, args.get(0), Byte.class);
+                break;
+            case SHORT:
+                convert = createFunction(functionName, args.get(0), Short.class);
+                break;                    
+            case INTEGER:
+                convert = createFunction(functionName, args.get(0), Integer.class);
+                break;
+            case LONG:
+                convert = createFunction(functionName, args.get(0), Long.class);
+                break;           
+            case BIGINTEGER:
+                convert = createFunction(functionName, args.get(0), java.math.BigInteger.class);
+                break;    
+            case FLOAT:
+                convert = createFunction(functionName, args.get(0), Float.class);
+                break;
+            case DOUBLE:
+                convert = createFunction(functionName, args.get(0), Double.class);
+                break;
+            case BIGDECIMAL:
+                convert = createFunction(functionName, args.get(0), java.math.BigDecimal.class);
+                break;   
+            default:
+                convert = DROP_MODIFIER.modify(function);
+                break;               
+        }             
+        return convert;
+    } 
+          
+    private IFunction createFunction(String functionName, IExpression args0, Class targetClass) {
+        IFunction created = langFactory.createFunction(functionName,
+            Arrays.asList(args0), targetClass);
+        return created;            
+    }
+
+    private IFunction createStringFunction(IExpression args0, String format) {
+        IFunction created = langFactory.createFunction("to_char", //$NON-NLS-1$ 
+            Arrays.asList(args0, langFactory.createLiteral(format, String.class)), 
+            String.class);
+        return created;            
+    }
+    
+    private IFunction createStringFunction(IExpression args) {
+        IFunction created = langFactory.createFunction("to_char", //$NON-NLS-1$ 
+            Arrays.asList( args ), String.class); 
+        return created;
+    }
+    
+    private int getSrcCode(IFunction function) {
+        List<IExpression> args = function.getParameters();
+        Class srcType = args.get(0).getType();
+        return ((Integer) typeMap.get(srcType)).intValue();
+    }
+    
+    private int getSrcCode(Class source) {
+        return ((Integer) typeMap.get(source)).intValue();
+    }
+    
+    private int getTargetCode(Class target) {
+        return ((Integer) typeMap.get(target)).intValue();
+    }           
+}

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleSQLTranslator.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,281 +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.jdbc.oracle;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.sql.Types;
-import java.util.List;
-
-import com.metamatrix.connector.api.ConnectorEnvironment;
-import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.api.SourceSystemFunctions;
-import com.metamatrix.connector.jdbc.JDBCPlugin;
-import com.metamatrix.connector.jdbc.translator.AliasModifier;
-import com.metamatrix.connector.jdbc.translator.Translator;
-import com.metamatrix.connector.language.ICommand;
-import com.metamatrix.connector.language.IElement;
-import com.metamatrix.connector.language.IGroup;
-import com.metamatrix.connector.language.IInsert;
-import com.metamatrix.connector.language.ILimit;
-import com.metamatrix.connector.language.ISetQuery.Operation;
-import com.metamatrix.connector.metadata.runtime.Element;
-import com.metamatrix.connector.metadata.runtime.MetadataID;
-import com.metamatrix.connector.visitor.util.SQLReservedWords;
-
-/**
- */
-public class OracleSQLTranslator extends Translator {
-
-    public final static String HINT_PREFIX = "/*+"; //$NON-NLS-1$
-    public final static String DUAL = "DUAL"; //$NON-NLS-1$
-    public final static String ROWNUM = "ROWNUM"; //$NON-NLS-1$
-    public final static String SEQUENCE = ":SEQUENCE="; //$NON-NLS-1$
-	
-    public void initialize(ConnectorEnvironment env) throws ConnectorException {
-        super.initialize(env);
-        registerFunctionModifier(SourceSystemFunctions.CHAR, new AliasModifier("chr")); //$NON-NLS-1$ //$NON-NLS-2$
-        registerFunctionModifier(SourceSystemFunctions.LCASE, new AliasModifier("lower")); //$NON-NLS-1$ //$NON-NLS-2$
-        registerFunctionModifier(SourceSystemFunctions.UCASE, new AliasModifier("upper")); //$NON-NLS-1$ //$NON-NLS-2$
-        registerFunctionModifier(SourceSystemFunctions.IFNULL, new AliasModifier("nvl")); //$NON-NLS-1$ //$NON-NLS-2$
-        registerFunctionModifier(SourceSystemFunctions.LOG, new AliasModifier("ln")); //$NON-NLS-1$ //$NON-NLS-2$
-        registerFunctionModifier(SourceSystemFunctions.CEILING, new AliasModifier("ceil")); //$NON-NLS-1$ //$NON-NLS-2$
-        registerFunctionModifier(SourceSystemFunctions.LOG10, new Log10FunctionModifier(getLanguageFactory())); //$NON-NLS-1$
-        registerFunctionModifier(SourceSystemFunctions.CONVERT, new OracleConvertModifier(getLanguageFactory(), getEnvironment().getLogger())); //$NON-NLS-1$
-        registerFunctionModifier(SourceSystemFunctions.HOUR, new ExtractFunctionModifier("HOUR"));//$NON-NLS-1$
-        registerFunctionModifier(SourceSystemFunctions.YEAR, new ExtractFunctionModifier("YEAR"));//$NON-NLS-1$ //$NON-NLS-2$
-        registerFunctionModifier(SourceSystemFunctions.MINUTE, new ExtractFunctionModifier("MINUTE"));//$NON-NLS-1$ //$NON-NLS-2$
-        registerFunctionModifier(SourceSystemFunctions.SECOND, new ExtractFunctionModifier("SECOND"));//$NON-NLS-1$ //$NON-NLS-2$
-        registerFunctionModifier(SourceSystemFunctions.MONTH, new ExtractFunctionModifier("MONTH"));//$NON-NLS-1$ //$NON-NLS-2$
-        registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new ExtractFunctionModifier("DAY"));//$NON-NLS-1$ //$NON-NLS-2$
-        registerFunctionModifier(SourceSystemFunctions.MONTHNAME, new MonthOrDayNameFunctionModifier(getLanguageFactory(), "Month"));//$NON-NLS-1$ //$NON-NLS-2$
-        registerFunctionModifier(SourceSystemFunctions.DAYNAME, new MonthOrDayNameFunctionModifier(getLanguageFactory(), "Day"));//$NON-NLS-1$ //$NON-NLS-2$
-        registerFunctionModifier(SourceSystemFunctions.WEEK, new DayWeekQuarterFunctionModifier(getLanguageFactory(), "WW"));//$NON-NLS-1$ //$NON-NLS-2$
-        registerFunctionModifier(SourceSystemFunctions.QUARTER, new DayWeekQuarterFunctionModifier(getLanguageFactory(), "Q"));//$NON-NLS-1$ //$NON-NLS-2$
-        registerFunctionModifier(SourceSystemFunctions.DAYOFWEEK, new DayWeekQuarterFunctionModifier(getLanguageFactory(), "D"));//$NON-NLS-1$ //$NON-NLS-2$
-        registerFunctionModifier(SourceSystemFunctions.DAYOFYEAR, new DayWeekQuarterFunctionModifier(getLanguageFactory(), "DDD"));//$NON-NLS-1$ //$NON-NLS-2$      
-        registerFunctionModifier(SourceSystemFunctions.LOCATE, new LocateFunctionModifier(getLanguageFactory()));//$NON-NLS-1$
-        registerFunctionModifier(SourceSystemFunctions.SUBSTRING, new AliasModifier("substr"));//$NON-NLS-1$ //$NON-NLS-2$
-        registerFunctionModifier(SourceSystemFunctions.LEFT, new LeftOrRightFunctionModifier(getLanguageFactory()));//$NON-NLS-1$ //$NON-NLS-2$
-        registerFunctionModifier(SourceSystemFunctions.RIGHT, new LeftOrRightFunctionModifier(getLanguageFactory()));//$NON-NLS-1$ //$NON-NLS-2$
-        registerFunctionModifier(SourceSystemFunctions.CONCAT, new ConcatFunctionModifier(getLanguageFactory())); //$NON-NLS-1$
-    }
-    
-    @Override
-    public ICommand modifyCommand(ICommand command, ExecutionContext context)
-    		throws ConnectorException {
-    	if (!(command instanceof IInsert)) {
-    		return command;
-    	}
-    	
-        /* 
-         * If a missing auto_increment column is modeled with name in source indicating that an Oracle Sequence 
-         * then pull the Sequence name out of the name in source of the column.
-         */
-    	IInsert insert = (IInsert)command;
-    	List<MetadataID> allElements = insert.getGroup().getMetadataID().getChildIDs();
-    	if (allElements.size() == insert.getValues().size()) {
-    		return command;
-    	}
-    	
-    	int index = 0;
-    	List<IElement> elements = insert.getElements();
-    	
-    	for (MetadataID metadataID : allElements) {
-    		Element element = (Element)metadataID.getMetadataObject();
-    		if (!element.isAutoIncremented()) {
-    			continue;
-    		}
-    		String name = element.getNameInSource();
-    		int seqIndex = name.indexOf(SEQUENCE);
-    		if (seqIndex == -1) {
-    			continue;
-    		}
-    		boolean found = false;
-    		while (index < elements.size()) {
-    			if (metadataID.equals(elements.get(index).getMetadataID())) {
-    				found = true;
-    				break;
-    			}
-    			index++;
-    		}
-    		if (found) {
-    			continue;
-    		}
-    		
-            String sequence = name.substring(seqIndex + SEQUENCE.length());
-            
-            int delimiterIndex = sequence.indexOf(SQLReservedWords.DOT);
-            if (delimiterIndex == -1) {
-            	throw new ConnectorException("Invalid name in source sequence format.  Expected <element name>" + SEQUENCE + "<sequence name>.<sequence value>, but was " + name);
-            }
-            String sequenceGroupName = sequence.substring(0, delimiterIndex);
-            String sequenceElementName = sequence.substring(delimiterIndex + 1);
-                
-            IGroup sequenceGroup = this.getLanguageFactory().createGroup(sequenceGroupName, null, null);
-            IElement sequenceElement = this.getLanguageFactory().createElement(sequenceElementName, sequenceGroup, null, element.getJavaType());
-            insert.getElements().add(index, this.getLanguageFactory().createElement(element.getMetadataID().getName(), insert.getGroup(), metadataID, element.getJavaType()));
-            insert.getValues().add(index, sequenceElement);
-		}
-        return command;
-    }
-
-    @Override
-    public String addLimitString(String queryCommand, ILimit limit) {
-    	StringBuffer limitQuery = new StringBuffer(queryCommand.length());
-		if (limit.getRowOffset() > 0) {
-			limitQuery.append("SELECT * FROM (SELECT VIEW_FOR_LIMIT.*, ROWNUM ROWNUM_ FROM (");
-		} else {
-			limitQuery.append("SELECT * FROM (");
-		}
-		limitQuery.append(queryCommand);
-		if (limit.getRowOffset() > 0) {
-			limitQuery.append(") VIEW_FOR_LIMIT WHERE ROWNUM <= ").append(
-					limit.getRowLimit()).append(") WHERE ROWNUM_ > ").append(
-					limit.getRowOffset());
-		} else {
-			limitQuery.append(") WHERE ROWNUM <= ").append(
-					limit.getRowLimit());
-		}
-		return limitQuery.toString();
-    }
-    
-    @Override
-    public boolean useAsInGroupAlias(){
-        return false;
-    }
-    
-    @Override
-    public String getSetOperationString(Operation operation) {
-    	if (operation == Operation.EXCEPT) {
-    		return "MINUS"; //$NON-NLS-1$
-    	}
-    	return super.getSetOperationString(operation);
-    }
-    
-    @Override
-    public String getSourceComment(ExecutionContext context, ICommand command) {
-    	String comment = super.getSourceComment(context, command);
-    	
-    	if (context != null) {
-	    	// Check for db hints
-		    Object payload = context.getExecutionPayload();
-		    if (payload instanceof String) {
-		        String payloadString = (String)payload;
-		        if (payloadString.startsWith(HINT_PREFIX)) {
-		            comment += payloadString + " "; //$NON-NLS-1$
-		        }
-		    }
-    	}
-    	return comment;
-    }
-    
-    /**
-     * Don't fully qualify elements if table = DUAL or element = ROWNUM or special stuff is packed into name in source value.
-     *  
-     * @see com.metamatrix.connector.visitor.util.SQLStringVisitor#skipGroupInElement(java.lang.String, java.lang.String)
-     * @since 5.0
-     */
-    @Override
-    public String replaceElementName(String group, String element) {        
-
-        // Check if the element was modeled as using a Sequence
-        int useIndex = element.indexOf(SEQUENCE);
-        if (useIndex >= 0) {
-        	String name = element.substring(0, useIndex);
-        	if (group != null) {
-        		return group + SQLReservedWords.DOT + name;
-        	}
-        	return name;
-        }
-
-        // Check if the group name should be discarded
-        if((group != null && group.equalsIgnoreCase(DUAL)) || element.equalsIgnoreCase(ROWNUM)) {
-            // Strip group if group or element are pseudo-columns
-            return element;
-        }
-        
-        return null;
-    }
-    
-    @Override
-    public boolean hasTimeType() {
-    	return false;
-    }
-    
-    @Override
-    public String getDefaultConnectionTestQuery() {
-    	return "Select 'x' from DUAL"; //$NON-NLS-1$
-    }
-    
-    @Override
-    public void bindValue(PreparedStatement stmt, Object param, Class paramType, int i) throws SQLException {
-    	if(param == null && Object.class.equals(paramType)){
-    		//Oracle drive does not support JAVA_OBJECT type
-    		stmt.setNull(i, Types.LONGVARBINARY);
-    		return;
-    	}
-    	super.bindValue(stmt, param, paramType, i);
-    }
-    
-    @Override
-    public void afterInitialConnectionCreation(Connection connection) {
-    	String errorStr = JDBCPlugin.Util.getString("ConnectionListener.failed_to_report_oracle_connection_details"); //$NON-NLS-1$
-    	ResultSet rs = null;
-        Statement stmt = null;
-        try {                
-            stmt = connection.createStatement();
-            rs = stmt.executeQuery("select * from v$instance"); 
-            
-            int columnCount = rs.getMetaData().getColumnCount();
-            while (rs.next()) {
-                StringBuffer sb = new StringBuffer();
-                for (int i = 1; i <= columnCount; i++) {
-                    sb.append(rs.getMetaData().getColumnName(i)).append("=").append(rs.getString(i)).append(";"); //$NON-NLS-1$ //$NON-NLS-2$
-                }                    
-                // log the queried information
-                getEnvironment().getLogger().logInfo(sb.toString());                    
-            }                
-            
-        } catch (SQLException e) {
-            getEnvironment().getLogger().logInfo(errorStr); 
-        }finally {
-            try {
-                if (rs != null) {
-                    rs.close();
-                } 
-                if (stmt != null) {
-                    stmt.close();
-                }
-            } catch (SQLException e1) {
-                getEnvironment().getLogger().logInfo(errorStr);
-            }
-        }
-    }
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/oracle/OracleSQLTranslator.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/oracle/OracleSQLTranslator.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,280 @@
+/*
+ * 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.oracle;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Types;
+import java.util.List;
+
+import org.teiid.connector.jdbc.JDBCPlugin;
+import org.teiid.connector.jdbc.translator.AliasModifier;
+import org.teiid.connector.jdbc.translator.Translator;
+
+import com.metamatrix.connector.api.ConnectorEnvironment;
+import com.metamatrix.connector.api.ConnectorException;
+import com.metamatrix.connector.api.ExecutionContext;
+import com.metamatrix.connector.api.SourceSystemFunctions;
+import com.metamatrix.connector.language.ICommand;
+import com.metamatrix.connector.language.IElement;
+import com.metamatrix.connector.language.IGroup;
+import com.metamatrix.connector.language.IInsert;
+import com.metamatrix.connector.language.ILimit;
+import com.metamatrix.connector.language.ISetQuery.Operation;
+import com.metamatrix.connector.metadata.runtime.Element;
+import com.metamatrix.connector.visitor.util.SQLReservedWords;
+
+/**
+ */
+public class OracleSQLTranslator extends Translator {
+
+    public final static String HINT_PREFIX = "/*+"; //$NON-NLS-1$
+    public final static String DUAL = "DUAL"; //$NON-NLS-1$
+    public final static String ROWNUM = "ROWNUM"; //$NON-NLS-1$
+    public final static String SEQUENCE = ":SEQUENCE="; //$NON-NLS-1$
+	
+    public void initialize(ConnectorEnvironment env) throws ConnectorException {
+        super.initialize(env);
+        registerFunctionModifier(SourceSystemFunctions.CHAR, new AliasModifier("chr")); //$NON-NLS-1$ //$NON-NLS-2$
+        registerFunctionModifier(SourceSystemFunctions.LCASE, new AliasModifier("lower")); //$NON-NLS-1$ //$NON-NLS-2$
+        registerFunctionModifier(SourceSystemFunctions.UCASE, new AliasModifier("upper")); //$NON-NLS-1$ //$NON-NLS-2$
+        registerFunctionModifier(SourceSystemFunctions.IFNULL, new AliasModifier("nvl")); //$NON-NLS-1$ //$NON-NLS-2$
+        registerFunctionModifier(SourceSystemFunctions.LOG, new AliasModifier("ln")); //$NON-NLS-1$ //$NON-NLS-2$
+        registerFunctionModifier(SourceSystemFunctions.CEILING, new AliasModifier("ceil")); //$NON-NLS-1$ //$NON-NLS-2$
+        registerFunctionModifier(SourceSystemFunctions.LOG10, new Log10FunctionModifier(getLanguageFactory())); //$NON-NLS-1$
+        registerFunctionModifier(SourceSystemFunctions.CONVERT, new OracleConvertModifier(getLanguageFactory(), getEnvironment().getLogger())); //$NON-NLS-1$
+        registerFunctionModifier(SourceSystemFunctions.HOUR, new ExtractFunctionModifier("HOUR"));//$NON-NLS-1$
+        registerFunctionModifier(SourceSystemFunctions.YEAR, new ExtractFunctionModifier("YEAR"));//$NON-NLS-1$ //$NON-NLS-2$
+        registerFunctionModifier(SourceSystemFunctions.MINUTE, new ExtractFunctionModifier("MINUTE"));//$NON-NLS-1$ //$NON-NLS-2$
+        registerFunctionModifier(SourceSystemFunctions.SECOND, new ExtractFunctionModifier("SECOND"));//$NON-NLS-1$ //$NON-NLS-2$
+        registerFunctionModifier(SourceSystemFunctions.MONTH, new ExtractFunctionModifier("MONTH"));//$NON-NLS-1$ //$NON-NLS-2$
+        registerFunctionModifier(SourceSystemFunctions.DAYOFMONTH, new ExtractFunctionModifier("DAY"));//$NON-NLS-1$ //$NON-NLS-2$
+        registerFunctionModifier(SourceSystemFunctions.MONTHNAME, new MonthOrDayNameFunctionModifier(getLanguageFactory(), "Month"));//$NON-NLS-1$ //$NON-NLS-2$
+        registerFunctionModifier(SourceSystemFunctions.DAYNAME, new MonthOrDayNameFunctionModifier(getLanguageFactory(), "Day"));//$NON-NLS-1$ //$NON-NLS-2$
+        registerFunctionModifier(SourceSystemFunctions.WEEK, new DayWeekQuarterFunctionModifier(getLanguageFactory(), "WW"));//$NON-NLS-1$ //$NON-NLS-2$
+        registerFunctionModifier(SourceSystemFunctions.QUARTER, new DayWeekQuarterFunctionModifier(getLanguageFactory(), "Q"));//$NON-NLS-1$ //$NON-NLS-2$
+        registerFunctionModifier(SourceSystemFunctions.DAYOFWEEK, new DayWeekQuarterFunctionModifier(getLanguageFactory(), "D"));//$NON-NLS-1$ //$NON-NLS-2$
+        registerFunctionModifier(SourceSystemFunctions.DAYOFYEAR, new DayWeekQuarterFunctionModifier(getLanguageFactory(), "DDD"));//$NON-NLS-1$ //$NON-NLS-2$      
+        registerFunctionModifier(SourceSystemFunctions.LOCATE, new LocateFunctionModifier(getLanguageFactory()));//$NON-NLS-1$
+        registerFunctionModifier(SourceSystemFunctions.SUBSTRING, new AliasModifier("substr"));//$NON-NLS-1$ //$NON-NLS-2$
+        registerFunctionModifier(SourceSystemFunctions.LEFT, new LeftOrRightFunctionModifier(getLanguageFactory()));//$NON-NLS-1$ //$NON-NLS-2$
+        registerFunctionModifier(SourceSystemFunctions.RIGHT, new LeftOrRightFunctionModifier(getLanguageFactory()));//$NON-NLS-1$ //$NON-NLS-2$
+        registerFunctionModifier(SourceSystemFunctions.CONCAT, new ConcatFunctionModifier(getLanguageFactory())); //$NON-NLS-1$
+    }
+    
+    @Override
+    public ICommand modifyCommand(ICommand command, ExecutionContext context)
+    		throws ConnectorException {
+    	if (!(command instanceof IInsert)) {
+    		return command;
+    	}
+    	
+        /* 
+         * If a missing auto_increment column is modeled with name in source indicating that an Oracle Sequence 
+         * then pull the Sequence name out of the name in source of the column.
+         */
+    	IInsert insert = (IInsert)command;
+    	List<Element> allElements = insert.getGroup().getMetadataObject().getChildren();
+    	if (allElements.size() == insert.getValues().size()) {
+    		return command;
+    	}
+    	
+    	int index = 0;
+    	List<IElement> elements = insert.getElements();
+    	
+    	for (Element element : allElements) {
+    		if (!element.isAutoIncremented()) {
+    			continue;
+    		}
+    		String name = element.getNameInSource();
+    		int seqIndex = name.indexOf(SEQUENCE);
+    		if (seqIndex == -1) {
+    			continue;
+    		}
+    		boolean found = false;
+    		while (index < elements.size()) {
+    			if (element.equals(elements.get(index).getMetadataObject())) {
+    				found = true;
+    				break;
+    			}
+    			index++;
+    		}
+    		if (found) {
+    			continue;
+    		}
+    		
+            String sequence = name.substring(seqIndex + SEQUENCE.length());
+            
+            int delimiterIndex = sequence.indexOf(SQLReservedWords.DOT);
+            if (delimiterIndex == -1) {
+            	throw new ConnectorException("Invalid name in source sequence format.  Expected <element name>" + SEQUENCE + "<sequence name>.<sequence value>, but was " + name);
+            }
+            String sequenceGroupName = sequence.substring(0, delimiterIndex);
+            String sequenceElementName = sequence.substring(delimiterIndex + 1);
+                
+            IGroup sequenceGroup = this.getLanguageFactory().createGroup(sequenceGroupName, null, null);
+            IElement sequenceElement = this.getLanguageFactory().createElement(sequenceElementName, sequenceGroup, null, element.getJavaType());
+            insert.getElements().add(index, this.getLanguageFactory().createElement(element.getName(), insert.getGroup(), element, element.getJavaType()));
+            insert.getValues().add(index, sequenceElement);
+		}
+        return command;
+    }
+
+    @Override
+    public String addLimitString(String queryCommand, ILimit limit) {
+    	StringBuffer limitQuery = new StringBuffer(queryCommand.length());
+		if (limit.getRowOffset() > 0) {
+			limitQuery.append("SELECT * FROM (SELECT VIEW_FOR_LIMIT.*, ROWNUM ROWNUM_ FROM (");
+		} else {
+			limitQuery.append("SELECT * FROM (");
+		}
+		limitQuery.append(queryCommand);
+		if (limit.getRowOffset() > 0) {
+			limitQuery.append(") VIEW_FOR_LIMIT WHERE ROWNUM <= ").append(
+					limit.getRowLimit()).append(") WHERE ROWNUM_ > ").append(
+					limit.getRowOffset());
+		} else {
+			limitQuery.append(") WHERE ROWNUM <= ").append(
+					limit.getRowLimit());
+		}
+		return limitQuery.toString();
+    }
+    
+    @Override
+    public boolean useAsInGroupAlias(){
+        return false;
+    }
+    
+    @Override
+    public String getSetOperationString(Operation operation) {
+    	if (operation == Operation.EXCEPT) {
+    		return "MINUS"; //$NON-NLS-1$
+    	}
+    	return super.getSetOperationString(operation);
+    }
+    
+    @Override
+    public String getSourceComment(ExecutionContext context, ICommand command) {
+    	String comment = super.getSourceComment(context, command);
+    	
+    	if (context != null) {
+	    	// Check for db hints
+		    Object payload = context.getExecutionPayload();
+		    if (payload instanceof String) {
+		        String payloadString = (String)payload;
+		        if (payloadString.startsWith(HINT_PREFIX)) {
+		            comment += payloadString + " "; //$NON-NLS-1$
+		        }
+		    }
+    	}
+    	return comment;
+    }
+    
+    /**
+     * Don't fully qualify elements if table = DUAL or element = ROWNUM or special stuff is packed into name in source value.
+     *  
+     * @see com.metamatrix.connector.visitor.util.SQLStringVisitor#skipGroupInElement(java.lang.String, java.lang.String)
+     * @since 5.0
+     */
+    @Override
+    public String replaceElementName(String group, String element) {        
+
+        // Check if the element was modeled as using a Sequence
+        int useIndex = element.indexOf(SEQUENCE);
+        if (useIndex >= 0) {
+        	String name = element.substring(0, useIndex);
+        	if (group != null) {
+        		return group + SQLReservedWords.DOT + name;
+        	}
+        	return name;
+        }
+
+        // Check if the group name should be discarded
+        if((group != null && group.equalsIgnoreCase(DUAL)) || element.equalsIgnoreCase(ROWNUM)) {
+            // Strip group if group or element are pseudo-columns
+            return element;
+        }
+        
+        return null;
+    }
+    
+    @Override
+    public boolean hasTimeType() {
+    	return false;
+    }
+    
+    @Override
+    public String getDefaultConnectionTestQuery() {
+    	return "Select 'x' from DUAL"; //$NON-NLS-1$
+    }
+    
+    @Override
+    public void bindValue(PreparedStatement stmt, Object param, Class paramType, int i) throws SQLException {
+    	if(param == null && Object.class.equals(paramType)){
+    		//Oracle drive does not support JAVA_OBJECT type
+    		stmt.setNull(i, Types.LONGVARBINARY);
+    		return;
+    	}
+    	super.bindValue(stmt, param, paramType, i);
+    }
+    
+    @Override
+    public void afterInitialConnectionCreation(Connection connection) {
+    	String errorStr = JDBCPlugin.Util.getString("ConnectionListener.failed_to_report_oracle_connection_details"); //$NON-NLS-1$
+    	ResultSet rs = null;
+        Statement stmt = null;
+        try {                
+            stmt = connection.createStatement();
+            rs = stmt.executeQuery("select * from v$instance"); 
+            
+            int columnCount = rs.getMetaData().getColumnCount();
+            while (rs.next()) {
+                StringBuffer sb = new StringBuffer();
+                for (int i = 1; i <= columnCount; i++) {
+                    sb.append(rs.getMetaData().getColumnName(i)).append("=").append(rs.getString(i)).append(";"); //$NON-NLS-1$ //$NON-NLS-2$
+                }                    
+                // log the queried information
+                getEnvironment().getLogger().logInfo(sb.toString());                    
+            }                
+            
+        } catch (SQLException e) {
+            getEnvironment().getLogger().logInfo(errorStr); 
+        }finally {
+            try {
+                if (rs != null) {
+                    rs.close();
+                } 
+                if (stmt != null) {
+                    stmt.close();
+                }
+            } catch (SQLException e1) {
+                getEnvironment().getLogger().logInfo(errorStr);
+            }
+        }
+    }
+}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql)


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/DatePartFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql/DatePartFunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/DatePartFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,49 +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.jdbc.postgresql;
-
-import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.ILanguageFactory;
-
-
-/** 
- * @since 4.3
- */
-class DatePartFunctionModifier extends BasicFunctionModifier {
-    
-    protected ILanguageFactory factory;
-    private String part;
-
-    DatePartFunctionModifier(ILanguageFactory langFactory, String partName) {
-        this.factory = langFactory;
-        this.part = partName;
-    }
-
-    public IExpression modify(IFunction function) {
-        return factory.createFunction("date_part", //$NON-NLS-1$
-                                       new IExpression[] {factory.createLiteral(part, String.class), function.getParameters()[0]},
-                                       Integer.class);
-    }
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/DatePartFunctionModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql/DatePartFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/DatePartFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/DatePartFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,52 @@
+/*
+ * 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.postgresql;
+
+import java.util.Arrays;
+
+import org.teiid.connector.jdbc.translator.BasicFunctionModifier;
+
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageFactory;
+
+
+/** 
+ * @since 4.3
+ */
+class DatePartFunctionModifier extends BasicFunctionModifier {
+    
+    protected ILanguageFactory factory;
+    private String part;
+
+    DatePartFunctionModifier(ILanguageFactory langFactory, String partName) {
+        this.factory = langFactory;
+        this.part = partName;
+    }
+
+    public IExpression modify(IFunction function) {
+        return factory.createFunction("date_part", //$NON-NLS-1$
+                                       Arrays.asList(factory.createLiteral(part, String.class), function.getParameters().get(0)),
+                                       Integer.class);
+    }
+}

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/ModifiedDatePartFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql/ModifiedDatePartFunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/ModifiedDatePartFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,52 +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.jdbc.postgresql;
-
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.ILanguageFactory;
-
-
-/** 
- * @since 4.3
- */
-class ModifiedDatePartFunctionModifier extends DatePartFunctionModifier {
-    
-    private String modifier;
-    private Object arg;
-
-    ModifiedDatePartFunctionModifier(ILanguageFactory factory, String partName, String modifierFunctionName, Object modifierArgument) {
-        super(factory, partName);
-        this.modifier = modifierFunctionName;
-        this.arg = modifierArgument;
-    }
-
-    public IExpression modify(IFunction function) {
-        IExpression expr = super.modify(function);
-        return factory.createFunction(modifier,
-                                       new IExpression[] {expr, factory.createLiteral(arg, arg.getClass())},
-                                       arg.getClass());
-    }
-    
-    
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/ModifiedDatePartFunctionModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql/ModifiedDatePartFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/ModifiedDatePartFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/ModifiedDatePartFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,54 @@
+/*
+ * 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.postgresql;
+
+import java.util.Arrays;
+
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageFactory;
+
+
+/** 
+ * @since 4.3
+ */
+class ModifiedDatePartFunctionModifier extends DatePartFunctionModifier {
+    
+    private String modifier;
+    private Object arg;
+
+    ModifiedDatePartFunctionModifier(ILanguageFactory factory, String partName, String modifierFunctionName, Object modifierArgument) {
+        super(factory, partName);
+        this.modifier = modifierFunctionName;
+        this.arg = modifierArgument;
+    }
+
+    public IExpression modify(IFunction function) {
+        IExpression expr = super.modify(function);
+        return factory.createFunction(modifier,
+                                       Arrays.asList(expr, factory.createLiteral(arg, arg.getClass())),
+                                       arg.getClass());
+    }
+    
+    
+}

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLCapabilities.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql/PostgreSQLCapabilities.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLCapabilities.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -20,12 +20,13 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.jdbc.postgresql;
+package org.teiid.connector.jdbc.postgresql;
 
 import java.util.ArrayList;
 import java.util.List;
+
+import org.teiid.connector.jdbc.JDBCCapabilities;
 
-import com.metamatrix.connector.jdbc.JDBCCapabilities;
 
 
 /** 
@@ -241,7 +242,7 @@
      * This is true only after Postgre version 7.1 
      * However, since version 7 was released in 2000 we'll assume a post 7 instance.
      * 
-     * @see com.metamatrix.connector.jdbc.JDBCCapabilities#supportsInlineViews()
+     * @see org.teiid.connector.jdbc.JDBCCapabilities#supportsInlineViews()
      */
     public boolean supportsInlineViews() {
         return true;

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql/PostgreSQLConvertModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLConvertModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,204 +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.jdbc.postgresql;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Arrays;
-import java.util.List;
-
-import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
-import com.metamatrix.connector.jdbc.translator.DropFunctionModifier;
-import com.metamatrix.connector.jdbc.translator.FunctionModifier;
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.ILanguageFactory;
-import com.metamatrix.connector.language.ILiteral;
-import com.metamatrix.connector.language.ICompareCriteria.Operator;
-
-/**
- */
-class PostgreSQLConvertModifier extends BasicFunctionModifier implements FunctionModifier {     
-    private static DropFunctionModifier DROP_MODIFIER = new DropFunctionModifier();
-    private ILanguageFactory langFactory;
-    
-    PostgreSQLConvertModifier(ILanguageFactory langFactory) {
-        this.langFactory = langFactory;
-    }
-
-    public List translate(IFunction function) {
-        return null;
-    }    
-    
-    public IExpression modify(IFunction function) {
-        IExpression[] args = function.getParameters();
-
-        if (args[0] != null && args[0] instanceof ILiteral && ((ILiteral)args[0]).getValue() == null ) {
-            if (args[1] != null && args[1] instanceof ILiteral) {
-                // This is a convert(null, ...) or cast(null as ...)
-                return DROP_MODIFIER.modify(function);
-            }
-        } 
-        
-        if (args[1] != null && args[1] instanceof ILiteral) {
-            String target = ((String)((ILiteral)args[1]).getValue()).toLowerCase();
-            if (target.equals("string")) {  //$NON-NLS-1$ 
-                return convertToString(function);
-            } else if (target.equals("short")) {  //$NON-NLS-1$ 
-                return createCastFunction(args[0], "smallint", Short.class); //$NON-NLS-1$
-            } else if (target.equals("integer")) { //$NON-NLS-1$ 
-                return createCastFunction(args[0], "integer", Integer.class); //$NON-NLS-1$
-            } else if (target.equals("long")) { //$NON-NLS-1$ 
-                return createCastFunction(args[0], "bigint", Long.class); //$NON-NLS-1$
-            } else if (target.equals("biginteger")) { //$NON-NLS-1$ 
-                return createCastFunction(args[0], "numeric", BigInteger.class); //$NON-NLS-1$
-            } else if (target.equals("float")) { //$NON-NLS-1$ 
-                return createCastFunction(args[0], "real", Float.class); //$NON-NLS-1$
-            } else if (target.equals("double")) { //$NON-NLS-1$ 
-                return createCastFunction(args[0], "float8", Double.class); //$NON-NLS-1$
-            } else if (target.equals("bigdecimal")) { //$NON-NLS-1$ 
-                return createCastFunction(args[0], "decimal", BigDecimal.class); //$NON-NLS-1$
-            } else if (target.equals("date")) { //$NON-NLS-1$ 
-                return convertToDate(function);
-            } else if (target.equals("time")) { //$NON-NLS-1$ 
-                return convertToTime(function);
-            } else if (target.equals("timestamp")) { //$NON-NLS-1$ 
-                return convertToTimestamp(function);
-            } else if (target.equals("char")) { //$NON-NLS-1$ 
-                return createCastFunction(args[0], "varchar", String.class); //$NON-NLS-1$
-            } else if (target.equals("boolean")) {  //$NON-NLS-1$ 
-                return createCastFunction(args[0], "boolean", Boolean.class); //$NON-NLS-1$
-            } else if (target.equals("byte")) {  //$NON-NLS-1$ 
-                return createCastFunction(args[0], "smallint", Byte.class); //$NON-NLS-1$
-            }
-        }
-        return DROP_MODIFIER.modify(function); 
-    }
-    
-    private IExpression convertToDate(IFunction function) {
-        IExpression[] args = function.getParameters();
-        int srcCode = getSrcCode(function);
-
-        switch(srcCode) {
-            case STRING:
-                return createConversionFunction("to_date", args[0], "YYYY-MM-DD", java.sql.Date.class); //$NON-NLS-1$//$NON-NLS-2$
-            case TIMESTAMP:
-                return createCastFunction(args[0], "date", java.sql.Date.class); //$NON-NLS-1$
-            default:
-                return DROP_MODIFIER.modify(function);
-        }
-    }
-
-    private IExpression convertToTime(IFunction function) {
-        IExpression[] args = function.getParameters();
-        
-        int srcCode = getSrcCode(function);
-        switch(srcCode) {
-            case STRING:
-                //convert(STRING, time) --> to_timestamp('1970-01-01 ' || timevalue, 'YYYY-MM-DD HH24:MI:SS')
-                IExpression prependedPart0 = langFactory.createFunction("||",  //$NON-NLS-1$
-                                                                          new IExpression[] {langFactory.createLiteral("1970-01-01 ", String.class), args[0]},  //$NON-NLS-1$
-                                                                          String.class);    
-                    
-                return createConversionFunction("to_timestamp", prependedPart0, "YYYY-MM-DD HH24:MI:SS", java.sql.Time.class); //$NON-NLS-1$ //$NON-NLS-2$
-            case TIMESTAMP:
-                return createCastFunction(args[0], "time", java.sql.Time.class); //$NON-NLS-1$
-            default:
-                return DROP_MODIFIER.modify(function);
-        }
-    }    
-    
-    /**
-     * This works only for Oracle 9i.
-     * @param src
-     * @return IFunction
-     */
-    private IExpression convertToTimestamp(IFunction function) {
-        IExpression[] args = function.getParameters();
-        int srcCode = getSrcCode(function);
-        switch(srcCode) {
-            case STRING:
-                // convert(STRING, timestamp) --> to_date(timestampvalue, 'YYYY-MM-DD HH24:MI:SS'))) from smalla 
-                return createConversionFunction("to_timestamp", args[0], "YYYY-MM-DD HH24:MI:SS.UF", java.sql.Timestamp.class); //$NON-NLS-1$ //$NON-NLS-2$
-            case TIME:
-            case DATE:
-                // convert(DATE, timestamp) --> to_date(to_char(DATE, 'YYYY-MM-DD HH24:MI:SS'), 'YYYY-MM-DD HH24:MI:SS')
-                IFunction inner = createStringFunction(args[0], "YYYY-MM-DD HH24:MI:SS");  //$NON-NLS-1$
-                        
-                return createConversionFunction("to_timestamp", inner, "YYYY-MM-DD HH24:MI:SS", java.sql.Timestamp.class); //$NON-NLS-1$ //$NON-NLS-2$
-            default:
-                return DROP_MODIFIER.modify(function);
-        }
-    }
-    
-    private IExpression convertToString(IFunction function) {
-        IExpression[] args = function.getParameters();
-
-        int srcCode = getSrcCode(function);
-        switch(srcCode) { 
-            case BOOLEAN:
-                // convert(booleanSrc, string) --> CASE WHEN booleanSrc THEN '1' ELSE '0' END
-                List when = Arrays.asList(langFactory.createCompareCriteria(Operator.EQ, function.getParameters()[0], langFactory.createLiteral(Boolean.TRUE, Boolean.class)));
-                List then = Arrays.asList(new IExpression[] {langFactory.createLiteral("1", String.class)}); //$NON-NLS-1$
-                IExpression elseExpr = langFactory.createLiteral("0", String.class); //$NON-NLS-1$
-                return langFactory.createSearchedCaseExpression(when, then, elseExpr, String.class);
-            case BYTE:
-            case SHORT:
-            case INTEGER:
-            case LONG:
-            case BIGINTEGER:
-            case FLOAT:
-            case DOUBLE:
-            case BIGDECIMAL:
-                // convert(src, string) --> cast (src AS varchar)
-                return createCastFunction(args[0], "varchar", String.class); //$NON-NLS-1$
-            // convert(input, string) --> to_char(input, format)
-            case DATE:
-                return createStringFunction(args[0], "YYYY-MM-DD"); //$NON-NLS-1$
-            case TIME:
-                return createStringFunction(args[0], "HH24:MI:SS"); //$NON-NLS-1$
-            case TIMESTAMP:
-                return createStringFunction(args[0], "YYYY-MM-DD HH24:MI:SS.US"); //$NON-NLS-1$
-            default:
-                return DROP_MODIFIER.modify(function);
-        }
-    }
-
-    private IFunction createStringFunction(IExpression args0, String format) {
-        return createConversionFunction("to_char", args0, format, String.class); //$NON-NLS-1$           
-    }
-    
-    private IFunction createCastFunction(IExpression value, String typeName, Class targetClass) {
-        return createConversionFunction("cast", value, typeName, targetClass); //$NON-NLS-1$
-    }
-
-    private IFunction createConversionFunction(String functionName, IExpression value, String target, Class targetClass) {
-        return langFactory.createFunction(functionName, new IExpression[] {value, langFactory.createLiteral(target, String.class)}, targetClass);
-    }
-    
-    private int getSrcCode(IFunction function) {
-        IExpression[] args = function.getParameters();
-        Class srcType = args[0].getType();
-        return ((Integer) typeMap.get(srcType)).intValue();
-    }
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLConvertModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql/PostgreSQLConvertModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLConvertModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLConvertModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,205 @@
+/*
+ * 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.postgresql;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.connector.jdbc.translator.BasicFunctionModifier;
+import org.teiid.connector.jdbc.translator.DropFunctionModifier;
+import org.teiid.connector.jdbc.translator.FunctionModifier;
+
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageFactory;
+import com.metamatrix.connector.language.ILiteral;
+import com.metamatrix.connector.language.ICompareCriteria.Operator;
+
+/**
+ */
+class PostgreSQLConvertModifier extends BasicFunctionModifier implements FunctionModifier {     
+    private static DropFunctionModifier DROP_MODIFIER = new DropFunctionModifier();
+    private ILanguageFactory langFactory;
+    
+    PostgreSQLConvertModifier(ILanguageFactory langFactory) {
+        this.langFactory = langFactory;
+    }
+
+    public List translate(IFunction function) {
+        return null;
+    }    
+    
+    public IExpression modify(IFunction function) {
+        List<IExpression> args = function.getParameters();
+
+        if (args.get(0) != null && args.get(0) instanceof ILiteral && ((ILiteral)args.get(0)).getValue() == null ) {
+            if (args.get(1) != null && args.get(1) instanceof ILiteral) {
+                // This is a convert(null, ...) or cast(null as ...)
+                return DROP_MODIFIER.modify(function);
+            }
+        } 
+        
+        if (args.get(1) != null && args.get(1) instanceof ILiteral) {
+            String target = ((String)((ILiteral)args.get(1)).getValue()).toLowerCase();
+            if (target.equals("string")) {  //$NON-NLS-1$ 
+                return convertToString(function);
+            } else if (target.equals("short")) {  //$NON-NLS-1$ 
+                return createCastFunction(args.get(0), "smallint", Short.class); //$NON-NLS-1$
+            } else if (target.equals("integer")) { //$NON-NLS-1$ 
+                return createCastFunction(args.get(0), "integer", Integer.class); //$NON-NLS-1$
+            } else if (target.equals("long")) { //$NON-NLS-1$ 
+                return createCastFunction(args.get(0), "bigint", Long.class); //$NON-NLS-1$
+            } else if (target.equals("biginteger")) { //$NON-NLS-1$ 
+                return createCastFunction(args.get(0), "numeric", BigInteger.class); //$NON-NLS-1$
+            } else if (target.equals("float")) { //$NON-NLS-1$ 
+                return createCastFunction(args.get(0), "real", Float.class); //$NON-NLS-1$
+            } else if (target.equals("double")) { //$NON-NLS-1$ 
+                return createCastFunction(args.get(0), "float8", Double.class); //$NON-NLS-1$
+            } else if (target.equals("bigdecimal")) { //$NON-NLS-1$ 
+                return createCastFunction(args.get(0), "decimal", BigDecimal.class); //$NON-NLS-1$
+            } else if (target.equals("date")) { //$NON-NLS-1$ 
+                return convertToDate(function);
+            } else if (target.equals("time")) { //$NON-NLS-1$ 
+                return convertToTime(function);
+            } else if (target.equals("timestamp")) { //$NON-NLS-1$ 
+                return convertToTimestamp(function);
+            } else if (target.equals("char")) { //$NON-NLS-1$ 
+                return createCastFunction(args.get(0), "varchar", String.class); //$NON-NLS-1$
+            } else if (target.equals("boolean")) {  //$NON-NLS-1$ 
+                return createCastFunction(args.get(0), "boolean", Boolean.class); //$NON-NLS-1$
+            } else if (target.equals("byte")) {  //$NON-NLS-1$ 
+                return createCastFunction(args.get(0), "smallint", Byte.class); //$NON-NLS-1$
+            }
+        }
+        return DROP_MODIFIER.modify(function); 
+    }
+    
+    private IExpression convertToDate(IFunction function) {
+        List<IExpression> args = function.getParameters();
+        int srcCode = getSrcCode(function);
+
+        switch(srcCode) {
+            case STRING:
+                return createConversionFunction("to_date", args.get(0), "YYYY-MM-DD", java.sql.Date.class); //$NON-NLS-1$//$NON-NLS-2$
+            case TIMESTAMP:
+                return createCastFunction(args.get(0), "date", java.sql.Date.class); //$NON-NLS-1$
+            default:
+                return DROP_MODIFIER.modify(function);
+        }
+    }
+
+    private IExpression convertToTime(IFunction function) {
+        List<IExpression> args = function.getParameters();
+        
+        int srcCode = getSrcCode(function);
+        switch(srcCode) {
+            case STRING:
+                //convert(STRING, time) --> to_timestamp('1970-01-01 ' || timevalue, 'YYYY-MM-DD HH24:MI:SS')
+                IExpression prependedPart0 = langFactory.createFunction("||",  //$NON-NLS-1$
+                                                                          Arrays.asList(langFactory.createLiteral("1970-01-01 ", String.class), args.get(0)),  //$NON-NLS-1$
+                                                                          String.class);    
+                    
+                return createConversionFunction("to_timestamp", prependedPart0, "YYYY-MM-DD HH24:MI:SS", java.sql.Time.class); //$NON-NLS-1$ //$NON-NLS-2$
+            case TIMESTAMP:
+                return createCastFunction(args.get(0), "time", java.sql.Time.class); //$NON-NLS-1$
+            default:
+                return DROP_MODIFIER.modify(function);
+        }
+    }    
+    
+    /**
+     * This works only for Oracle 9i.
+     * @param src
+     * @return IFunction
+     */
+    private IExpression convertToTimestamp(IFunction function) {
+        List<IExpression> args = function.getParameters();
+        int srcCode = getSrcCode(function);
+        switch(srcCode) {
+            case STRING:
+                // convert(STRING, timestamp) --> to_date(timestampvalue, 'YYYY-MM-DD HH24:MI:SS'))) from smalla 
+                return createConversionFunction("to_timestamp", args.get(0), "YYYY-MM-DD HH24:MI:SS.UF", java.sql.Timestamp.class); //$NON-NLS-1$ //$NON-NLS-2$
+            case TIME:
+            case DATE:
+                // convert(DATE, timestamp) --> to_date(to_char(DATE, 'YYYY-MM-DD HH24:MI:SS'), 'YYYY-MM-DD HH24:MI:SS')
+                IFunction inner = createStringFunction(args.get(0), "YYYY-MM-DD HH24:MI:SS");  //$NON-NLS-1$
+                        
+                return createConversionFunction("to_timestamp", inner, "YYYY-MM-DD HH24:MI:SS", java.sql.Timestamp.class); //$NON-NLS-1$ //$NON-NLS-2$
+            default:
+                return DROP_MODIFIER.modify(function);
+        }
+    }
+    
+    private IExpression convertToString(IFunction function) {
+        List<IExpression> args = function.getParameters();
+
+        int srcCode = getSrcCode(function);
+        switch(srcCode) { 
+            case BOOLEAN:
+                // convert(booleanSrc, string) --> CASE WHEN booleanSrc THEN '1' ELSE '0' END
+                List when = Arrays.asList(langFactory.createCompareCriteria(Operator.EQ, function.getParameters().get(0), langFactory.createLiteral(Boolean.TRUE, Boolean.class)));
+                List then = Arrays.asList(langFactory.createLiteral("1", String.class)); //$NON-NLS-1$
+                IExpression elseExpr = langFactory.createLiteral("0", String.class); //$NON-NLS-1$
+                return langFactory.createSearchedCaseExpression(when, then, elseExpr, String.class);
+            case BYTE:
+            case SHORT:
+            case INTEGER:
+            case LONG:
+            case BIGINTEGER:
+            case FLOAT:
+            case DOUBLE:
+            case BIGDECIMAL:
+                // convert(src, string) --> cast (src AS varchar)
+                return createCastFunction(args.get(0), "varchar", String.class); //$NON-NLS-1$
+            // convert(input, string) --> to_char(input, format)
+            case DATE:
+                return createStringFunction(args.get(0), "YYYY-MM-DD"); //$NON-NLS-1$
+            case TIME:
+                return createStringFunction(args.get(0), "HH24:MI:SS"); //$NON-NLS-1$
+            case TIMESTAMP:
+                return createStringFunction(args.get(0), "YYYY-MM-DD HH24:MI:SS.US"); //$NON-NLS-1$
+            default:
+                return DROP_MODIFIER.modify(function);
+        }
+    }
+
+    private IFunction createStringFunction(IExpression args0, String format) {
+        return createConversionFunction("to_char", args0, format, String.class); //$NON-NLS-1$           
+    }
+    
+    private IFunction createCastFunction(IExpression value, String typeName, Class targetClass) {
+        return createConversionFunction("cast", value, typeName, targetClass); //$NON-NLS-1$
+    }
+
+    private IFunction createConversionFunction(String functionName, IExpression value, String target, Class targetClass) {
+        return langFactory.createFunction(functionName, Arrays.asList(value, langFactory.createLiteral(target, String.class)), targetClass);
+    }
+    
+    private int getSrcCode(IFunction function) {
+        List<IExpression> args = function.getParameters();
+        Class srcType = args.get(0).getType();
+        return ((Integer) typeMap.get(srcType)).intValue();
+    }
+}

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/postgresql/PostgreSQLTranslator.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/postgresql/PostgreSQLTranslator.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -20,21 +20,22 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.jdbc.postgresql;
+package org.teiid.connector.jdbc.postgresql;
 
 import java.sql.Date;
 import java.sql.Time;
 import java.sql.Timestamp;
 
+import org.teiid.connector.jdbc.oracle.LeftOrRightFunctionModifier;
+import org.teiid.connector.jdbc.oracle.MonthOrDayNameFunctionModifier;
+import org.teiid.connector.jdbc.translator.AliasModifier;
+import org.teiid.connector.jdbc.translator.Translator;
+
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.ExecutionContext;
 import com.metamatrix.connector.api.SourceSystemFunctions;
 import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.oracle.LeftOrRightFunctionModifier;
-import com.metamatrix.connector.jdbc.oracle.MonthOrDayNameFunctionModifier;
-import com.metamatrix.connector.jdbc.translator.AliasModifier;
-import com.metamatrix.connector.jdbc.translator.Translator;
 import com.metamatrix.connector.language.IAggregate;
 import com.metamatrix.connector.language.ICommand;
 import com.metamatrix.connector.language.ILimit;

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sqlserver)


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SqlServerCapabilities.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sqlserver/SqlServerCapabilities.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SqlServerCapabilities.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -22,11 +22,12 @@
 
 /*
  */
-package com.metamatrix.connector.jdbc.sqlserver;
+package org.teiid.connector.jdbc.sqlserver;
 
 import java.util.*;
+
+import org.teiid.connector.jdbc.JDBCCapabilities;
 
-import com.metamatrix.connector.jdbc.JDBCCapabilities;
 
 /**
  */

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SqlServerSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sqlserver/SqlServerSQLTranslator.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sqlserver/SqlServerSQLTranslator.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -22,13 +22,14 @@
 
 /*
  */
-package com.metamatrix.connector.jdbc.sqlserver;
+package org.teiid.connector.jdbc.sqlserver;
 
+import org.teiid.connector.jdbc.sybase.SybaseSQLTranslator;
+import org.teiid.connector.jdbc.translator.AliasModifier;
+
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.SourceSystemFunctions;
-import com.metamatrix.connector.jdbc.sybase.SybaseSQLTranslator;
-import com.metamatrix.connector.jdbc.translator.AliasModifier;
 
 /**
  */

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/ssl (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/ssl)


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/ssl
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/ssl/SequeLinkOracleCapabilities.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/ssl/SequeLinkOracleCapabilities.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/ssl/SequeLinkOracleCapabilities.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -20,9 +20,9 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.jdbc.ssl;
+package org.teiid.connector.jdbc.ssl;
 
-import com.metamatrix.connector.jdbc.oracle.OracleCapabilities;
+import org.teiid.connector.jdbc.oracle.OracleCapabilities;
 
 
 /** 

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sybase)


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/ModFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sybase/ModFunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/ModFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.connector.jdbc.sybase;
-
-import java.util.List;
-
-import com.metamatrix.connector.api.TypeFacility.RUNTIME_TYPES;
-import com.metamatrix.connector.jdbc.translator.AliasModifier;
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.ILanguageFactory;
-
-public class ModFunctionModifier extends AliasModifier {
-
-	private ILanguageFactory langFactory;
-    
-    public ModFunctionModifier(ILanguageFactory langFactory) {
-    	super("%"); //$NON-NLS-1$
-        this.langFactory = langFactory;
-    }
-	
-	@Override
-	public IExpression modify(IFunction function) {
-		IExpression[] expressions = function.getParameters();
-		if (RUNTIME_TYPES.INTEGER.equals(expressions[0].getType())) {
-			return super.modify(function);
-		}
-		//x % y => x - floor(x / y) * y
-		IExpression[] divideArgs = new IExpression[2];
-		System.arraycopy(expressions, 0, divideArgs, 0, 2);
-		IFunction divide = langFactory.createFunction("/", divideArgs, divideArgs[0].getType()); //$NON-NLS-1$
-		
-		IFunction floor = langFactory.createFunction("floor", new IExpression[] {divide}, divide.getType()); //$NON-NLS-1$
-		
-		IExpression[] multArgs = new IExpression[] {
-				floor, expressions[1]
-		};
-		IFunction mult = langFactory.createFunction("*", multArgs, multArgs[1].getType()); //$NON-NLS-1$
-		
-		IExpression[] minusArgs = new IExpression[] {
-				expressions[0], mult
-		};
-		return langFactory.createFunction("-", minusArgs, minusArgs[0].getType()); //$NON-NLS-1$
-	}
-	
-	@Override
-	public List translate(IFunction function) {
-		return null;
-	}
-
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/ModFunctionModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sybase/ModFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/ModFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/ModFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,69 @@
+/*
+ * 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.sybase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.connector.jdbc.translator.AliasModifier;
+
+import com.metamatrix.connector.api.TypeFacility.RUNTIME_TYPES;
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageFactory;
+
+public class ModFunctionModifier extends AliasModifier {
+
+	private ILanguageFactory langFactory;
+    
+    public ModFunctionModifier(ILanguageFactory langFactory) {
+    	super("%"); //$NON-NLS-1$
+        this.langFactory = langFactory;
+    }
+	
+	@Override
+	public IExpression modify(IFunction function) {
+		List<IExpression> expressions = function.getParameters();
+		if (RUNTIME_TYPES.INTEGER.equals(expressions.get(0).getType())) {
+			return super.modify(function);
+		}
+		//x % y => x - floor(x / y) * y
+		IFunction divide = langFactory.createFunction("/", new ArrayList<IExpression>(expressions), expressions.get(0).getType()); //$NON-NLS-1$
+		
+		IFunction floor = langFactory.createFunction("floor", Arrays.asList(divide), divide.getType()); //$NON-NLS-1$
+		
+		List<IExpression> multArgs = Arrays.asList(floor, expressions.get(1));
+		IFunction mult = langFactory.createFunction("*", multArgs, multArgs.get(1).getType()); //$NON-NLS-1$
+
+		List<IExpression> minusArgs = Arrays.asList(expressions.get(0), mult);
+		
+		return langFactory.createFunction("-", minusArgs, minusArgs.get(0).getType()); //$NON-NLS-1$
+	}
+	
+	@Override
+	public List translate(IFunction function) {
+		return null;
+	}
+
+}

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseCapabilities.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sybase/SybaseCapabilities.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseCapabilities.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -22,12 +22,13 @@
 
 /*
  */
-package com.metamatrix.connector.jdbc.sybase;
+package org.teiid.connector.jdbc.sybase;
 
 import java.util.ArrayList;
 import java.util.List;
+
+import org.teiid.connector.jdbc.JDBCCapabilities;
 
-import com.metamatrix.connector.jdbc.JDBCCapabilities;
 
 /**
  */

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sybase/SybaseConvertModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseConvertModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,509 +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.jdbc.sybase;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
-import com.metamatrix.connector.jdbc.translator.DropFunctionModifier;
-import com.metamatrix.connector.jdbc.translator.FunctionModifier;
-import com.metamatrix.connector.language.*;
-
-/**
- */
-public class SybaseConvertModifier extends BasicFunctionModifier implements FunctionModifier {
-
-    private static DropFunctionModifier DROP_MODIFIER = new DropFunctionModifier();
-    static {
-        // index of expressions in convert functions in Sybase is one, not zero
-        DROP_MODIFIER.setReplaceIndex(1);
-    }
-
-    private ILanguageFactory langFactory;
-    
-    public SybaseConvertModifier(ILanguageFactory langFactory) {
-        this.langFactory = langFactory;
-    }
-
-    public IExpression modify(IFunction function) {
-        IExpression[] args = function.getParameters();
-        IExpression modified = null;
-        
-        if (args[1] != null && args[1] instanceof ILiteral) {
-            String target = ((String)((ILiteral)args[1]).getValue()).toLowerCase();
-            if (target.equals("string")) {  //$NON-NLS-1$ 
-                modified = convertToString(function);
-            } else if (target.equals("short")) {  //$NON-NLS-1$ 
-                modified = convertToShort(function);
-            } else if (target.equals("integer")) { //$NON-NLS-1$ 
-                modified = convertToInteger(function);
-            } else if (target.equals("long")) { //$NON-NLS-1$ 
-                modified = convertToLong(function);
-            } else if (target.equals("biginteger")) { //$NON-NLS-1$ 
-                modified = convertToBigInteger(function);
-            } else if (target.equals("float")) { //$NON-NLS-1$ 
-                modified = convertToFloat(function);
-            } else if (target.equals("double")) { //$NON-NLS-1$ 
-                modified = convertToDouble(function);
-            } else if (target.equals("bigdecimal")) { //$NON-NLS-1$ 
-                modified = convertToBigDecimal(function);
-            } else if (target.equals("date")) { //$NON-NLS-1$ 
-                modified = convertToDate(function);
-            } else if (target.equals("time")) { //$NON-NLS-1$ 
-                modified = convertToTime(function);
-            } else if (target.equals("timestamp")) { //$NON-NLS-1$ 
-                modified = convertToTimestamp(function);
-            } else if (target.equals("char")) { //$NON-NLS-1$ 
-                modified = convertToChar(function);
-            } else if (target.equals("boolean")) {  //$NON-NLS-1$ 
-                modified = convertToBoolean(function);
-            } else if (target.equals("byte")) {  //$NON-NLS-1$ 
-                modified = convertToByte(function);
-            } else {
-                modified = DROP_MODIFIER.modify(function);          
-            }
-            return modified;
-            
-        }
-        return DROP_MODIFIER.modify(function); 
-    }
-    
-    /* 
-     * @see com.metamatrix.connector.jdbc.extension.FunctionModifier#translate(com.metamatrix.data.language.IFunction)
-     */
-    public List translate(IFunction function) {        
-        List parts = new ArrayList();
-        parts.add("convert("); //$NON-NLS-1$
-            
-        IExpression[] args = function.getParameters();
-        
-        if(args != null && args.length > 0) {
-            ILiteral type = (ILiteral) args[0];
-            String typeStr = type.getValue().toString();
-            
-            parts.add(typeStr);
-            
-            for(int i=1; i<args.length; i++) {
-                parts.add(", "); //$NON-NLS-1$
-                parts.add(args[i]);
-            }
-        }
-        parts.add(")"); //$NON-NLS-1$
-        return parts;
-    }
-    
-    private IExpression convertToBoolean(IFunction function) {
-        IExpression convert = null;
-        IExpression[] args = function.getParameters();
-        Class src = args[0].getType();
-        int srcCode = getSrcCode(src);
-        
-        switch(srcCode) {
-            case STRING:
-                //TODO: how to map the 'true' to '1' before it is translated to bit
-            case BYTE:
-            case SHORT:
-            case INTEGER:
-            case LONG:
-            case BIGINTEGER:
-            case FLOAT:
-            case DOUBLE:
-            case BIGDECIMAL:
-                convert = createFunction(args[0], "bit", Boolean.class); //$NON-NLS-1$      
-                break;                
-            default:
-                convert = DROP_MODIFIER.modify(function);
-                break;
-        }
-        
-        return convert;
-    }
-    
-    private IExpression convertToByte(IFunction function) {
-        IExpression convert = null;
-        IExpression[] args = function.getParameters();
-        Class src = args[0].getType();
-        int srcCode = getSrcCode(src);
-        
-        switch(srcCode) {
-            case STRING:
-            case BOOLEAN:
-            case SHORT: 
-            case INTEGER:
-            case LONG:
-            case BIGINTEGER:                     
-            case FLOAT:
-            case DOUBLE:
-            case BIGDECIMAL:
-                convert = createFunction(args[0], "tinyint", String.class);  //$NON-NLS-1$ 
-                break;  
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }
-    
-    private IExpression convertToString(IFunction function) {
-        IExpression convert = null;
-        IExpression[] args = function.getParameters();
-        Class src = args[0].getType();
-        int srcCode = getSrcCode(src);
-        
-        switch(srcCode) { 
-            case CHAR:
-            case BOOLEAN:
-            case BYTE: 
-            case SHORT:
-            case INTEGER:
-            case LONG:
-            case BIGINTEGER:
-            case FLOAT:
-            case DOUBLE:
-            case BIGDECIMAL:       
-                convert = createFunction(args[0], "varchar", String.class); //$NON-NLS-1$                                            
-                break;                        
-            case DATE: // convert(date, string) --> convert(varchar, date, 112) 
-                //TODO: what is the best format 111/110/101?
-                convert = createFunction(args[0], 101, String.class);
-                break;
-            case TIME: // convert(time, string) --> convert(varchar, time, 108)
-                convert = createFunction(args[0], 108, String.class);                        
-                break;
-            case TIMESTAMP:  // convert(time, string) --> convert(varchar, timestamp, 109)          
-                convert = createFunction(args[0], 109, String.class);                          
-                break;
-            default:
-                convert = DROP_MODIFIER.modify(function);
-                break;
-        }
-        
-        return convert;
-    }
-
-    private IExpression convertToShort(IFunction function) {
-        IExpression convert = null;
-        IExpression[] args = function.getParameters();
-        Class src = args[0].getType();
-        int srcCode = getSrcCode(src);
-
-        switch(srcCode) {
-            case STRING:
-            case BOOLEAN: 
-            case BYTE:    
-            case INTEGER:
-            case LONG:
-            case BIGINTEGER:
-            case FLOAT:
-            case DOUBLE:
-            case BIGDECIMAL:
-                convert = createFunction(args[0], "smallint", Short.class); //$NON-NLS-1$
-                break;
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }
-        
-    private IExpression convertToInteger(IFunction function) {
-        IExpression convert = null;
-        IExpression[] args = function.getParameters();
-        Class src = args[0].getType();
-        int srcCode = getSrcCode(src);
-
-        switch(srcCode) {
-            case STRING: 
-            case BOOLEAN:       
-            case BYTE:
-            case SHORT:
-            case LONG:
-            case BIGINTEGER:
-            case FLOAT:
-            case DOUBLE:
-            case BIGDECIMAL:
-                convert = createFunction(args[0], "int", Integer.class); //$NON-NLS-1$
-                break;
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }
-      
-    private IExpression convertToLong(IFunction function) {
-        IExpression convert = null;
-        IExpression[] args = function.getParameters();
-        Class src = args[0].getType();
-        int srcCode = getSrcCode(src);
-
-        switch(srcCode) {
-            case STRING:
-            case BOOLEAN:
-            case BYTE:
-            case SHORT:
-            case INTEGER:       
-            case BIGINTEGER:
-            case FLOAT:
-            case DOUBLE:
-            case BIGDECIMAL:
-                convert = createFunction(args[0], "numeric", Long.class); //$NON-NLS-1$
-                break;
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }
-    
-    private IExpression convertToBigInteger(IFunction function) {
-        IExpression convert = null;
-        IExpression[] args = function.getParameters();
-        Class src = args[0].getType();
-        int srcCode = getSrcCode(src);
-
-        switch(srcCode) {
-            case STRING:
-            case BOOLEAN:
-            case BYTE:
-            case SHORT:
-            case INTEGER:
-            case LONG:   
-            case FLOAT:
-            case DOUBLE:
-            case BIGDECIMAL:
-                convert = createFunction(args[0], "numeric", java.math.BigInteger.class); //$NON-NLS-1$
-                break;
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }
-
-    private IExpression convertToFloat(IFunction function) {
-        IExpression convert = null;
-        IExpression[] args = function.getParameters();
-        Class src = args[0].getType();
-        int srcCode = getSrcCode(src);
-
-        switch(srcCode) {
-            case STRING:
-            case BOOLEAN:        
-            case BYTE:
-            case SHORT:
-            case INTEGER:
-            case LONG:   
-            case BIGINTEGER:                                 
-            case DOUBLE: 
-            case BIGDECIMAL:
-                convert = createFunction(args[0], "real", Float.class); //$NON-NLS-1$
-                break;
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }   
-       
-    private IExpression convertToDouble(IFunction function) {
-        IExpression convert = null;
-        IExpression[] args = function.getParameters();
-        Class src = args[0].getType();
-        int srcCode = getSrcCode(src);
-
-        switch(srcCode) {
-            case STRING:
-            case BOOLEAN:      
-            case BYTE:
-            case SHORT:
-            case INTEGER:
-            case LONG:   
-            case BIGINTEGER:                                 
-            case FLOAT:       
-            case BIGDECIMAL:   
-                convert = createFunction(args[0], "float", Double.class); //$NON-NLS-1$
-                break;
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }
-    
-    private IExpression convertToBigDecimal(IFunction function) {
-        IExpression convert = null;
-        IExpression[] args = function.getParameters();
-        Class src = args[0].getType();
-        int srcCode = getSrcCode(src);
-
-        switch(srcCode) {
-            case STRING:
-            case BOOLEAN:         
-            case BYTE:
-            case SHORT:
-            case INTEGER:
-            case LONG:   
-            case BIGINTEGER:                                 
-            case FLOAT:       
-            case DOUBLE:
-                convert = createFunction(args[0], "float", java.math.BigDecimal.class); //$NON-NLS-1$
-                break;            
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }
-        
-    private IExpression convertToChar(IFunction function) {
-        IExpression[] args = function.getParameters();
-        return createFunction(args[0], "char", Character.class); //$NON-NLS-1$
-    } 
-             
-    private IExpression convertToDate(IFunction function) {
-        IExpression convert = null;
-        IExpression[] args = function.getParameters();
-        Class srcType = args[0].getType();
-        int srcCode = getSrcCode(srcType);
-
-        switch(srcCode) {
-            case STRING:
-                // convert(STRING, date) --> convert(datetime, STRING)
-                convert = createFunction(args[0], "datetime", java.sql.Date.class); //$NON-NLS-1$
-                break;
-            case TIMESTAMP:
-                // convert(TIMESTAMP, date) --> convert(datetime, convert(varchar, TIMESTAMP, 1/101))
-                // Build inner convert
-                IFunction innerConvert = langFactory.createFunction("convert",  //$NON-NLS-1$
-                    new IExpression[] { 
-                        langFactory.createLiteral("varchar", String.class),  //$NON-NLS-1$
-                        args[0],
-                        langFactory.createLiteral(new Integer(109), Integer.class) },
-                    String.class);
-                
-                // Build outer convert
-                convert = langFactory.createFunction("convert",  //$NON-NLS-1$
-                    new IExpression[] { 
-                        langFactory.createLiteral("datetime", String.class),  //$NON-NLS-1$
-                        innerConvert },
-                    java.sql.Timestamp.class);
-            
-                break;
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }
-
-    private IExpression convertToTime(IFunction function) {
-        IExpression convert = null;
-        IExpression[] args = function.getParameters();
-        Class srcType = args[0].getType();
-        
-        int srcCode = getSrcCode(srcType);
-        switch(srcCode) {
-            case STRING:
-                //convert(STRING, time) --> convert(datetime, STRING)
-                convert = createFunction(args[0], "datetime", java.sql.Time.class); //$NON-NLS-1$
-                break;                                                                 
-            case TIMESTAMP:
-                // convert(TIMESTAMP, time) --> convert(datetime, convert(varchar, TIMESTAMP, 108/8) 
-                // Build inner convert
-                IFunction innerConvert = langFactory.createFunction("convert",  //$NON-NLS-1$
-                    new IExpression[] { 
-                        langFactory.createLiteral("varchar", String.class),  //$NON-NLS-1$
-                        args[0],
-                        langFactory.createLiteral(new Integer(108), Integer.class) },
-                    String.class);
-                    
-                // Build outer convert
-                convert = langFactory.createFunction("convert",  //$NON-NLS-1$
-                    new IExpression[] { 
-                        langFactory.createLiteral("datetime", String.class),  //$NON-NLS-1$
-                        innerConvert },
-                    java.sql.Time.class);
-                                 
-                break;
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }    
-            
-    private IExpression convertToTimestamp(IFunction function) {
-        IExpression convert = null;
-        IExpression[] args = function.getParameters();
-        Class srcType = args[0].getType();
-        int srcCode = getSrcCode(srcType);
-        switch(srcCode) {
-            case STRING:
-            case TIME:                
-            case DATE:
-                // convert(DATE/TIME/STRING, timestamp) --> convert(datetime, DATE)
-                convert = createFunction(args[0], "datetime", java.sql.Timestamp.class); //$NON-NLS-1$ 
-                    break;              
-            default:
-                convert = DROP_MODIFIER.modify(function); 
-                break;
-        }
-        
-        return convert;
-    }
-    
-    private IFunction createFunction(IExpression args0, String targetType, Class targetClass) {
-        IFunction created = langFactory.createFunction("convert", //$NON-NLS-1$
-            new IExpression[] {
-                langFactory.createLiteral(targetType, String.class),
-                args0}, 
-                targetClass);
-        return created;            
-    }
-                
-    private IFunction createFunction(IExpression args0, int formatNumber, Class targetClass) {
-        IFunction created = langFactory.createFunction("convert",  //$NON-NLS-1$
-            new IExpression[] { langFactory.createLiteral("varchar", String.class), //$NON-NLS-1$ 
-                args0,
-                langFactory.createLiteral(new Integer(formatNumber), Integer.class) }, 
-                targetClass);
-        return created;            
-    }
-        
-    private int getSrcCode(Class source) {
-        return ((Integer) typeMap.get(source)).intValue();
-    }
-
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseConvertModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sybase/SybaseConvertModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseConvertModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseConvertModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,514 @@
+/*
+ * 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.sybase;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.connector.jdbc.translator.BasicFunctionModifier;
+import org.teiid.connector.jdbc.translator.DropFunctionModifier;
+import org.teiid.connector.jdbc.translator.FunctionModifier;
+
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageFactory;
+import com.metamatrix.connector.language.ILiteral;
+
+/**
+ */
+public class SybaseConvertModifier extends BasicFunctionModifier implements FunctionModifier {
+
+    private static DropFunctionModifier DROP_MODIFIER = new DropFunctionModifier();
+    static {
+        // index of expressions in convert functions in Sybase is one, not zero
+        DROP_MODIFIER.setReplaceIndex(1);
+    }
+
+    private ILanguageFactory langFactory;
+    
+    public SybaseConvertModifier(ILanguageFactory langFactory) {
+        this.langFactory = langFactory;
+    }
+
+    public IExpression modify(IFunction function) {
+        List<IExpression> args = function.getParameters();
+        IExpression modified = null;
+        
+        if (args.get(1) != null && args.get(1) instanceof ILiteral) {
+            String target = ((String)((ILiteral)args.get(1)).getValue()).toLowerCase();
+            if (target.equals("string")) {  //$NON-NLS-1$ 
+                modified = convertToString(function);
+            } else if (target.equals("short")) {  //$NON-NLS-1$ 
+                modified = convertToShort(function);
+            } else if (target.equals("integer")) { //$NON-NLS-1$ 
+                modified = convertToInteger(function);
+            } else if (target.equals("long")) { //$NON-NLS-1$ 
+                modified = convertToLong(function);
+            } else if (target.equals("biginteger")) { //$NON-NLS-1$ 
+                modified = convertToBigInteger(function);
+            } else if (target.equals("float")) { //$NON-NLS-1$ 
+                modified = convertToFloat(function);
+            } else if (target.equals("double")) { //$NON-NLS-1$ 
+                modified = convertToDouble(function);
+            } else if (target.equals("bigdecimal")) { //$NON-NLS-1$ 
+                modified = convertToBigDecimal(function);
+            } else if (target.equals("date")) { //$NON-NLS-1$ 
+                modified = convertToDate(function);
+            } else if (target.equals("time")) { //$NON-NLS-1$ 
+                modified = convertToTime(function);
+            } else if (target.equals("timestamp")) { //$NON-NLS-1$ 
+                modified = convertToTimestamp(function);
+            } else if (target.equals("char")) { //$NON-NLS-1$ 
+                modified = convertToChar(function);
+            } else if (target.equals("boolean")) {  //$NON-NLS-1$ 
+                modified = convertToBoolean(function);
+            } else if (target.equals("byte")) {  //$NON-NLS-1$ 
+                modified = convertToByte(function);
+            } else {
+                modified = DROP_MODIFIER.modify(function);          
+            }
+            return modified;
+            
+        }
+        return DROP_MODIFIER.modify(function); 
+    }
+    
+    /* 
+     * @see com.metamatrix.connector.jdbc.extension.FunctionModifier#translate(com.metamatrix.data.language.IFunction)
+     */
+    public List translate(IFunction function) {        
+        List parts = new ArrayList();
+        parts.add("convert("); //$NON-NLS-1$
+            
+        List<IExpression> args = function.getParameters();
+        
+        if(args != null && args.size() > 0) {
+            ILiteral type = (ILiteral) args.get(0);
+            String typeStr = type.getValue().toString();
+            
+            parts.add(typeStr);
+            
+            for(int i=1; i<args.size(); i++) {
+                parts.add(", "); //$NON-NLS-1$
+                parts.add(args.get(i));
+            }
+        }
+        parts.add(")"); //$NON-NLS-1$
+        return parts;
+    }
+    
+    private IExpression convertToBoolean(IFunction function) {
+        IExpression convert = null;
+        List<IExpression> args = function.getParameters();
+        Class src = args.get(0).getType();
+        int srcCode = getSrcCode(src);
+        
+        switch(srcCode) {
+            case STRING:
+                //TODO: how to map the 'true' to '1' before it is translated to bit
+            case BYTE:
+            case SHORT:
+            case INTEGER:
+            case LONG:
+            case BIGINTEGER:
+            case FLOAT:
+            case DOUBLE:
+            case BIGDECIMAL:
+                convert = createFunction(args.get(0), "bit", Boolean.class); //$NON-NLS-1$      
+                break;                
+            default:
+                convert = DROP_MODIFIER.modify(function);
+                break;
+        }
+        
+        return convert;
+    }
+    
+    private IExpression convertToByte(IFunction function) {
+        IExpression convert = null;
+        List<IExpression> args = function.getParameters();
+        Class src = args.get(0).getType();
+        int srcCode = getSrcCode(src);
+        
+        switch(srcCode) {
+            case STRING:
+            case BOOLEAN:
+            case SHORT: 
+            case INTEGER:
+            case LONG:
+            case BIGINTEGER:                     
+            case FLOAT:
+            case DOUBLE:
+            case BIGDECIMAL:
+                convert = createFunction(args.get(0), "tinyint", String.class);  //$NON-NLS-1$ 
+                break;  
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }
+    
+    private IExpression convertToString(IFunction function) {
+        IExpression convert = null;
+        List<IExpression> args = function.getParameters();
+        Class src = args.get(0).getType();
+        int srcCode = getSrcCode(src);
+        
+        switch(srcCode) { 
+            case CHAR:
+            case BOOLEAN:
+            case BYTE: 
+            case SHORT:
+            case INTEGER:
+            case LONG:
+            case BIGINTEGER:
+            case FLOAT:
+            case DOUBLE:
+            case BIGDECIMAL:       
+                convert = createFunction(args.get(0), "varchar", String.class); //$NON-NLS-1$                                            
+                break;                        
+            case DATE: // convert(date, string) --> convert(varchar, date, 112) 
+                //TODO: what is the best format 111/110/101?
+                convert = createFunction(args.get(0), 101, String.class);
+                break;
+            case TIME: // convert(time, string) --> convert(varchar, time, 108)
+                convert = createFunction(args.get(0), 108, String.class);                        
+                break;
+            case TIMESTAMP:  // convert(time, string) --> convert(varchar, timestamp, 109)          
+                convert = createFunction(args.get(0), 109, String.class);                          
+                break;
+            default:
+                convert = DROP_MODIFIER.modify(function);
+                break;
+        }
+        
+        return convert;
+    }
+
+    private IExpression convertToShort(IFunction function) {
+        IExpression convert = null;
+        List<IExpression> args = function.getParameters();
+        Class src = args.get(0).getType();
+        int srcCode = getSrcCode(src);
+
+        switch(srcCode) {
+            case STRING:
+            case BOOLEAN: 
+            case BYTE:    
+            case INTEGER:
+            case LONG:
+            case BIGINTEGER:
+            case FLOAT:
+            case DOUBLE:
+            case BIGDECIMAL:
+                convert = createFunction(args.get(0), "smallint", Short.class); //$NON-NLS-1$
+                break;
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }
+        
+    private IExpression convertToInteger(IFunction function) {
+        IExpression convert = null;
+        List<IExpression> args = function.getParameters();
+        Class src = args.get(0).getType();
+        int srcCode = getSrcCode(src);
+
+        switch(srcCode) {
+            case STRING: 
+            case BOOLEAN:       
+            case BYTE:
+            case SHORT:
+            case LONG:
+            case BIGINTEGER:
+            case FLOAT:
+            case DOUBLE:
+            case BIGDECIMAL:
+                convert = createFunction(args.get(0), "int", Integer.class); //$NON-NLS-1$
+                break;
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }
+      
+    private IExpression convertToLong(IFunction function) {
+        IExpression convert = null;
+        List<IExpression> args = function.getParameters();
+        Class src = args.get(0).getType();
+        int srcCode = getSrcCode(src);
+
+        switch(srcCode) {
+            case STRING:
+            case BOOLEAN:
+            case BYTE:
+            case SHORT:
+            case INTEGER:       
+            case BIGINTEGER:
+            case FLOAT:
+            case DOUBLE:
+            case BIGDECIMAL:
+                convert = createFunction(args.get(0), "numeric", Long.class); //$NON-NLS-1$
+                break;
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }
+    
+    private IExpression convertToBigInteger(IFunction function) {
+        IExpression convert = null;
+        List<IExpression> args = function.getParameters();
+        Class src = args.get(0).getType();
+        int srcCode = getSrcCode(src);
+
+        switch(srcCode) {
+            case STRING:
+            case BOOLEAN:
+            case BYTE:
+            case SHORT:
+            case INTEGER:
+            case LONG:   
+            case FLOAT:
+            case DOUBLE:
+            case BIGDECIMAL:
+                convert = createFunction(args.get(0), "numeric", java.math.BigInteger.class); //$NON-NLS-1$
+                break;
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }
+
+    private IExpression convertToFloat(IFunction function) {
+        IExpression convert = null;
+        List<IExpression> args = function.getParameters();
+        Class src = args.get(0).getType();
+        int srcCode = getSrcCode(src);
+
+        switch(srcCode) {
+            case STRING:
+            case BOOLEAN:        
+            case BYTE:
+            case SHORT:
+            case INTEGER:
+            case LONG:   
+            case BIGINTEGER:                                 
+            case DOUBLE: 
+            case BIGDECIMAL:
+                convert = createFunction(args.get(0), "real", Float.class); //$NON-NLS-1$
+                break;
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }   
+       
+    private IExpression convertToDouble(IFunction function) {
+        IExpression convert = null;
+        List<IExpression> args = function.getParameters();
+        Class src = args.get(0).getType();
+        int srcCode = getSrcCode(src);
+
+        switch(srcCode) {
+            case STRING:
+            case BOOLEAN:      
+            case BYTE:
+            case SHORT:
+            case INTEGER:
+            case LONG:   
+            case BIGINTEGER:                                 
+            case FLOAT:       
+            case BIGDECIMAL:   
+                convert = createFunction(args.get(0), "float", Double.class); //$NON-NLS-1$
+                break;
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }
+    
+    private IExpression convertToBigDecimal(IFunction function) {
+        IExpression convert = null;
+        List<IExpression> args = function.getParameters();
+        Class src = args.get(0).getType();
+        int srcCode = getSrcCode(src);
+
+        switch(srcCode) {
+            case STRING:
+            case BOOLEAN:         
+            case BYTE:
+            case SHORT:
+            case INTEGER:
+            case LONG:   
+            case BIGINTEGER:                                 
+            case FLOAT:       
+            case DOUBLE:
+                convert = createFunction(args.get(0), "float", java.math.BigDecimal.class); //$NON-NLS-1$
+                break;            
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }
+        
+    private IExpression convertToChar(IFunction function) {
+        List<IExpression> args = function.getParameters();
+        return createFunction(args.get(0), "char", Character.class); //$NON-NLS-1$
+    } 
+             
+    private IExpression convertToDate(IFunction function) {
+        IExpression convert = null;
+        List<IExpression> args = function.getParameters();
+        Class srcType = args.get(0).getType();
+        int srcCode = getSrcCode(srcType);
+
+        switch(srcCode) {
+            case STRING:
+                // convert(STRING, date) --> convert(datetime, STRING)
+                convert = createFunction(args.get(0), "datetime", java.sql.Date.class); //$NON-NLS-1$
+                break;
+            case TIMESTAMP:
+                // convert(TIMESTAMP, date) --> convert(datetime, convert(varchar, TIMESTAMP, 1/101))
+                // Build inner convert
+                IFunction innerConvert = langFactory.createFunction("convert",  //$NON-NLS-1$
+                    Arrays.asList( 
+                        langFactory.createLiteral("varchar", String.class),  //$NON-NLS-1$
+                        args.get(0),
+                        langFactory.createLiteral(new Integer(109), Integer.class) ),
+                    String.class);
+                
+                // Build outer convert
+                convert = langFactory.createFunction("convert",  //$NON-NLS-1$
+                    Arrays.asList( 
+                        langFactory.createLiteral("datetime", String.class),  //$NON-NLS-1$
+                        innerConvert ),
+                    java.sql.Timestamp.class);
+            
+                break;
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }
+
+    private IExpression convertToTime(IFunction function) {
+        IExpression convert = null;
+        List<IExpression> args = function.getParameters();
+        Class srcType = args.get(0).getType();
+        
+        int srcCode = getSrcCode(srcType);
+        switch(srcCode) {
+            case STRING:
+                //convert(STRING, time) --> convert(datetime, STRING)
+                convert = createFunction(args.get(0), "datetime", java.sql.Time.class); //$NON-NLS-1$
+                break;                                                                 
+            case TIMESTAMP:
+                // convert(TIMESTAMP, time) --> convert(datetime, convert(varchar, TIMESTAMP, 108/8) 
+                // Build inner convert
+                IFunction innerConvert = langFactory.createFunction("convert",  //$NON-NLS-1$
+                    Arrays.asList( 
+                        langFactory.createLiteral("varchar", String.class),  //$NON-NLS-1$
+                        args.get(0),
+                        langFactory.createLiteral(new Integer(108), Integer.class) ),
+                    String.class);
+                    
+                // Build outer convert
+                convert = langFactory.createFunction("convert",  //$NON-NLS-1$
+                    Arrays.asList( 
+                        langFactory.createLiteral("datetime", String.class),  //$NON-NLS-1$
+                        innerConvert ),
+                    java.sql.Time.class);
+                                 
+                break;
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }    
+            
+    private IExpression convertToTimestamp(IFunction function) {
+        IExpression convert = null;
+        List<IExpression> args = function.getParameters();
+        Class srcType = args.get(0).getType();
+        int srcCode = getSrcCode(srcType);
+        switch(srcCode) {
+            case STRING:
+            case TIME:                
+            case DATE:
+                // convert(DATE/TIME/STRING, timestamp) --> convert(datetime, DATE)
+                convert = createFunction(args.get(0), "datetime", java.sql.Timestamp.class); //$NON-NLS-1$ 
+                    break;              
+            default:
+                convert = DROP_MODIFIER.modify(function); 
+                break;
+        }
+        
+        return convert;
+    }
+    
+    private IFunction createFunction(IExpression args0, String targetType, Class targetClass) {
+        IFunction created = langFactory.createFunction("convert", //$NON-NLS-1$
+            Arrays.asList(
+                langFactory.createLiteral(targetType, String.class),
+                args0), 
+                targetClass);
+        return created;            
+    }
+                
+    private IFunction createFunction(IExpression args0, int formatNumber, Class targetClass) {
+        IFunction created = langFactory.createFunction("convert",  //$NON-NLS-1$
+            Arrays.asList( langFactory.createLiteral("varchar", String.class), //$NON-NLS-1$ 
+                args0,
+                langFactory.createLiteral(new Integer(formatNumber), Integer.class) ), 
+                targetClass);
+        return created;            
+    }
+        
+    private int getSrcCode(Class source) {
+        return ((Integer) typeMap.get(source)).intValue();
+    }
+
+}

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/sybase/SybaseSQLTranslator.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/sybase/SybaseSQLTranslator.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -22,14 +22,15 @@
 
 /*
  */
-package com.metamatrix.connector.jdbc.sybase;
+package org.teiid.connector.jdbc.sybase;
 
+import org.teiid.connector.jdbc.translator.AliasModifier;
+import org.teiid.connector.jdbc.translator.SubstringFunctionModifier;
+import org.teiid.connector.jdbc.translator.Translator;
+
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.SourceSystemFunctions;
-import com.metamatrix.connector.jdbc.translator.AliasModifier;
-import com.metamatrix.connector.jdbc.translator.SubstringFunctionModifier;
-import com.metamatrix.connector.jdbc.translator.Translator;
 import com.metamatrix.connector.language.ILimit;
 
 /**

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/teradata (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/teradata)


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/teradata
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/teradata/TeradataCapabilities.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/teradata/TeradataCapabilities.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/teradata/TeradataCapabilities.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -20,14 +20,15 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.jdbc.teradata;
+package org.teiid.connector.jdbc.teradata;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import com.metamatrix.connector.jdbc.JDBCCapabilities;
+import org.teiid.connector.jdbc.JDBCCapabilities;
 
 
+
 /** 
  * for Teradata database Release V2R5.1
  */

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator)


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/AliasModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/AliasModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/AliasModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -22,7 +22,7 @@
 
 /*
  */
-package com.metamatrix.connector.jdbc.translator;
+package org.teiid.connector.jdbc.translator;
 
 import com.metamatrix.connector.language.*;
 
@@ -41,7 +41,7 @@
     }
     
     /**
-     * @see com.metamatrix.connector.jdbc.translator.FunctionModifier#modify(com.metamatrix.connector.language.IFunction)
+     * @see org.teiid.connector.jdbc.translator.FunctionModifier#modify(com.metamatrix.connector.language.IFunction)
      */
     public IExpression modify(IFunction function) {
         function.setName(alias);

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/BasicFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/BasicFunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/BasicFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,116 +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.jdbc.translator;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-
-import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-
-/**
- */
-public abstract class BasicFunctionModifier implements FunctionModifier {
-
-    /*
-     * Public sharing part for the mapping between class and type in format of Map<class->Integer>.
-     */
-    public static final int STRING = 0;
-    public static final int CHAR = 1;
-    public static final int BOOLEAN = 2;
-    public static final int BYTE = 3;
-    public static final int SHORT = 4;
-    public static final int INTEGER = 5;
-    public static final int LONG = 6;
-    public static final int BIGINTEGER = 7;
-    public static final int FLOAT = 8;
-    public static final int DOUBLE = 9;
-    public static final int BIGDECIMAL = 10;
-    public static final int DATE = 11;
-    public static final int TIME = 12;
-    public static final int TIMESTAMP = 13;
-    public static final int OBJECT = 14;
-    public static final int BLOB = 15;
-    public static final int CLOB = 16;
-    public static final int XML = 17;
-
-    public static final Map typeMap = new HashMap();
-    
-    static {
-        typeMap.put(TypeFacility.RUNTIME_TYPES.STRING, new Integer(STRING));
-        typeMap.put(TypeFacility.RUNTIME_TYPES.CHAR, new Integer(CHAR));
-        typeMap.put(TypeFacility.RUNTIME_TYPES.BOOLEAN, new Integer(BOOLEAN));
-        typeMap.put(TypeFacility.RUNTIME_TYPES.BYTE, new Integer(BYTE));
-        typeMap.put(TypeFacility.RUNTIME_TYPES.SHORT, new Integer(SHORT));
-        typeMap.put(TypeFacility.RUNTIME_TYPES.INTEGER, new Integer(INTEGER));
-        typeMap.put(TypeFacility.RUNTIME_TYPES.LONG, new Integer(LONG));
-        typeMap.put(TypeFacility.RUNTIME_TYPES.BIG_INTEGER, new Integer(BIGINTEGER));
-        typeMap.put(TypeFacility.RUNTIME_TYPES.FLOAT, new Integer(FLOAT));
-        typeMap.put(TypeFacility.RUNTIME_TYPES.DOUBLE, new Integer(DOUBLE));
-        typeMap.put(TypeFacility.RUNTIME_TYPES.BIG_DECIMAL, new Integer(BIGDECIMAL));
-        typeMap.put(TypeFacility.RUNTIME_TYPES.DATE, new Integer(DATE));
-        typeMap.put(TypeFacility.RUNTIME_TYPES.TIME, new Integer(TIME));
-        typeMap.put(TypeFacility.RUNTIME_TYPES.TIMESTAMP, new Integer(TIMESTAMP));
-        typeMap.put(TypeFacility.RUNTIME_TYPES.OBJECT, new Integer(OBJECT));        
-        typeMap.put(TypeFacility.RUNTIME_TYPES.BLOB, new Integer(BLOB));
-        typeMap.put(TypeFacility.RUNTIME_TYPES.CLOB, new Integer(CLOB));
-        typeMap.put(TypeFacility.RUNTIME_TYPES.XML, new Integer(XML));
-    }    
-    
-    /**
-     * Subclass should override this method as needed.
-     * @see com.metamatrix.connector.jdbc.translator.FunctionModifier#modify(com.metamatrix.connector.language.IFunction)
-     */
-    public IExpression modify(IFunction function) {
-        return function;
-    }
-
-    /**
-     * Subclass should override this method as needed.
-     * @see com.metamatrix.connector.jdbc.translator.FunctionModifier#translate(com.metamatrix.connector.language.IFunction)
-     */
-    public List translate(IFunction function) {
-        List objs = new ArrayList();
-        objs.add(function.getName());
-        objs.add("("); //$NON-NLS-1$
-        IExpression[] params = function.getParameters();
-        if(params.length > 0) { 
-            objs.add(params[0]);
-            if(params.length > 1) {
-                for(int i=1; i<params.length; i++) {
-                    objs.add(", "); //$NON-NLS-1$
-                    objs.add(params[i]);
-                }
-            }
-        }
-        objs.add(")"); //$NON-NLS-1$
-
-        return objs;
-    }
-
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/BasicFunctionModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/BasicFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/BasicFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/BasicFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,116 @@
+/*
+ * 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.translator;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+
+import com.metamatrix.connector.api.TypeFacility;
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+
+/**
+ */
+public abstract class BasicFunctionModifier implements FunctionModifier {
+
+    /*
+     * Public sharing part for the mapping between class and type in format of Map<class->Integer>.
+     */
+    public static final int STRING = 0;
+    public static final int CHAR = 1;
+    public static final int BOOLEAN = 2;
+    public static final int BYTE = 3;
+    public static final int SHORT = 4;
+    public static final int INTEGER = 5;
+    public static final int LONG = 6;
+    public static final int BIGINTEGER = 7;
+    public static final int FLOAT = 8;
+    public static final int DOUBLE = 9;
+    public static final int BIGDECIMAL = 10;
+    public static final int DATE = 11;
+    public static final int TIME = 12;
+    public static final int TIMESTAMP = 13;
+    public static final int OBJECT = 14;
+    public static final int BLOB = 15;
+    public static final int CLOB = 16;
+    public static final int XML = 17;
+
+    public static final Map typeMap = new HashMap();
+    
+    static {
+        typeMap.put(TypeFacility.RUNTIME_TYPES.STRING, new Integer(STRING));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.CHAR, new Integer(CHAR));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.BOOLEAN, new Integer(BOOLEAN));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.BYTE, new Integer(BYTE));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.SHORT, new Integer(SHORT));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.INTEGER, new Integer(INTEGER));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.LONG, new Integer(LONG));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.BIG_INTEGER, new Integer(BIGINTEGER));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.FLOAT, new Integer(FLOAT));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.DOUBLE, new Integer(DOUBLE));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.BIG_DECIMAL, new Integer(BIGDECIMAL));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.DATE, new Integer(DATE));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.TIME, new Integer(TIME));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.TIMESTAMP, new Integer(TIMESTAMP));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.OBJECT, new Integer(OBJECT));        
+        typeMap.put(TypeFacility.RUNTIME_TYPES.BLOB, new Integer(BLOB));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.CLOB, new Integer(CLOB));
+        typeMap.put(TypeFacility.RUNTIME_TYPES.XML, new Integer(XML));
+    }    
+    
+    /**
+     * Subclass should override this method as needed.
+     * @see org.teiid.connector.jdbc.translator.FunctionModifier#modify(com.metamatrix.connector.language.IFunction)
+     */
+    public IExpression modify(IFunction function) {
+        return function;
+    }
+
+    /**
+     * Subclass should override this method as needed.
+     * @see org.teiid.connector.jdbc.translator.FunctionModifier#translate(com.metamatrix.connector.language.IFunction)
+     */
+    public List translate(IFunction function) {
+        List objs = new ArrayList();
+        objs.add(function.getName());
+        objs.add("("); //$NON-NLS-1$
+        List<IExpression> params = function.getParameters();
+        if(params.size() > 0) { 
+            objs.add(params.get(0));
+            if(params.size() > 1) {
+                for(int i=1; i<params.size(); i++) {
+                    objs.add(", "); //$NON-NLS-1$
+                    objs.add(params.get(i));
+                }
+            }
+        }
+        objs.add(")"); //$NON-NLS-1$
+
+        return objs;
+    }
+
+}

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/BindValueVisitor.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/BindValueVisitor.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/BindValueVisitor.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -20,7 +20,7 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.jdbc.translator;
+package org.teiid.connector.jdbc.translator;
 
 import com.metamatrix.connector.language.ICompareCriteria;
 import com.metamatrix.connector.language.IExistsCriteria;

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/DropFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/DropFunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/DropFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,50 +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.jdbc.translator;
-
-import com.metamatrix.connector.jdbc.JDBCPlugin;
-import com.metamatrix.connector.language.*;
-
-/**
- * This FunctionModifier will cause this function to be dropped by replacing the function
- * with (by default) the first argument of the function.  Optionally, the replacement index 
- * can be overridden.  This modifier should only be used with functions having the
- * minimum or more number of arguments. 
- */
-public class DropFunctionModifier extends BasicFunctionModifier implements FunctionModifier {
-
-    private int replaceIndex = 0;
-    
-    public void setReplaceIndex(int index) {
-        this.replaceIndex = index;
-    }
-    
-    public IExpression modify(IFunction function) {
-        IExpression[] args = function.getParameters();
-        if(args.length <= replaceIndex) { 
-            throw new IllegalArgumentException(JDBCPlugin.Util.getString("DropFunctionModifier.DropFunctionModifier_can_only_be_used_on_functions_with___1") + function); //$NON-NLS-1$
-        }
-
-        return args[replaceIndex];
-    }
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/DropFunctionModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/DropFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/DropFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/DropFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,53 @@
+/*
+ * 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.translator;
+
+import java.util.List;
+
+import org.teiid.connector.jdbc.JDBCPlugin;
+
+import com.metamatrix.connector.language.*;
+
+/**
+ * This FunctionModifier will cause this function to be dropped by replacing the function
+ * with (by default) the first argument of the function.  Optionally, the replacement index 
+ * can be overridden.  This modifier should only be used with functions having the
+ * minimum or more number of arguments. 
+ */
+public class DropFunctionModifier extends BasicFunctionModifier implements FunctionModifier {
+
+    private int replaceIndex = 0;
+    
+    public void setReplaceIndex(int index) {
+        this.replaceIndex = index;
+    }
+    
+    public IExpression modify(IFunction function) {
+        List<IExpression> args = function.getParameters();
+        if(args.size() <= replaceIndex) { 
+            throw new IllegalArgumentException(JDBCPlugin.Util.getString("DropFunctionModifier.DropFunctionModifier_can_only_be_used_on_functions_with___1") + function); //$NON-NLS-1$
+        }
+
+        return args.get(replaceIndex);
+    }
+}

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/EscapeSyntaxModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/EscapeSyntaxModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/EscapeSyntaxModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -20,7 +20,7 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.jdbc.translator;
+package org.teiid.connector.jdbc.translator;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -39,7 +39,7 @@
     }
     
     /** 
-     * @see com.metamatrix.connector.jdbc.translator.BasicFunctionModifier#translate(com.metamatrix.connector.language.IFunction)
+     * @see org.teiid.connector.jdbc.translator.BasicFunctionModifier#translate(com.metamatrix.connector.language.IFunction)
      * @since 5.0
      */
     public List translate(IFunction function) {

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/FunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/FunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/FunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -22,7 +22,7 @@
 
 /*
  */
-package com.metamatrix.connector.jdbc.translator;
+package org.teiid.connector.jdbc.translator;
 
 import java.util.List;
 

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/FunctionReplacementVisitor.java (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/util/FunctionReplacementVisitor.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/FunctionReplacementVisitor.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/FunctionReplacementVisitor.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,204 @@
+/*
+ * 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.translator;
+
+import java.util.List;
+import java.util.Map;
+
+
+import com.metamatrix.connector.language.IAggregate;
+import com.metamatrix.connector.language.ICompareCriteria;
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.IGroupBy;
+import com.metamatrix.connector.language.IInCriteria;
+import com.metamatrix.connector.language.IInlineView;
+import com.metamatrix.connector.language.IInsert;
+import com.metamatrix.connector.language.IIsNullCriteria;
+import com.metamatrix.connector.language.ILikeCriteria;
+import com.metamatrix.connector.language.ISearchedCaseExpression;
+import com.metamatrix.connector.language.ISelectSymbol;
+import com.metamatrix.connector.language.ISubqueryCompareCriteria;
+import com.metamatrix.connector.language.ISubqueryInCriteria;
+import com.metamatrix.connector.visitor.framework.HierarchyVisitor;
+
+/**
+ */
+public class FunctionReplacementVisitor extends HierarchyVisitor {
+
+    private Map functionModifiers;   
+
+    /**
+     * Set the functon modifiers.  
+     * @param Map of function names to function modifiers.
+     */
+    public FunctionReplacementVisitor(Map functionModifiers){
+        super();
+        this.functionModifiers = functionModifiers;
+    }
+            
+    /* 
+     * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(com.metamatrix.data.language.IAggregate)
+     */
+    public void visit(IAggregate obj) {
+        super.visit(obj);
+        obj.setExpression(replaceFunction(obj.getExpression()));
+    }
+    
+    public void visit(IInlineView obj) {
+        visitNode(obj.getQuery());
+    }
+
+    /* 
+     * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(com.metamatrix.data.language.ICompareCriteria)
+     */
+    public void visit(ICompareCriteria obj) {
+        super.visit(obj);
+        obj.setLeftExpression(replaceFunction(obj.getLeftExpression()));
+        obj.setRightExpression(replaceFunction(obj.getRightExpression()));
+    }
+
+    /**
+     * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(com.metamatrix.connector.language.IFunction)
+     */
+    public void visit(IFunction obj) {
+        super.visit(obj);
+        List<IExpression> args = obj.getParameters();
+        for(int i=0; i<args.size(); i++) {
+            args.set(i, replaceFunction(args.get(i)));
+        }
+    }    
+    
+    /** 
+     * @see com.metamatrix.connector.visitor.framework.HierarchyVisitor#visit(com.metamatrix.connector.language.IGroupBy)
+     * @since 4.3
+     */
+    public void visit(IGroupBy obj) {
+        super.visit(obj);
+        List<IExpression> expressions = obj.getElements();
+        
+        for (int i=0; i<expressions.size(); i++) {
+            IExpression expression = (IExpression)expressions.get(i);
+            expressions.set(i, replaceFunction(expression));
+        }
+    }      
+
+    /* 
+     * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(com.metamatrix.data.language.IInCriteria)
+     */
+    public void visit(IInCriteria obj) {
+        super.visit(obj);
+        obj.setLeftExpression(replaceFunction(obj.getLeftExpression()));
+        List<IExpression> rightExprs = obj.getRightExpressions();
+        
+        for(int i=0; i<rightExprs.size(); i++) {
+            IExpression expr = (IExpression) rightExprs.get(i);
+            rightExprs.set(i, replaceFunction(expr));
+        }
+    }
+
+    /**
+     * @see com.metamatrix.data.visitor.SQLStringVisitor#visit(com.metamatrix.connector.language.IInsert)
+     */
+    public void visit(IInsert obj) {
+        super.visit(obj);
+        List<IExpression> values = obj.getValues();
+        
+        for(int i=0; i<values.size(); i++) {
+            IExpression expr = (IExpression) values.get(i);
+            values.set(i, replaceFunction(expr));
+        }
+    }  
+
+    /* 
+     * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(com.metamatrix.data.language.IIsNullCriteria)
+     */
+    public void visit(IIsNullCriteria obj) {
+        super.visit(obj);
+        obj.setExpression(replaceFunction(obj.getExpression()));
+    }
+
+    /* 
+     * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(com.metamatrix.data.language.ILikeCriteria)
+     */
+    public void visit(ILikeCriteria obj) {
+        super.visit(obj);
+        obj.setLeftExpression(replaceFunction(obj.getLeftExpression()));
+        obj.setRightExpression(replaceFunction(obj.getRightExpression()));
+    }
+
+    /* 
+     * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(com.metamatrix.data.language.ISearchedCaseExpression)
+     */
+    public void visit(ISearchedCaseExpression obj) {
+        super.visit(obj);
+        int whenCount = obj.getWhenCount();
+        for(int i=0; i<whenCount; i++) {
+            obj.setThenExpression(i, replaceFunction(obj.getThenExpression(i)));
+        }
+        obj.setElseExpression(replaceFunction(obj.getElseExpression()));
+    }
+
+    /* 
+     * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(com.metamatrix.data.language.ISelectSymbol)
+     */
+    public void visit(ISelectSymbol obj) {
+        super.visit(obj);
+        obj.setExpression(replaceFunction(obj.getExpression()));
+    }
+
+    /* 
+     * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(com.metamatrix.data.language.ISubqueryCompareCriteria)
+     */
+    public void visit(ISubqueryCompareCriteria obj) {
+        super.visit(obj);
+        obj.setLeftExpression(replaceFunction(obj.getLeftExpression()));
+    }
+
+    /* 
+     * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(com.metamatrix.data.language.ISubqueryInCriteria)
+     */
+    public void visit(ISubqueryInCriteria obj) {
+        super.visit(obj);
+        obj.setLeftExpression(replaceFunction(obj.getLeftExpression()));
+    }
+         
+    private IExpression replaceFunction(IExpression expression) {
+        if(functionModifiers != null && expression != null && expression instanceof IFunction){
+            // Look for function modifier
+            IFunction function = (IFunction) expression;
+            String key = function.getName().toLowerCase();        
+            if(functionModifiers.containsKey(key)) {
+                FunctionModifier modifier = (FunctionModifier) functionModifiers.get(key);
+                
+                // Modify function and return it
+                return modifier.modify(function);                                        
+            }
+        } 
+        
+        // Fall through and return original expression        
+        return expression;
+    }    
+    
+
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/FunctionReplacementVisitor.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/SQLConversionVisitor.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/SQLConversionVisitor.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/SQLConversionVisitor.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,340 +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.jdbc.translator;
-
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.language.IBulkInsert;
-import com.metamatrix.connector.language.ICommand;
-import com.metamatrix.connector.language.IElement;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.ILanguageObject;
-import com.metamatrix.connector.language.ILimit;
-import com.metamatrix.connector.language.ILiteral;
-import com.metamatrix.connector.language.IParameter;
-import com.metamatrix.connector.language.IProcedure;
-import com.metamatrix.connector.language.IQuery;
-import com.metamatrix.connector.language.IQueryCommand;
-import com.metamatrix.connector.language.ISetQuery;
-import com.metamatrix.connector.language.IParameter.Direction;
-import com.metamatrix.connector.language.ISetQuery.Operation;
-import com.metamatrix.connector.metadata.runtime.RuntimeMetadata;
-import com.metamatrix.connector.visitor.util.SQLStringVisitor;
-
-/**
- * This visitor takes an ICommand and does DBMS-specific conversion on it
- * to produce a SQL String.  This class is expected to be subclassed.
- * Specialized instances of this class can be gotten from a SQL Translator
- * {@link Translator#getTranslationVisitor(RuntimeMetadata) using this method}.
- */
-public class SQLConversionVisitor extends SQLStringVisitor{
-
-    private static DecimalFormat DECIMAL_FORMAT = 
-        new DecimalFormat("#############################0.0#############################"); //$NON-NLS-1$    
-    private static double SCIENTIC_LOW = Math.pow(10, -3);
-    private static double SCIENTIC_HIGH = Math.pow(10, 7);
-    
-    private Map<String, FunctionModifier> modifiers;
-    private ExecutionContext context;
-    private Translator translator;
-
-    private boolean prepared;
-    
-    private List preparedValues = new ArrayList();
-    private List preparedTypes = new ArrayList();
-    
-    public SQLConversionVisitor(Translator translator) {
-        this.translator = translator;
-        this.prepared = translator.usePreparedStatements();
-        this.modifiers = translator.getFunctionModifiers();
-    }
-
-    public void visit(IBulkInsert obj) {
-        this.prepared = true;
-
-        super.visit(obj);
-        
-        for (int i = 0; i < obj.getElements().size(); i++) {
-            IElement element = (IElement) obj.getElements().get(i);
-            this.preparedTypes.add(element.getType());
-        }
-
-        this.preparedValues = obj.getRows();
-    } 
-    
-    /**
-     * @param type
-     * @param object
-     * @param valuesbuffer
-     */
-    private void translateSQLType(Class type, Object obj, StringBuffer valuesbuffer) {
-        if (obj == null) {
-            valuesbuffer.append(NULL);
-        } else {
-            if(Number.class.isAssignableFrom(type)) {
-                boolean useFormatting = false;
-                
-                if (Double.class.isAssignableFrom(type)){
-                    double value = ((Double)obj).doubleValue();
-                    useFormatting = (value <= SCIENTIC_LOW || value >= SCIENTIC_HIGH); 
-                }
-                else if (Float.class.isAssignableFrom(type)){
-                    float value = ((Float)obj).floatValue();
-                    useFormatting = (value <= SCIENTIC_LOW || value >= SCIENTIC_HIGH);
-                }
-                // The formatting is to avoid the so-called "scientic-notation"
-                // where toString will use for numbers greater than 10p7 and
-                // less than 10p-3, where database may not understand.
-                if (useFormatting) {
-                	synchronized (DECIMAL_FORMAT) {
-                        valuesbuffer.append(DECIMAL_FORMAT.format(obj));
-					}
-                }
-                else {
-                    valuesbuffer.append(obj);
-                }
-            } else if(type.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN)) {
-                valuesbuffer.append(translator.translateLiteralBoolean((Boolean)obj));
-            } else if(type.equals(TypeFacility.RUNTIME_TYPES.TIMESTAMP)) {
-                valuesbuffer.append(translator.translateLiteralTimestamp((Timestamp)obj));
-            } else if(type.equals(TypeFacility.RUNTIME_TYPES.TIME)) {
-                valuesbuffer.append(translator.translateLiteralTime((Time)obj));
-            } else if(type.equals(TypeFacility.RUNTIME_TYPES.DATE)) {
-                valuesbuffer.append(translator.translateLiteralDate((java.sql.Date)obj));
-            } else {
-                // If obj is string, toSting() will not create a new String 
-                // object, it returns it self, so new object creation. 
-                valuesbuffer.append("'") //$NON-NLS-1$
-                      .append(escapeString(obj.toString()))
-                      .append("'"); //$NON-NLS-1$
-            }
-        }        
-    }
-
-    /**
-     * @see com.metamatrix.connector.visitor.util.SQLStringVisitor#visit(com.metamatrix.connector.language.IProcedure)
-     */
-    public void visit(IProcedure obj) {
-        this.prepared = true;
-        /*
-         * preparedValues is now a list of procedure params instead of just values
-         */
-        this.preparedValues = obj.getParameters();
-        super.buffer.append(generateSqlForStoredProcedure(obj));
-    }
-
-    /**
-     * @see com.metamatrix.connector.visitor.util.SQLStringVisitor#visit(com.metamatrix.connector.language.IFunction)
-     */
-    public void visit(IFunction obj) {
-        if(this.modifiers != null) {
-            FunctionModifier functionModifier = (FunctionModifier)this.modifiers.get(obj.getName().toLowerCase());
-            if(functionModifier != null) {
-                List parts = functionModifier.translate(obj);
-                
-                // null means the FunctionModifier will rely on default translation
-                if (parts != null) {
-                    Iterator iter = parts.iterator();
-                    while(iter.hasNext()) {
-                        Object part = iter.next();
-                        if(part instanceof String) {
-                            buffer.append(part);
-                        } else {
-                            append((ILanguageObject)part);
-                        }
-                    }
-                    return;
-                } 
-            } 
-        } 
-        super.visit(obj);
-    }
-
-    /**
-     * @see com.metamatrix.connector.visitor.util.SQLStringVisitor#visit(com.metamatrix.connector.language.ILiteral)
-     */
-    public void visit(ILiteral obj) {
-        if (this.prepared && obj.isBindValue()) {
-            buffer.append(UNDEFINED_PARAM);
-            preparedValues.add(obj.getValue());
-            preparedTypes.add(obj.getType());
-        } else {
-            translateSQLType(obj.getType(), obj.getValue(), buffer);
-        }
-    }
-
-    /**
-     * Set the per-command execution context on this visitor. 
-     * @param context ExecutionContext
-     * @since 4.3
-     */
-    public void setExecutionContext(ExecutionContext context) {
-        this.context = context;
-    }
-    
-    /**
-     * Retrieve the per-command execution context for this visitor 
-     * (intended for subclasses to use).
-     * @return
-     * @since 4.3
-     */
-    protected ExecutionContext getExecutionContext() {
-        return this.context;
-    }
-
-    protected String getSourceComment(ICommand command) {
-    	return this.translator.getSourceComment(this.context, command);
-    }
-    
-    /**
-     * This is a generic implementation. Subclass should override this method
-     * if necessary.
-     * @param exec The command for the stored procedure.
-     * @return String to be executed by CallableStatement.
-     */
-    protected String generateSqlForStoredProcedure(IProcedure exec) {
-        StringBuffer prepareCallBuffer = new StringBuffer();
-        prepareCallBuffer.append("{ "); //$NON-NLS-1$
-
-        List params = exec.getParameters();
-
-        //check whether a "?" is needed if there are returns
-        boolean needQuestionMark = false;
-        Iterator iter = params.iterator();
-        while(iter.hasNext()){
-            IParameter param = (IParameter)iter.next();
-            if(param.getDirection() == Direction.RETURN){
-                needQuestionMark = true;
-                break;
-            }
-        }
-        
-        prepareCallBuffer.append(getSourceComment(exec));
-        
-        if(needQuestionMark){
-            prepareCallBuffer.append("?="); //$NON-NLS-1$
-        }
-
-        prepareCallBuffer.append(" call ");//$NON-NLS-1$
-        prepareCallBuffer.append(exec.getMetadataID() != null ? getName(exec.getMetadataID()) : exec.getProcedureName());
-        prepareCallBuffer.append("("); //$NON-NLS-1$
-
-        int numberOfParameters = 0;
-        iter = params.iterator();
-        while(iter.hasNext()){
-            IParameter param = (IParameter)iter.next();
-            if(param.getDirection() == Direction.IN || param.getDirection() == Direction.OUT || param.getDirection() == Direction.INOUT){
-                if(numberOfParameters > 0){
-                    prepareCallBuffer.append(","); //$NON-NLS-1$
-                }
-                prepareCallBuffer.append("?"); //$NON-NLS-1$
-                numberOfParameters++;
-            }
-        }
-        prepareCallBuffer.append(")"); //$NON-NLS-1$
-        prepareCallBuffer.append("}"); //$NON-NLS-1$
-        return prepareCallBuffer.toString();
-    }
-    
-    /** 
-     * @return the preparedValues
-     */
-    List getPreparedValues() {
-        return this.preparedValues;
-    }
-    
-    /** 
-     * @return the preparedValues
-     */
-    List getPreparedTypes() {
-        return this.preparedTypes;
-    }
-    
-    public boolean isPrepared() {
-		return prepared;
-	}
-    
-    public void setPrepared(boolean prepared) {
-		this.prepared = prepared;
-	}
-    
-    @Override
-    protected boolean useAsInGroupAlias() {
-    	return this.translator.useAsInGroupAlias();
-    }
-    
-    @Override
-    public void visit(IQuery obj) {
-    	if (obj.getLimit() != null) {
-    		handleLimit(obj);
-    	} else {
-    		super.visit(obj);
-    	}
-    }
-    
-    @Override
-    public void visit(ISetQuery obj) {
-    	if (obj.getLimit() != null) {
-    		handleLimit(obj);
-    	} else {
-    		super.visit(obj);
-    	}
-    }
-    
-    @Override
-    protected boolean useParensForSetQueries() {
-    	return translator.useParensForSetQueries();
-    }
-    
-	private void handleLimit(IQueryCommand obj) {
-		ILimit limit = obj.getLimit();
-    	obj.setLimit(null);
-    	StringBuffer current = this.buffer;
-    	this.buffer = new StringBuffer();
-    	append(obj);
-    	current.append(this.translator.addLimitString(this.buffer.toString(), limit));
-    	this.buffer = current;
-    	obj.setLimit(limit);
-	}
-	
-	@Override
-	protected String replaceElementName(String group, String element) {
-		return translator.replaceElementName(group, element);
-	}
-	
-	@Override
-	protected void appendSetOperation(Operation operation) {
-		buffer.append(translator.getSetOperationString(operation));
-	}
-                
-}

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/SQLConversionVisitor.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/SQLConversionVisitor.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/SQLConversionVisitor.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/SQLConversionVisitor.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,340 @@
+/*
+ * 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.translator;
+
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import com.metamatrix.connector.api.ExecutionContext;
+import com.metamatrix.connector.api.TypeFacility;
+import com.metamatrix.connector.language.IBulkInsert;
+import com.metamatrix.connector.language.ICommand;
+import com.metamatrix.connector.language.IElement;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageObject;
+import com.metamatrix.connector.language.ILimit;
+import com.metamatrix.connector.language.ILiteral;
+import com.metamatrix.connector.language.IParameter;
+import com.metamatrix.connector.language.IProcedure;
+import com.metamatrix.connector.language.IQuery;
+import com.metamatrix.connector.language.IQueryCommand;
+import com.metamatrix.connector.language.ISetQuery;
+import com.metamatrix.connector.language.IParameter.Direction;
+import com.metamatrix.connector.language.ISetQuery.Operation;
+import com.metamatrix.connector.metadata.runtime.RuntimeMetadata;
+import com.metamatrix.connector.visitor.util.SQLStringVisitor;
+
+/**
+ * This visitor takes an ICommand and does DBMS-specific conversion on it
+ * to produce a SQL String.  This class is expected to be subclassed.
+ * Specialized instances of this class can be gotten from a SQL Translator
+ * {@link Translator#getTranslationVisitor(RuntimeMetadata) using this method}.
+ */
+public class SQLConversionVisitor extends SQLStringVisitor{
+
+    private static DecimalFormat DECIMAL_FORMAT = 
+        new DecimalFormat("#############################0.0#############################"); //$NON-NLS-1$    
+    private static double SCIENTIC_LOW = Math.pow(10, -3);
+    private static double SCIENTIC_HIGH = Math.pow(10, 7);
+    
+    private Map<String, FunctionModifier> modifiers;
+    private ExecutionContext context;
+    private Translator translator;
+
+    private boolean prepared;
+    
+    private List preparedValues = new ArrayList();
+    private List preparedTypes = new ArrayList();
+    
+    public SQLConversionVisitor(Translator translator) {
+        this.translator = translator;
+        this.prepared = translator.usePreparedStatements();
+        this.modifiers = translator.getFunctionModifiers();
+    }
+
+    public void visit(IBulkInsert obj) {
+        this.prepared = true;
+
+        super.visit(obj);
+        
+        for (int i = 0; i < obj.getElements().size(); i++) {
+            IElement element = (IElement) obj.getElements().get(i);
+            this.preparedTypes.add(element.getType());
+        }
+
+        this.preparedValues = obj.getRows();
+    } 
+    
+    /**
+     * @param type
+     * @param object
+     * @param valuesbuffer
+     */
+    private void translateSQLType(Class type, Object obj, StringBuffer valuesbuffer) {
+        if (obj == null) {
+            valuesbuffer.append(NULL);
+        } else {
+            if(Number.class.isAssignableFrom(type)) {
+                boolean useFormatting = false;
+                
+                if (Double.class.isAssignableFrom(type)){
+                    double value = ((Double)obj).doubleValue();
+                    useFormatting = (value <= SCIENTIC_LOW || value >= SCIENTIC_HIGH); 
+                }
+                else if (Float.class.isAssignableFrom(type)){
+                    float value = ((Float)obj).floatValue();
+                    useFormatting = (value <= SCIENTIC_LOW || value >= SCIENTIC_HIGH);
+                }
+                // The formatting is to avoid the so-called "scientic-notation"
+                // where toString will use for numbers greater than 10p7 and
+                // less than 10p-3, where database may not understand.
+                if (useFormatting) {
+                	synchronized (DECIMAL_FORMAT) {
+                        valuesbuffer.append(DECIMAL_FORMAT.format(obj));
+					}
+                }
+                else {
+                    valuesbuffer.append(obj);
+                }
+            } else if(type.equals(TypeFacility.RUNTIME_TYPES.BOOLEAN)) {
+                valuesbuffer.append(translator.translateLiteralBoolean((Boolean)obj));
+            } else if(type.equals(TypeFacility.RUNTIME_TYPES.TIMESTAMP)) {
+                valuesbuffer.append(translator.translateLiteralTimestamp((Timestamp)obj));
+            } else if(type.equals(TypeFacility.RUNTIME_TYPES.TIME)) {
+                valuesbuffer.append(translator.translateLiteralTime((Time)obj));
+            } else if(type.equals(TypeFacility.RUNTIME_TYPES.DATE)) {
+                valuesbuffer.append(translator.translateLiteralDate((java.sql.Date)obj));
+            } else {
+                // If obj is string, toSting() will not create a new String 
+                // object, it returns it self, so new object creation. 
+                valuesbuffer.append("'") //$NON-NLS-1$
+                      .append(escapeString(obj.toString()))
+                      .append("'"); //$NON-NLS-1$
+            }
+        }        
+    }
+
+    /**
+     * @see com.metamatrix.connector.visitor.util.SQLStringVisitor#visit(com.metamatrix.connector.language.IProcedure)
+     */
+    public void visit(IProcedure obj) {
+        this.prepared = true;
+        /*
+         * preparedValues is now a list of procedure params instead of just values
+         */
+        this.preparedValues = obj.getParameters();
+        super.buffer.append(generateSqlForStoredProcedure(obj));
+    }
+
+    /**
+     * @see com.metamatrix.connector.visitor.util.SQLStringVisitor#visit(com.metamatrix.connector.language.IFunction)
+     */
+    public void visit(IFunction obj) {
+        if(this.modifiers != null) {
+            FunctionModifier functionModifier = (FunctionModifier)this.modifiers.get(obj.getName().toLowerCase());
+            if(functionModifier != null) {
+                List parts = functionModifier.translate(obj);
+                
+                // null means the FunctionModifier will rely on default translation
+                if (parts != null) {
+                    Iterator iter = parts.iterator();
+                    while(iter.hasNext()) {
+                        Object part = iter.next();
+                        if(part instanceof String) {
+                            buffer.append(part);
+                        } else {
+                            append((ILanguageObject)part);
+                        }
+                    }
+                    return;
+                } 
+            } 
+        } 
+        super.visit(obj);
+    }
+
+    /**
+     * @see com.metamatrix.connector.visitor.util.SQLStringVisitor#visit(com.metamatrix.connector.language.ILiteral)
+     */
+    public void visit(ILiteral obj) {
+        if (this.prepared && obj.isBindValue()) {
+            buffer.append(UNDEFINED_PARAM);
+            preparedValues.add(obj.getValue());
+            preparedTypes.add(obj.getType());
+        } else {
+            translateSQLType(obj.getType(), obj.getValue(), buffer);
+        }
+    }
+
+    /**
+     * Set the per-command execution context on this visitor. 
+     * @param context ExecutionContext
+     * @since 4.3
+     */
+    public void setExecutionContext(ExecutionContext context) {
+        this.context = context;
+    }
+    
+    /**
+     * Retrieve the per-command execution context for this visitor 
+     * (intended for subclasses to use).
+     * @return
+     * @since 4.3
+     */
+    protected ExecutionContext getExecutionContext() {
+        return this.context;
+    }
+
+    protected String getSourceComment(ICommand command) {
+    	return this.translator.getSourceComment(this.context, command);
+    }
+    
+    /**
+     * This is a generic implementation. Subclass should override this method
+     * if necessary.
+     * @param exec The command for the stored procedure.
+     * @return String to be executed by CallableStatement.
+     */
+    protected String generateSqlForStoredProcedure(IProcedure exec) {
+        StringBuffer prepareCallBuffer = new StringBuffer();
+        prepareCallBuffer.append("{ "); //$NON-NLS-1$
+
+        List params = exec.getParameters();
+
+        //check whether a "?" is needed if there are returns
+        boolean needQuestionMark = false;
+        Iterator iter = params.iterator();
+        while(iter.hasNext()){
+            IParameter param = (IParameter)iter.next();
+            if(param.getDirection() == Direction.RETURN){
+                needQuestionMark = true;
+                break;
+            }
+        }
+        
+        prepareCallBuffer.append(getSourceComment(exec));
+        
+        if(needQuestionMark){
+            prepareCallBuffer.append("?="); //$NON-NLS-1$
+        }
+
+        prepareCallBuffer.append(" call ");//$NON-NLS-1$
+        prepareCallBuffer.append(exec.getMetadataObject() != null ? getName(exec.getMetadataObject()) : exec.getProcedureName());
+        prepareCallBuffer.append("("); //$NON-NLS-1$
+
+        int numberOfParameters = 0;
+        iter = params.iterator();
+        while(iter.hasNext()){
+            IParameter param = (IParameter)iter.next();
+            if(param.getDirection() == Direction.IN || param.getDirection() == Direction.OUT || param.getDirection() == Direction.INOUT){
+                if(numberOfParameters > 0){
+                    prepareCallBuffer.append(","); //$NON-NLS-1$
+                }
+                prepareCallBuffer.append("?"); //$NON-NLS-1$
+                numberOfParameters++;
+            }
+        }
+        prepareCallBuffer.append(")"); //$NON-NLS-1$
+        prepareCallBuffer.append("}"); //$NON-NLS-1$
+        return prepareCallBuffer.toString();
+    }
+    
+    /** 
+     * @return the preparedValues
+     */
+    List getPreparedValues() {
+        return this.preparedValues;
+    }
+    
+    /** 
+     * @return the preparedValues
+     */
+    List getPreparedTypes() {
+        return this.preparedTypes;
+    }
+    
+    public boolean isPrepared() {
+		return prepared;
+	}
+    
+    public void setPrepared(boolean prepared) {
+		this.prepared = prepared;
+	}
+    
+    @Override
+    protected boolean useAsInGroupAlias() {
+    	return this.translator.useAsInGroupAlias();
+    }
+    
+    @Override
+    public void visit(IQuery obj) {
+    	if (obj.getLimit() != null) {
+    		handleLimit(obj);
+    	} else {
+    		super.visit(obj);
+    	}
+    }
+    
+    @Override
+    public void visit(ISetQuery obj) {
+    	if (obj.getLimit() != null) {
+    		handleLimit(obj);
+    	} else {
+    		super.visit(obj);
+    	}
+    }
+    
+    @Override
+    protected boolean useParensForSetQueries() {
+    	return translator.useParensForSetQueries();
+    }
+    
+	private void handleLimit(IQueryCommand obj) {
+		ILimit limit = obj.getLimit();
+    	obj.setLimit(null);
+    	StringBuffer current = this.buffer;
+    	this.buffer = new StringBuffer();
+    	append(obj);
+    	current.append(this.translator.addLimitString(this.buffer.toString(), limit));
+    	this.buffer = current;
+    	obj.setLimit(limit);
+	}
+	
+	@Override
+	protected String replaceElementName(String group, String element) {
+		return translator.replaceElementName(group, element);
+	}
+	
+	@Override
+	protected void appendSetOperation(Operation operation) {
+		buffer.append(translator.getSetOperationString(operation));
+	}
+                
+}

Deleted: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/SubstringFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/SubstringFunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/SubstringFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,63 +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.jdbc.translator;
-
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.ILanguageFactory;
-
-/**
- * Common logic for Substring modifiers requiring 3 parameters
- */
-public class SubstringFunctionModifier extends BasicFunctionModifier {
-
-    private ILanguageFactory languageFactory;
-    private String length_function;
-    
-    public SubstringFunctionModifier(ILanguageFactory languageFactory, String substring_function, String length_function) {
-    	this.languageFactory = languageFactory; 
-        this.length_function = length_function;
-    }
-
-    /**
-     * @see com.metamatrix.connector.jdbc.translator.FunctionModifier#modify(com.metamatrix.query.sql.symbol.Function)
-     */
-    public IExpression modify(IFunction function) {
-        IExpression[] args = function.getParameters();
-        IExpression[] newArgs = new IExpression[3];
-        function.setParameters(newArgs);
-
-        newArgs[0] = args[0];
-        newArgs[1] = args[1];
-        
-        if(args.length == 2) {
-            newArgs[2] = languageFactory.createFunction(length_function, new IExpression[] { args[0] }, Integer.class); 
-        } else {
-            newArgs[2] = args[2];
-        }
-        
-        function.setParameters(newArgs);
-                        
-        return function;
-    }
-}
\ No newline at end of file

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/SubstringFunctionModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/SubstringFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/SubstringFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/SubstringFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,57 @@
+/*
+ * 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.translator;
+
+import java.util.Arrays;
+import java.util.List;
+
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageFactory;
+
+/**
+ * Common logic for Substring modifiers requiring 3 parameters
+ */
+public class SubstringFunctionModifier extends BasicFunctionModifier {
+
+    private ILanguageFactory languageFactory;
+    private String length_function;
+    
+    public SubstringFunctionModifier(ILanguageFactory languageFactory, String substring_function, String length_function) {
+    	this.languageFactory = languageFactory; 
+        this.length_function = length_function;
+    }
+
+    /**
+     * @see org.teiid.connector.jdbc.translator.FunctionModifier#modify(com.metamatrix.query.sql.symbol.Function)
+     */
+    public IExpression modify(IFunction function) {
+        List<IExpression> args = function.getParameters();
+        
+        if(args.size() == 2) {
+            args.add(languageFactory.createFunction(length_function, Arrays.asList(args.get(0)), Integer.class)); 
+        } 
+                        
+        return function;
+    }
+}
\ No newline at end of file

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/TranslatedCommand.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/TranslatedCommand.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/TranslatedCommand.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -22,15 +22,15 @@
 
 /*
  */
-package com.metamatrix.connector.jdbc.translator;
+package org.teiid.connector.jdbc.translator;
 
 import java.util.List;
 import java.util.Map;
 
+
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.ExecutionContext;
 import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.util.FunctionReplacementVisitor;
 import com.metamatrix.connector.language.ICommand;
 import com.metamatrix.connector.language.ILiteral;
 import com.metamatrix.connector.visitor.util.CollectorVisitor;
@@ -61,7 +61,7 @@
     	this.sqlTranslator = sqlTranslator;
     	
     	Map<String, FunctionModifier> modifiers = sqlTranslator.getFunctionModifiers();
-        this.sqlConversionVisitor = new SQLConversionVisitor(sqlTranslator);
+        this.sqlConversionVisitor = sqlTranslator.getSQLConversionVisitor();
         sqlConversionVisitor.setExecutionContext(context);
         this.functionVisitor = new FunctionReplacementVisitor(modifiers);
     }

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/Translator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/translator/Translator.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/translator/Translator.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -20,7 +20,7 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.jdbc.translator;
+package org.teiid.connector.jdbc.translator;
 
 import java.math.BigDecimal;
 import java.math.BigInteger;
@@ -41,6 +41,9 @@
 import java.util.Map;
 import java.util.TimeZone;
 
+import org.teiid.connector.jdbc.JDBCPlugin;
+import org.teiid.connector.jdbc.JDBCPropertyNames;
+
 import com.metamatrix.common.util.PropertiesUtils;
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
@@ -48,8 +51,6 @@
 import com.metamatrix.connector.api.TypeFacility;
 import com.metamatrix.connector.api.ValueTranslator;
 import com.metamatrix.connector.internal.ConnectorPropertyNames;
-import com.metamatrix.connector.jdbc.JDBCPlugin;
-import com.metamatrix.connector.jdbc.JDBCPropertyNames;
 import com.metamatrix.connector.language.ICommand;
 import com.metamatrix.connector.language.ILanguageFactory;
 import com.metamatrix.connector.language.ILimit;
@@ -419,7 +420,7 @@
      * values, so subclasses should override that method if necessery to change the binding 
      * behavior.
      *  
-     * @see com.metamatrix.connector.jdbc.extension.ResultsTranslator#bindPreparedStatementValues(java.sql.Connection, java.sql.PreparedStatement, com.metamatrix.connector.jdbc.translator.TranslatedCommand)
+     * @see com.metamatrix.connector.jdbc.extension.ResultsTranslator#bindPreparedStatementValues(java.sql.Connection, java.sql.PreparedStatement, org.teiid.connector.jdbc.translator.TranslatedCommand)
      */
     public void bindPreparedStatementValues(Connection conn, PreparedStatement stmt, TranslatedCommand command) throws SQLException {
         List params = command.getPreparedValues();
@@ -710,5 +711,9 @@
     public int getIsValidTimeout() {
 		return isValidTimeout;
 	}
+    
+    public SQLConversionVisitor getSQLConversionVisitor() {
+    	return new SQLConversionVisitor(this);
+    }
 
 }

Copied: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/xa (from rev 486, trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/xa)


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/xa
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/xa/JDBCSourceXAConnection.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/xa/JDBCSourceXAConnection.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/xa/JDBCSourceXAConnection.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -22,7 +22,7 @@
 
 /*
  */
-package com.metamatrix.connector.jdbc.xa;
+package org.teiid.connector.jdbc.xa;
 
 import java.sql.Connection;
 import java.sql.SQLException;
@@ -31,10 +31,11 @@
 import javax.sql.ConnectionEventListener;
 import javax.transaction.xa.XAResource;
 
+import org.teiid.connector.jdbc.JDBCSourceConnection;
+import org.teiid.connector.jdbc.translator.Translator;
+
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.jdbc.JDBCSourceConnection;
-import com.metamatrix.connector.jdbc.translator.Translator;
 import com.metamatrix.connector.xa.api.XAConnection;
 
 public class JDBCSourceXAConnection extends JDBCSourceConnection implements XAConnection {

Modified: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/xa/XAJDBCPropertyNames.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/com/metamatrix/connector/jdbc/xa/XAJDBCPropertyNames.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/xa/XAJDBCPropertyNames.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -24,7 +24,7 @@
  * Date: Jan 23, 2003
  * Time: 5:38:40 PM
  */
-package com.metamatrix.connector.jdbc.xa;
+package org.teiid.connector.jdbc.xa;
 
 /**
  * XAJDBCPropertyNames.

Copied: trunk/connectors/connector-jdbc/src/main/resources/org/teiid/connector/jdbc (from rev 486, trunk/connectors/connector-jdbc/src/main/resources/com/metamatrix/connector/jdbc)


Property changes on: trunk/connectors/connector-jdbc/src/main/resources/org/teiid/connector/jdbc
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/FakeConnection.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/FakeConnection.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/FakeConnection.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -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.jdbc;
-
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import com.metamatrix.core.util.SimpleMock;
-
-/**
- * FakeConnection for unit testing
- */
-public class FakeConnection {
-
-    boolean closed;
-    boolean fail;
-    
-    /* (non-Javadoc)
-     * @see java.sql.Connection#createStatement()
-     */
-    public Statement createStatement() throws SQLException {
-        if (fail) {
-            throw new SQLException();
-        }
-        return SimpleMock.createSimpleMock(Statement.class);
-    }
-    
-    /* (non-Javadoc)
-     * @see java.sql.Connection#isClosed()
-     */
-    public boolean isClosed() {
-        return closed;
-    }
-
-}

Deleted: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/MetadataFactory.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/MetadataFactory.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/MetadataFactory.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,48 +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.jdbc;
-
-import junit.framework.Assert;
-
-import com.metamatrix.cdk.api.TranslationUtility;
-import com.metamatrix.cdk.unittest.FakeTranslationFactory;
-import com.metamatrix.connector.language.ICommand;
-
-public class MetadataFactory {
-	
-    public static final String PARTS_VDB = "/PartsSupplier.vdb"; //$NON-NLS-1$
-    public static final String BQT_VDB = "/bqt.vdb"; //$NON-NLS-1$
-
-    public static ICommand helpTranslate(String vdbFileName, String sql) {
-    	TranslationUtility util = null;
-    	if (PARTS_VDB.equals(vdbFileName)) {
-    		util = new TranslationUtility(MetadataFactory.class.getResource(vdbFileName));
-    	} else if (BQT_VDB.equals(vdbFileName)){
-    		util = FakeTranslationFactory.getInstance().getBQTTranslationUtility();
-    	} else {
-    		Assert.fail("unknown vdb"); //$NON-NLS-1$
-    	}
-        return util.parseCommand(sql);        
-    }
-
-}

Deleted: trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/TestJDBCSourceConnection.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/TestJDBCSourceConnection.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/TestJDBCSourceConnection.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,115 +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.jdbc;
-
-import java.sql.Connection;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.cdk.api.EnvironmentUtility;
-import com.metamatrix.connector.api.ConnectorEnvironment;
-import com.metamatrix.connector.basic.BasicConnectorCapabilities;
-import com.metamatrix.connector.jdbc.translator.Translator;
-import com.metamatrix.core.util.SimpleMock;
-
-
-/** 
- * Test case for JDBCSourceConnection
- * @since 4.3
- */
-public class TestJDBCSourceConnection extends TestCase {
-    
-    private FakeConnection fakeConnection;
-    private Connection connection;
-    private ConnectorEnvironment environment;
-    
-    
-    public TestJDBCSourceConnection(String name) {
-        super(name);
-    }
-    
-    public void setUp() throws Exception {
-        fakeConnection = new FakeConnection();
-        connection = SimpleMock.createSimpleMock(fakeConnection, Connection.class);
-
-        final Properties properties = new Properties();
-        properties.setProperty(JDBCPropertyNames.EXT_CAPABILITY_CLASS, BasicConnectorCapabilities.class.getName());  
-        
-        environment = EnvironmentUtility.createEnvironment(properties, false); 
-    }
-    
-
-    /**
-     * Tests JDBCSourceConnection.isConnectionAlive() with a ConnectionQueryStrategy
-     * @since 4.3
-     */
-    public void testIsAlive() throws Exception {
-        JDBCSourceConnection sourceConnection = new JDBCSourceConnection(connection, environment, new Translator() {
-        	@Override
-        	public String getConnectionTestQuery() {
-        		return "select 1";
-        	}
-        }); 
-        
-        //closed connections should not be 'alive'        
-        fakeConnection.closed = true;
-        assertFalse(sourceConnection.isAlive());        
-        
-        //open connections should be 'alive'
-        fakeConnection.closed = false;
-        assertTrue(sourceConnection.isAlive());
-        
-        //failed connections should not be 'alive'
-        fakeConnection.fail = true;
-        assertFalse(sourceConnection.isAlive());
-        
-    }
-    
-    /**
-     * Tests JDBCSourceConnection.isConnectionAlive() with a null ConnectionStrategy
-     * @since 4.3
-     */
-    public void testIsAliveNullStrategy() throws Exception {
-        JDBCSourceConnection sourceConnection = new JDBCSourceConnection(connection, environment, new Translator() {
-        	@Override
-        	public String getConnectionTestQuery() {
-        		return null;
-        	}
-        }); 
-        
-        //closed connections should not be 'alive'        
-        fakeConnection.closed = true;
-        assertFalse(sourceConnection.isAlive());        
-        
-        //open connections should be 'alive'
-        fakeConnection.closed = false;
-        assertTrue(sourceConnection.isAlive());
-        
-        //without a strategy, failed connections are detected as 'alive'
-        fakeConnection.fail = true;
-        assertTrue(sourceConnection.isAlive());
-        
-    }
-    
-}

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/FakeConnection.java (from rev 486, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/FakeConnection.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/FakeConnection.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/FakeConnection.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,55 @@
+/*
+ * 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.sql.SQLException;
+import java.sql.Statement;
+
+import com.metamatrix.core.util.SimpleMock;
+
+/**
+ * FakeConnection for unit testing
+ */
+public class FakeConnection {
+
+    boolean closed;
+    boolean fail;
+    
+    /* (non-Javadoc)
+     * @see java.sql.Connection#createStatement()
+     */
+    public Statement createStatement() throws SQLException {
+        if (fail) {
+            throw new SQLException();
+        }
+        return SimpleMock.createSimpleMock(Statement.class);
+    }
+    
+    /* (non-Javadoc)
+     * @see java.sql.Connection#isClosed()
+     */
+    public boolean isClosed() {
+        return closed;
+    }
+
+}


Property changes on: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/FakeConnection.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/MetadataFactory.java (from rev 486, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/MetadataFactory.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/MetadataFactory.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/MetadataFactory.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,48 @@
+/*
+ * 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 junit.framework.Assert;
+
+import com.metamatrix.cdk.api.TranslationUtility;
+import com.metamatrix.cdk.unittest.FakeTranslationFactory;
+import com.metamatrix.connector.language.ICommand;
+
+public class MetadataFactory {
+	
+    public static final String PARTS_VDB = "/PartsSupplier.vdb"; //$NON-NLS-1$
+    public static final String BQT_VDB = "/bqt.vdb"; //$NON-NLS-1$
+
+    public static ICommand helpTranslate(String vdbFileName, String sql) {
+    	TranslationUtility util = null;
+    	if (PARTS_VDB.equals(vdbFileName)) {
+    		util = new TranslationUtility(MetadataFactory.class.getResource(vdbFileName));
+    	} else if (BQT_VDB.equals(vdbFileName)){
+    		util = FakeTranslationFactory.getInstance().getBQTTranslationUtility();
+    	} else {
+    		Assert.fail("unknown vdb"); //$NON-NLS-1$
+    	}
+        return util.parseCommand(sql);        
+    }
+
+}


Property changes on: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/MetadataFactory.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCSourceConnection.java (from rev 486, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/TestJDBCSourceConnection.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCSourceConnection.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCSourceConnection.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,118 @@
+/*
+ * 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.sql.Connection;
+import java.util.Properties;
+
+import org.teiid.connector.jdbc.JDBCPropertyNames;
+import org.teiid.connector.jdbc.JDBCSourceConnection;
+import org.teiid.connector.jdbc.translator.Translator;
+
+import junit.framework.TestCase;
+
+import com.metamatrix.cdk.api.EnvironmentUtility;
+import com.metamatrix.connector.api.ConnectorEnvironment;
+import com.metamatrix.connector.basic.BasicConnectorCapabilities;
+import com.metamatrix.core.util.SimpleMock;
+
+
+/** 
+ * Test case for JDBCSourceConnection
+ * @since 4.3
+ */
+public class TestJDBCSourceConnection extends TestCase {
+    
+    private FakeConnection fakeConnection;
+    private Connection connection;
+    private ConnectorEnvironment environment;
+    
+    
+    public TestJDBCSourceConnection(String name) {
+        super(name);
+    }
+    
+    public void setUp() throws Exception {
+        fakeConnection = new FakeConnection();
+        connection = SimpleMock.createSimpleMock(fakeConnection, Connection.class);
+
+        final Properties properties = new Properties();
+        properties.setProperty(JDBCPropertyNames.EXT_CAPABILITY_CLASS, BasicConnectorCapabilities.class.getName());  
+        
+        environment = EnvironmentUtility.createEnvironment(properties, false); 
+    }
+    
+
+    /**
+     * Tests JDBCSourceConnection.isConnectionAlive() with a ConnectionQueryStrategy
+     * @since 4.3
+     */
+    public void testIsAlive() throws Exception {
+        JDBCSourceConnection sourceConnection = new JDBCSourceConnection(connection, environment, new Translator() {
+        	@Override
+        	public String getConnectionTestQuery() {
+        		return "select 1";
+        	}
+        }); 
+        
+        //closed connections should not be 'alive'        
+        fakeConnection.closed = true;
+        assertFalse(sourceConnection.isAlive());        
+        
+        //open connections should be 'alive'
+        fakeConnection.closed = false;
+        assertTrue(sourceConnection.isAlive());
+        
+        //failed connections should not be 'alive'
+        fakeConnection.fail = true;
+        assertFalse(sourceConnection.isAlive());
+        
+    }
+    
+    /**
+     * Tests JDBCSourceConnection.isConnectionAlive() with a null ConnectionStrategy
+     * @since 4.3
+     */
+    public void testIsAliveNullStrategy() throws Exception {
+        JDBCSourceConnection sourceConnection = new JDBCSourceConnection(connection, environment, new Translator() {
+        	@Override
+        	public String getConnectionTestQuery() {
+        		return null;
+        	}
+        }); 
+        
+        //closed connections should not be 'alive'        
+        fakeConnection.closed = true;
+        assertFalse(sourceConnection.isAlive());        
+        
+        //open connections should be 'alive'
+        fakeConnection.closed = false;
+        assertTrue(sourceConnection.isAlive());
+        
+        //without a strategy, failed connections are detected as 'alive'
+        fakeConnection.fail = true;
+        assertTrue(sourceConnection.isAlive());
+        
+    }
+    
+}


Property changes on: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCSourceConnection.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/access (from rev 486, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/access)


Property changes on: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/access
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/access/TestAccessSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/access/TestAccessSQLTranslator.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/access/TestAccessSQLTranslator.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -20,17 +20,19 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.jdbc.access;
+package org.teiid.connector.jdbc.access;
 
 import java.util.Properties;
 
+import org.teiid.connector.jdbc.access.AccessSQLTranslator;
+import org.teiid.connector.jdbc.translator.TranslatedCommand;
+import org.teiid.connector.jdbc.translator.Translator;
+
 import junit.framework.TestCase;
 
 import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.cdk.unittest.FakeTranslationFactory;
 import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
-import com.metamatrix.connector.jdbc.translator.Translator;
 import com.metamatrix.connector.language.ICommand;
 
 

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/db2 (from rev 486, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/db2)


Property changes on: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/db2
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/db2/TestDB2ConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/db2/TestDB2ConvertModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/db2/TestDB2ConvertModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,518 +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.jdbc.db2;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.sql.Timestamp;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
-import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.ILanguageFactory;
-import com.metamatrix.query.unittest.TimestampUtil;
-
-/**
- */
-public class TestDB2ConvertModifier extends TestCase {
-
-    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
-
-    /**
-     * Constructor for TestSybaseConvertModifier.
-     * @param name
-     */
-    public TestDB2ConvertModifier(String name) {
-        super(name);
-    }
-
-    public String helpGetString(IExpression expr) throws Exception {
-        DB2SQLTranslator trans = new DB2SQLTranslator();
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
-        
-        SQLConversionVisitor sqlVisitor = new SQLConversionVisitor(trans); 
-        sqlVisitor.append(expr);  
-        
-        return sqlVisitor.toString();        
-    }
-
-    public void helpTest(IExpression srcExpression, String tgtType, String expectedExpression) throws Exception {
-        IFunction func = LANG_FACTORY.createFunction("convert",  //$NON-NLS-1$
-            new IExpression[] { 
-                srcExpression,
-                LANG_FACTORY.createLiteral(tgtType, String.class)},
-            TypeFacility.getDataTypeClass(tgtType));
-        
-        DB2ConvertModifier mod = new DB2ConvertModifier(LANG_FACTORY);
-        IExpression expr = mod.modify(func);
-        
-        assertEquals("Error converting from " + srcExpression.getType() + " to " + tgtType, //$NON-NLS-1$ //$NON-NLS-2$ 
-            expectedExpression, helpGetString(expr)); 
-    }
-
-    // Source = STRING
-
-    public void testStringToChar() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "char", "char('5', 1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "boolean", "CASE WHEN '5' = 'true' THEN 1 ELSE 0 END"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "byte", "smallint('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "short", "smallint('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "integer", "integer('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "long", "bigint('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "biginteger", "bigint('5')");  //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "float", "real('5')");//$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "double", "double('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToDate() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("2004-06-29", String.class), "date", "date('2004-06-29')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToTime() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("23:59:59", String.class), "time", "time('23:59:59')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToTimestamp() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("2004-06-29 23:59:59.987", String.class), "timestamp", "timestamp('2004-06-29 23:59:59.987')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "bigdecimal", "decimal('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    // Source = CHAR
-    
-    public void testCharToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Character('5'), Character.class), "string", "'5'"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = BOOLEAN
-    
-    public void testBooleanToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "string", "CASE WHEN 1 = 0 THEN 'false' ELSE 'true' END"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "byte", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "short", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-    
-    // Source = BYTE
-    
-    public void testByteToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "boolean", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "short", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = SHORT
-    
-    public void testShortToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "boolean", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "byte", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = INTEGER
-    
-    public void testIntegerToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "boolean", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "byte", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "short", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = LONG
-    
-    public void testLongToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "boolean", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "byte", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "short", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "integer", "integer(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = BIGINTEGER
-    
-    public void testBigIntegerToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "boolean", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "byte", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "short", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "integer", "integer(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    // Source = FLOAT
-    
-    public void testFloatToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "string", "char(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "boolean", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "byte", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "short", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "integer", "integer(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "long", "bigint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "biginteger", "bigint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "double", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "bigdecimal", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = DOUBLE
-    
-    public void testDoubleToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "string", "char(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "boolean", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "byte", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "short", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "integer", "integer(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "long", "bigint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "biginteger", "bigint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "float", "real(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "bigdecimal", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = BIGDECIMAL
-    
-    public void testBigDecimalToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "string", "char(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "boolean", "smallint(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "byte", "smallint(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "short", "smallint(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "integer", "integer(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "long", "bigint(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "biginteger", "bigint(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "float", "real(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToDoublel() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "double", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    // Source = DATE
-
-    public void testDateToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createDate(103, 10, 1), java.sql.Date.class), "string", "char({d'2003-11-01'})"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDateToTimestamp() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createDate(103, 10, 1), java.sql.Date.class), "timestamp", "timestamp({d'2003-11-01'}, '00:00:00')"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = TIME
-
-    public void testTimeToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createTime(23, 59, 59), java.sql.Time.class), "string", "char({t'23:59:59'})"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testTimeToTimestamp() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createTime(23, 59, 59), java.sql.Time.class), "timestamp", "timestamp('1970-01-01', {t'23:59:59'})"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = TIMESTAMP
-    
-    public void testTimestampToString() throws Exception {
-        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);        
-        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "string", "char({ts'2003-11-01 12:05:02.0'})"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testTimestampToDate() throws Exception {
-        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);        
-        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "date", "date({ts'2003-11-01 12:05:02.0'})"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testTimestampToTime() throws Exception {
-        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);        
-        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "time", "time({ts'2003-11-01 12:05:02.0'})"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-    
-}

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/db2/TestDB2ConvertModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/db2/TestDB2ConvertModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/db2/TestDB2ConvertModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/db2/TestDB2ConvertModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,520 @@
+/*
+ * 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.db2;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.sql.Timestamp;
+import java.util.Arrays;
+import java.util.Properties;
+
+import org.teiid.connector.jdbc.db2.DB2ConvertModifier;
+import org.teiid.connector.jdbc.db2.DB2SQLTranslator;
+import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
+
+import junit.framework.TestCase;
+
+import com.metamatrix.cdk.CommandBuilder;
+import com.metamatrix.cdk.api.EnvironmentUtility;
+import com.metamatrix.connector.api.TypeFacility;
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageFactory;
+import com.metamatrix.query.unittest.TimestampUtil;
+
+/**
+ */
+public class TestDB2ConvertModifier extends TestCase {
+
+    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
+
+    /**
+     * Constructor for TestSybaseConvertModifier.
+     * @param name
+     */
+    public TestDB2ConvertModifier(String name) {
+        super(name);
+    }
+
+    public String helpGetString(IExpression expr) throws Exception {
+        DB2SQLTranslator trans = new DB2SQLTranslator();
+        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
+        sqlVisitor.append(expr);  
+        
+        return sqlVisitor.toString();        
+    }
+
+    public void helpTest(IExpression srcExpression, String tgtType, String expectedExpression) throws Exception {
+        IFunction func = LANG_FACTORY.createFunction("convert",  //$NON-NLS-1$
+            Arrays.asList( 
+                srcExpression,
+                LANG_FACTORY.createLiteral(tgtType, String.class)),
+            TypeFacility.getDataTypeClass(tgtType));
+        
+        DB2ConvertModifier mod = new DB2ConvertModifier(LANG_FACTORY);
+        IExpression expr = mod.modify(func);
+        
+        assertEquals("Error converting from " + srcExpression.getType() + " to " + tgtType, //$NON-NLS-1$ //$NON-NLS-2$ 
+            expectedExpression, helpGetString(expr)); 
+    }
+
+    // Source = STRING
+    public void testStringToChar() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "char", "char('5', 1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "boolean", "CASE WHEN '5' = 'true' THEN 1 ELSE 0 END"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "byte", "smallint('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "short", "smallint('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "integer", "integer('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "long", "bigint('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "biginteger", "bigint('5')");  //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "float", "real('5')");//$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "double", "double('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToDate() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("2004-06-29", String.class), "date", "date('2004-06-29')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToTime() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("23:59:59", String.class), "time", "time('23:59:59')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToTimestamp() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("2004-06-29 23:59:59.987", String.class), "timestamp", "timestamp('2004-06-29 23:59:59.987')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "bigdecimal", "decimal('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    // Source = CHAR
+    
+    public void testCharToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Character('5'), Character.class), "string", "'5'"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = BOOLEAN
+    
+    public void testBooleanToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "string", "CASE WHEN 1 = 0 THEN 'false' ELSE 'true' END"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "byte", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "short", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+    
+    // Source = BYTE
+    
+    public void testByteToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "boolean", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "short", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = SHORT
+    
+    public void testShortToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "boolean", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "byte", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = INTEGER
+    
+    public void testIntegerToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "boolean", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "byte", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "short", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = LONG
+    
+    public void testLongToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "boolean", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "byte", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "short", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "integer", "integer(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = BIGINTEGER
+    
+    public void testBigIntegerToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "boolean", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "byte", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "short", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "integer", "integer(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    // Source = FLOAT
+    
+    public void testFloatToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "string", "char(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "boolean", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "byte", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "short", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "integer", "integer(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "long", "bigint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "biginteger", "bigint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "double", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "bigdecimal", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = DOUBLE
+    
+    public void testDoubleToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "string", "char(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "boolean", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "byte", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "short", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "integer", "integer(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "long", "bigint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "biginteger", "bigint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "float", "real(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "bigdecimal", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = BIGDECIMAL
+    
+    public void testBigDecimalToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "string", "char(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "boolean", "smallint(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "byte", "smallint(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "short", "smallint(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "integer", "integer(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "long", "bigint(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "biginteger", "bigint(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "float", "real(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToDoublel() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "double", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    // Source = DATE
+
+    public void testDateToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createDate(103, 10, 1), java.sql.Date.class), "string", "char({d'2003-11-01'})"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDateToTimestamp() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createDate(103, 10, 1), java.sql.Date.class), "timestamp", "timestamp({d'2003-11-01'}, '00:00:00')"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = TIME
+
+    public void testTimeToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createTime(23, 59, 59), java.sql.Time.class), "string", "char({t'23:59:59'})"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testTimeToTimestamp() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createTime(23, 59, 59), java.sql.Time.class), "timestamp", "timestamp('1970-01-01', {t'23:59:59'})"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = TIMESTAMP
+    
+    public void testTimestampToString() throws Exception {
+        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);        
+        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "string", "char({ts'2003-11-01 12:05:02.0'})"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testTimestampToDate() throws Exception {
+        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);        
+        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "date", "date({ts'2003-11-01 12:05:02.0'})"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testTimestampToTime() throws Exception {
+        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);        
+        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "time", "time({ts'2003-11-01 12:05:02.0'})"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+    
+}

Modified: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/db2/TestDB2SqlTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/db2/TestDB2SqlTranslator.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/db2/TestDB2SqlTranslator.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -20,11 +20,14 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.jdbc.db2;
+package org.teiid.connector.jdbc.db2;
 
 import java.util.Map;
 import java.util.Properties;
 
+import org.teiid.connector.jdbc.db2.DB2SQLTranslator;
+import org.teiid.connector.jdbc.translator.TranslatedCommand;
+
 import junit.framework.TestCase;
 
 import com.metamatrix.cdk.api.EnvironmentUtility;
@@ -32,7 +35,6 @@
 import com.metamatrix.cdk.unittest.FakeTranslationFactory;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
 import com.metamatrix.connector.language.ICommand;
 import com.metamatrix.core.util.UnitTestUtil;
 

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/derby (from rev 486, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/derby)


Property changes on: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/derby
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/derby/TestDerbyConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/derby/TestDerbyConvertModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/derby/TestDerbyConvertModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,519 +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.jdbc.derby;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.sql.Timestamp;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
-import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.ILanguageFactory;
-import com.metamatrix.query.unittest.TimestampUtil;
-
-/**
- */
-public class TestDerbyConvertModifier extends TestCase {
-
-    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
-
-    /**
-     * Constructor for TestSybaseConvertModifier.
-     * @param name
-     */
-    public TestDerbyConvertModifier(String name) {
-        super(name);
-    }
-
-    public String helpGetString(IExpression expr) throws Exception {
-        DerbySQLTranslator trans = new DerbySQLTranslator();
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
-        
-        SQLConversionVisitor sqlVisitor = new SQLConversionVisitor(trans); 
-        sqlVisitor.append(expr);  
-        
-        return sqlVisitor.toString();        
-    }
-
-    public void helpTest(IExpression srcExpression, String tgtType, String expectedExpression) throws Exception {
-        IFunction func = LANG_FACTORY.createFunction("convert",  //$NON-NLS-1$
-            new IExpression[] { 
-                srcExpression,
-                LANG_FACTORY.createLiteral(tgtType, String.class)},
-            TypeFacility.getDataTypeClass(tgtType));
-        
-        DerbyConvertModifier mod = new DerbyConvertModifier(LANG_FACTORY);
-        IExpression expr = mod.modify(func);
-        
-        assertEquals("Error converting from " + srcExpression.getType() + " to " + tgtType, //$NON-NLS-1$ //$NON-NLS-2$ 
-            expectedExpression, helpGetString(expr)); 
-    }
-
-    // Source = STRING
-
-    public void testStringToChar() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "char", "char('5', 1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "boolean", "CASE WHEN '5' = 'true' THEN 1 ELSE 0 END"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "byte", "smallint('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "short", "smallint('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "integer", "integer('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "long", "bigint('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "biginteger", "bigint('5')");  //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "float", "cast(cast('5' as decimal) as float)");//$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "double", "cast(cast('5' as decimal) as double)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToDate() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("2004-06-29", String.class), "date", "date('2004-06-29')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToTime() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("23:59:59", String.class), "time", "time('23:59:59')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToTimestamp() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("2004-06-29 23:59:59.987", String.class), "timestamp", "timestamp('2004-06-29 23:59:59.987')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "bigdecimal", "cast('5' as decimal)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    // Source = CHAR
-    
-    public void testCharToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Character('5'), Character.class), "string", "'5'"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = BOOLEAN
-    
-    public void testBooleanToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "string", "CASE WHEN 1 = 0 THEN 'false' ELSE 'true' END"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "byte", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "short", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-    
-    // Source = BYTE
-    
-    public void testByteToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "boolean", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "short", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = SHORT
-    
-    public void testShortToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "boolean", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "byte", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = INTEGER
-    
-    public void testIntegerToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "boolean", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "byte", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "short", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = LONG
-    
-    public void testLongToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "boolean", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "byte", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "short", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "integer", "integer(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = BIGINTEGER
-    
-    public void testBigIntegerToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "boolean", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "byte", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "short", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "integer", "integer(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    // Source = FLOAT
-    
-    public void testFloatToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "string", "char(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "boolean", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "byte", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "short", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "integer", "integer(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "long", "bigint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "biginteger", "bigint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "double", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "bigdecimal", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = DOUBLE
-    
-    public void testDoubleToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "string", "char(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "boolean", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "byte", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "short", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "integer", "integer(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "long", "bigint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "biginteger", "bigint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "float", "cast(1.2 as float)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "bigdecimal", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = BIGDECIMAL
-    
-    public void testBigDecimalToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "string", "char(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "boolean", "smallint(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "byte", "smallint(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "short", "smallint(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "integer", "integer(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "long", "bigint(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "biginteger", "bigint(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "float", "cast(1.0 as float)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToDoublel() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "double", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    // Source = DATE
-
-    public void testDateToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createDate(103, 10, 1), java.sql.Date.class), "string", "char({d'2003-11-01'})"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDateToTimestamp() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createDate(103, 10, 1), java.sql.Date.class), "timestamp", "timestamp({d'2003-11-01'}, '00:00:00')"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = TIME
-
-    public void testTimeToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createTime(23, 59, 59), java.sql.Time.class), "string", "char({t'23:59:59'})"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testTimeToTimestamp() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createTime(23, 59, 59), java.sql.Time.class), "timestamp", "timestamp('1970-01-01', {t'23:59:59'})"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = TIMESTAMP
-    
-    public void testTimestampToString() throws Exception {
-        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);        
-        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "string", "char({ts'2003-11-01 12:05:02.0'})"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testTimestampToDate() throws Exception {
-        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);        
-        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "date", "date({ts'2003-11-01 12:05:02.0'})"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testTimestampToTime() throws Exception {
-    	Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);        
-        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "time", "time({ts'2003-11-01 12:05:02.0'})"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    
-}

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/derby/TestDerbyConvertModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/derby/TestDerbyConvertModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/derby/TestDerbyConvertModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/derby/TestDerbyConvertModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,523 @@
+/*
+ * 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.derby;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.sql.Timestamp;
+import java.util.Arrays;
+import java.util.Properties;
+
+import org.teiid.connector.jdbc.derby.DerbyConvertModifier;
+import org.teiid.connector.jdbc.derby.DerbySQLTranslator;
+import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
+
+import junit.framework.TestCase;
+
+import com.metamatrix.cdk.CommandBuilder;
+import com.metamatrix.cdk.api.EnvironmentUtility;
+import com.metamatrix.connector.api.TypeFacility;
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageFactory;
+import com.metamatrix.query.unittest.TimestampUtil;
+
+/**
+ */
+public class TestDerbyConvertModifier extends TestCase {
+
+    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
+
+    /**
+     * Constructor for TestSybaseConvertModifier.
+     * @param name
+     */
+    public TestDerbyConvertModifier(String name) {
+        super(name);
+    }
+
+    public String helpGetString(IExpression expr) throws Exception {
+        DerbySQLTranslator trans = new DerbySQLTranslator();
+        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        
+        SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
+        sqlVisitor.append(expr);  
+        
+        return sqlVisitor.toString();        
+    }
+
+    public void helpTest(IExpression srcExpression, String tgtType, String expectedExpression) throws Exception {
+        IFunction func = LANG_FACTORY.createFunction("convert",  //$NON-NLS-1$
+            Arrays.asList( 
+                srcExpression,
+                LANG_FACTORY.createLiteral(tgtType, String.class)),
+            TypeFacility.getDataTypeClass(tgtType));
+        
+        DerbyConvertModifier mod = new DerbyConvertModifier(LANG_FACTORY);
+        IExpression expr = mod.modify(func);
+        
+        assertEquals("Error converting from " + srcExpression.getType() + " to " + tgtType, //$NON-NLS-1$ //$NON-NLS-2$ 
+            expectedExpression, helpGetString(expr)); 
+    }
+
+    // Source = STRING
+
+    public void testStringToChar() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "char", "char('5', 1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "boolean", "CASE WHEN '5' = 'true' THEN 1 ELSE 0 END"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "byte", "smallint('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "short", "smallint('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "integer", "integer('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "long", "bigint('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "biginteger", "bigint('5')");  //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "float", "cast(cast('5' as decimal) as float)");//$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "double", "cast(cast('5' as decimal) as double)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToDate() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("2004-06-29", String.class), "date", "date('2004-06-29')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToTime() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("23:59:59", String.class), "time", "time('23:59:59')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToTimestamp() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("2004-06-29 23:59:59.987", String.class), "timestamp", "timestamp('2004-06-29 23:59:59.987')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "bigdecimal", "cast('5' as decimal)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    // Source = CHAR
+    
+    public void testCharToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Character('5'), Character.class), "string", "'5'"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = BOOLEAN
+    
+    public void testBooleanToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "string", "CASE WHEN 1 = 0 THEN 'false' ELSE 'true' END"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "byte", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "short", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+    
+    // Source = BYTE
+    
+    public void testByteToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "boolean", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "short", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = SHORT
+    
+    public void testShortToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "boolean", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "byte", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = INTEGER
+    
+    public void testIntegerToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "boolean", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "byte", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "short", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = LONG
+    
+    public void testLongToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "boolean", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "byte", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "short", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "integer", "integer(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = BIGINTEGER
+    
+    public void testBigIntegerToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "string", "char(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "boolean", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "byte", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "short", "smallint(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "integer", "integer(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    // Source = FLOAT
+    
+    public void testFloatToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "string", "char(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "boolean", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "byte", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "short", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "integer", "integer(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "long", "bigint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "biginteger", "bigint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "double", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "bigdecimal", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = DOUBLE
+    
+    public void testDoubleToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "string", "char(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "boolean", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "byte", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "short", "smallint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "integer", "integer(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "long", "bigint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "biginteger", "bigint(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "float", "cast(1.2 as float)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "bigdecimal", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = BIGDECIMAL
+    
+    public void testBigDecimalToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "string", "char(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "boolean", "smallint(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "byte", "smallint(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "short", "smallint(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "integer", "integer(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "long", "bigint(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "biginteger", "bigint(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "float", "cast(1.0 as float)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToDoublel() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "double", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    // Source = DATE
+
+    public void testDateToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createDate(103, 10, 1), java.sql.Date.class), "string", "char({d'2003-11-01'})"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDateToTimestamp() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createDate(103, 10, 1), java.sql.Date.class), "timestamp", "timestamp({d'2003-11-01'}, '00:00:00')"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = TIME
+
+    public void testTimeToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createTime(23, 59, 59), java.sql.Time.class), "string", "char({t'23:59:59'})"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testTimeToTimestamp() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createTime(23, 59, 59), java.sql.Time.class), "timestamp", "timestamp('1970-01-01', {t'23:59:59'})"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = TIMESTAMP
+    
+    public void testTimestampToString() throws Exception {
+        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);        
+        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "string", "char({ts'2003-11-01 12:05:02.0'})"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testTimestampToDate() throws Exception {
+        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);        
+        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "date", "date({ts'2003-11-01 12:05:02.0'})"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testTimestampToTime() throws Exception {
+    	Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);        
+        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "time", "time({ts'2003-11-01 12:05:02.0'})"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    
+}

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/impl (from rev 486, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/extension/impl)


Property changes on: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/impl
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/impl/TestDropFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/extension/impl/TestDropFunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/impl/TestDropFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,73 +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.jdbc.extension.impl;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.connector.jdbc.translator.DropFunctionModifier;
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.ILiteral;
-
-/**
- */
-public class TestDropFunctionModifier extends TestCase {
-
-    /**
-     * Constructor for TestDropFunctionModifier.
-     * @param name
-     */
-    public TestDropFunctionModifier(String name) {
-        super(name);
-    }
-
-    public void testDrop() {
-        DropFunctionModifier mod = new DropFunctionModifier();
-    
-        ILiteral arg1 = CommandBuilder.getLanuageFactory().createLiteral(new Integer(5), Integer.class);
-        ILiteral arg2 = CommandBuilder.getLanuageFactory().createLiteral("string", String.class);//$NON-NLS-1$
-        IFunction func = CommandBuilder.getLanuageFactory().createFunction("convert", new IExpression[] { arg1, arg2}, Integer.class); //$NON-NLS-1$
-                
-        IExpression output = mod.modify(func);
-        assertEquals("Did not get expected function after using drop modifier", arg1, output); //$NON-NLS-1$
-    }
-    
-    /**
-     * In SQL Server convert(), the type arg is the first arg, and the column name
-     * is the second arg.  DropFunctionModifier needs to be able to handle the column name
-     * arg being in different indices.
-     */
-    public void testDrop2() {
-        DropFunctionModifier mod = new DropFunctionModifier();
-        mod.setReplaceIndex(1);
-    
-        ILiteral arg1 = CommandBuilder.getLanuageFactory().createLiteral("string", String.class);//$NON-NLS-1$
-        ILiteral arg2 = CommandBuilder.getLanuageFactory().createLiteral(new Integer(5), Integer.class);
-        IFunction func = CommandBuilder.getLanuageFactory().createFunction("convert", new IExpression[] { arg1, arg2}, Integer.class); //$NON-NLS-1$
-                
-        IExpression output = mod.modify(func);
-        assertEquals("Did not get expected function after using drop modifier", arg2, output); //$NON-NLS-1$
-    }
-    
-}

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/impl/TestDropFunctionModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/extension/impl/TestDropFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/impl/TestDropFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/impl/TestDropFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,76 @@
+/*
+ * 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.extension.impl;
+
+import java.util.Arrays;
+
+import org.teiid.connector.jdbc.translator.DropFunctionModifier;
+
+import junit.framework.TestCase;
+
+import com.metamatrix.cdk.CommandBuilder;
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILiteral;
+
+/**
+ */
+public class TestDropFunctionModifier extends TestCase {
+
+    /**
+     * Constructor for TestDropFunctionModifier.
+     * @param name
+     */
+    public TestDropFunctionModifier(String name) {
+        super(name);
+    }
+
+    public void testDrop() {
+        DropFunctionModifier mod = new DropFunctionModifier();
+    
+        ILiteral arg1 = CommandBuilder.getLanuageFactory().createLiteral(new Integer(5), Integer.class);
+        ILiteral arg2 = CommandBuilder.getLanuageFactory().createLiteral("string", String.class);//$NON-NLS-1$
+        IFunction func = CommandBuilder.getLanuageFactory().createFunction("convert", Arrays.asList(arg1, arg2), Integer.class); //$NON-NLS-1$
+                
+        IExpression output = mod.modify(func);
+        assertEquals("Did not get expected function after using drop modifier", arg1, output); //$NON-NLS-1$
+    }
+    
+    /**
+     * In SQL Server convert(), the type arg is the first arg, and the column name
+     * is the second arg.  DropFunctionModifier needs to be able to handle the column name
+     * arg being in different indices.
+     */
+    public void testDrop2() {
+        DropFunctionModifier mod = new DropFunctionModifier();
+        mod.setReplaceIndex(1);
+    
+        ILiteral arg1 = CommandBuilder.getLanuageFactory().createLiteral("string", String.class);//$NON-NLS-1$
+        ILiteral arg2 = CommandBuilder.getLanuageFactory().createLiteral(new Integer(5), Integer.class);
+        IFunction func = CommandBuilder.getLanuageFactory().createFunction("convert", Arrays.asList(arg1, arg2), Integer.class); //$NON-NLS-1$
+                
+        IExpression output = mod.modify(func);
+        assertEquals("Did not get expected function after using drop modifier", arg2, output); //$NON-NLS-1$
+    }
+    
+}

Deleted: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/impl/TestEscapeSyntaxModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/extension/impl/TestEscapeSyntaxModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/impl/TestEscapeSyntaxModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,62 +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.jdbc.extension.impl;
-
-import java.util.Arrays;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.connector.jdbc.translator.EscapeSyntaxModifier;
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.ILiteral;
-
-/**
- */
-public class TestEscapeSyntaxModifier extends TestCase {
-
-    /**
-     * Constructor for TestDropFunctionModifier.
-     * @param name
-     */
-    public TestEscapeSyntaxModifier(String name) {
-        super(name);
-    }
-
-    public void testEscape() {
-        EscapeSyntaxModifier mod = new EscapeSyntaxModifier();
-    
-        ILiteral arg1 = CommandBuilder.getLanuageFactory().createLiteral("arg1", String.class); //$NON-NLS-1$
-        ILiteral arg2 = CommandBuilder.getLanuageFactory().createLiteral("arg2", String.class);//$NON-NLS-1$
-        IFunction func = CommandBuilder.getLanuageFactory().createFunction("concat", new IExpression[] { arg1, arg2}, Integer.class); //$NON-NLS-1$
-                
-        func = (IFunction) mod.modify(func);
-        List parts = mod.translate(func);
-        
-        List expected = Arrays.asList(new Object[] { "{fn ", "concat", "(", arg1, ", ", arg2, ")", "}"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
-        assertEquals(expected, parts);
-    }
-    
-}

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/impl/TestEscapeSyntaxModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/extension/impl/TestEscapeSyntaxModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/impl/TestEscapeSyntaxModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/extension/impl/TestEscapeSyntaxModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,62 @@
+/*
+ * 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.extension.impl;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.connector.jdbc.translator.EscapeSyntaxModifier;
+
+import junit.framework.TestCase;
+
+import com.metamatrix.cdk.CommandBuilder;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILiteral;
+
+/**
+ */
+public class TestEscapeSyntaxModifier extends TestCase {
+
+    /**
+     * Constructor for TestDropFunctionModifier.
+     * @param name
+     */
+    public TestEscapeSyntaxModifier(String name) {
+        super(name);
+    }
+
+    public void testEscape() {
+        EscapeSyntaxModifier mod = new EscapeSyntaxModifier();
+    
+        ILiteral arg1 = CommandBuilder.getLanuageFactory().createLiteral("arg1", String.class); //$NON-NLS-1$
+        ILiteral arg2 = CommandBuilder.getLanuageFactory().createLiteral("arg2", String.class);//$NON-NLS-1$
+        IFunction func = CommandBuilder.getLanuageFactory().createFunction("concat", Arrays.asList( arg1, arg2), Integer.class); //$NON-NLS-1$
+                
+        func = (IFunction) mod.modify(func);
+        List parts = mod.translate(func);
+        
+        List expected = Arrays.asList(new Object[] { "{fn ", "concat", "(", arg1, ", ", arg2, ")", "}"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+        assertEquals(expected, parts);
+    }
+    
+}

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/mysql (from rev 486, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/mysql)


Property changes on: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/mysql
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/mysql/TestMySQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/mysql/TestMySQLTranslator.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/mysql/TestMySQLTranslator.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -20,17 +20,19 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.jdbc.mysql;
+package org.teiid.connector.jdbc.mysql;
 
 import java.util.Map;
 import java.util.Properties;
 
+import org.teiid.connector.jdbc.MetadataFactory;
+import org.teiid.connector.jdbc.mysql.MySQLTranslator;
+import org.teiid.connector.jdbc.translator.TranslatedCommand;
+
 import junit.framework.TestCase;
 
 import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.jdbc.MetadataFactory;
-import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
 import com.metamatrix.connector.language.ICommand;
 
 /**

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle (from rev 486, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle)


Property changes on: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestDayWeekQuarterFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestDayWeekQuarterFunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestDayWeekQuarterFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,130 +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.jdbc.oracle;
-
-import java.sql.Timestamp;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
-import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.ILanguageFactory;
-import com.metamatrix.connector.language.ILiteral;
-import com.metamatrix.query.unittest.TimestampUtil;
-
-/**
- */
-public class TestDayWeekQuarterFunctionModifier extends TestCase {
-
-    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
-
-    /**
-     * Constructor for TestHourFunctionModifier.
-     * @param name
-     */
-    public TestDayWeekQuarterFunctionModifier(String name) {
-        super(name);
-    }
-
-    public IExpression helpTestMod(ILiteral c, String format, String expectedStr) throws Exception {
-        IFunction func = LANG_FACTORY.createFunction("dayweekquarter",  //$NON-NLS-1$ 
-            new IExpression[] { c },
-            String.class);
-        
-        DayWeekQuarterFunctionModifier mod = new DayWeekQuarterFunctionModifier (LANG_FACTORY, format);
-        IExpression expr = mod.modify(func);
-        
-        OracleSQLTranslator trans = new OracleSQLTranslator();
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
-        
-        SQLConversionVisitor sqlVisitor = new SQLConversionVisitor(trans); 
-        sqlVisitor.append(expr);  
-        assertEquals(expectedStr, sqlVisitor.toString());
-        
-        return expr;
-    }
-
-    public void test1() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 0), Timestamp.class);
-        helpTestMod(arg1, "DDD", //$NON-NLS-1$
-            "TO_NUMBER(TO_CHAR({ts'2004-01-21 10:05:00.0'}, 'DDD'))"); //$NON-NLS-1$
-    }
-
-    public void test2() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createDate(104, 0, 21), java.sql.Date.class);
-        helpTestMod(arg1, "DDD", //$NON-NLS-1$
-            "TO_NUMBER(TO_CHAR({d'2004-01-21'}, 'DDD'))"); //$NON-NLS-1$
-    }
-    
-    public void test3() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 0), Timestamp.class);
-        helpTestMod(arg1, "D",  //$NON-NLS-1$
-            "TO_NUMBER(TO_CHAR({ts'2004-01-21 10:05:00.0'}, 'D'))"); //$NON-NLS-1$
-    }
-
-    public void test4() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createDate(104, 0, 21), java.sql.Date.class);
-        helpTestMod(arg1, "D", //$NON-NLS-1$
-            "TO_NUMBER(TO_CHAR({d'2004-01-21'}, 'D'))"); //$NON-NLS-1$
-    }
-    
-    public void test5() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 0), Timestamp.class);
-        helpTestMod(arg1, "DD",  //$NON-NLS-1$
-            "TO_NUMBER(TO_CHAR({ts'2004-01-21 10:05:00.0'}, 'DD'))"); //$NON-NLS-1$
-    }
-
-    public void test6() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createDate(104, 0, 21), java.sql.Date.class);
-        helpTestMod(arg1, "DD", //$NON-NLS-1$
-            "TO_NUMBER(TO_CHAR({d'2004-01-21'}, 'DD'))"); //$NON-NLS-1$
-    }
-    
-    public void test7() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 0), Timestamp.class);
-        helpTestMod(arg1, "WW",  //$NON-NLS-1$
-            "TO_NUMBER(TO_CHAR({ts'2004-01-21 10:05:00.0'}, 'WW'))"); //$NON-NLS-1$
-    }
-
-    public void test8() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createDate(104, 0, 21), java.sql.Date.class);
-        helpTestMod(arg1, "WW", //$NON-NLS-1$
-            "TO_NUMBER(TO_CHAR({d'2004-01-21'}, 'WW'))"); //$NON-NLS-1$
-    }
-    
-    public void test9() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 0), Timestamp.class);
-        helpTestMod(arg1, "Q",  //$NON-NLS-1$
-            "TO_NUMBER(TO_CHAR({ts'2004-01-21 10:05:00.0'}, 'Q'))"); //$NON-NLS-1$
-    }
-
-    public void test10() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createDate(104, 0, 21), java.sql.Date.class);
-        helpTestMod(arg1, "Q", //$NON-NLS-1$
-            "TO_NUMBER(TO_CHAR({d'2004-01-21'}, 'Q'))"); //$NON-NLS-1$
-    }
-}
\ No newline at end of file

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestDayWeekQuarterFunctionModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestDayWeekQuarterFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestDayWeekQuarterFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestDayWeekQuarterFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,134 @@
+/*
+ * 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.oracle;
+
+import java.sql.Timestamp;
+import java.util.Arrays;
+import java.util.Properties;
+
+import org.teiid.connector.jdbc.oracle.DayWeekQuarterFunctionModifier;
+import org.teiid.connector.jdbc.oracle.OracleSQLTranslator;
+import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
+
+import junit.framework.TestCase;
+
+import com.metamatrix.cdk.CommandBuilder;
+import com.metamatrix.cdk.api.EnvironmentUtility;
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageFactory;
+import com.metamatrix.connector.language.ILiteral;
+import com.metamatrix.query.unittest.TimestampUtil;
+
+/**
+ */
+public class TestDayWeekQuarterFunctionModifier extends TestCase {
+
+    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
+
+    /**
+     * Constructor for TestHourFunctionModifier.
+     * @param name
+     */
+    public TestDayWeekQuarterFunctionModifier(String name) {
+        super(name);
+    }
+
+    public IExpression helpTestMod(ILiteral c, String format, String expectedStr) throws Exception {
+        IFunction func = LANG_FACTORY.createFunction("dayweekquarter",  //$NON-NLS-1$ 
+            Arrays.asList(c),
+            String.class);
+        
+        DayWeekQuarterFunctionModifier mod = new DayWeekQuarterFunctionModifier (LANG_FACTORY, format);
+        IExpression expr = mod.modify(func);
+        
+        OracleSQLTranslator trans = new OracleSQLTranslator();
+        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        
+        SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
+        sqlVisitor.append(expr);  
+        assertEquals(expectedStr, sqlVisitor.toString());
+        
+        return expr;
+    }
+
+    public void test1() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 0), Timestamp.class);
+        helpTestMod(arg1, "DDD", //$NON-NLS-1$
+            "TO_NUMBER(TO_CHAR({ts'2004-01-21 10:05:00.0'}, 'DDD'))"); //$NON-NLS-1$
+    }
+
+    public void test2() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createDate(104, 0, 21), java.sql.Date.class);
+        helpTestMod(arg1, "DDD", //$NON-NLS-1$
+            "TO_NUMBER(TO_CHAR({d'2004-01-21'}, 'DDD'))"); //$NON-NLS-1$
+    }
+    
+    public void test3() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 0), Timestamp.class);
+        helpTestMod(arg1, "D",  //$NON-NLS-1$
+            "TO_NUMBER(TO_CHAR({ts'2004-01-21 10:05:00.0'}, 'D'))"); //$NON-NLS-1$
+    }
+
+    public void test4() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createDate(104, 0, 21), java.sql.Date.class);
+        helpTestMod(arg1, "D", //$NON-NLS-1$
+            "TO_NUMBER(TO_CHAR({d'2004-01-21'}, 'D'))"); //$NON-NLS-1$
+    }
+    
+    public void test5() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 0), Timestamp.class);
+        helpTestMod(arg1, "DD",  //$NON-NLS-1$
+            "TO_NUMBER(TO_CHAR({ts'2004-01-21 10:05:00.0'}, 'DD'))"); //$NON-NLS-1$
+    }
+
+    public void test6() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createDate(104, 0, 21), java.sql.Date.class);
+        helpTestMod(arg1, "DD", //$NON-NLS-1$
+            "TO_NUMBER(TO_CHAR({d'2004-01-21'}, 'DD'))"); //$NON-NLS-1$
+    }
+    
+    public void test7() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 0), Timestamp.class);
+        helpTestMod(arg1, "WW",  //$NON-NLS-1$
+            "TO_NUMBER(TO_CHAR({ts'2004-01-21 10:05:00.0'}, 'WW'))"); //$NON-NLS-1$
+    }
+
+    public void test8() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createDate(104, 0, 21), java.sql.Date.class);
+        helpTestMod(arg1, "WW", //$NON-NLS-1$
+            "TO_NUMBER(TO_CHAR({d'2004-01-21'}, 'WW'))"); //$NON-NLS-1$
+    }
+    
+    public void test9() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 0), Timestamp.class);
+        helpTestMod(arg1, "Q",  //$NON-NLS-1$
+            "TO_NUMBER(TO_CHAR({ts'2004-01-21 10:05:00.0'}, 'Q'))"); //$NON-NLS-1$
+    }
+
+    public void test10() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createDate(104, 0, 21), java.sql.Date.class);
+        helpTestMod(arg1, "Q", //$NON-NLS-1$
+            "TO_NUMBER(TO_CHAR({d'2004-01-21'}, 'Q'))"); //$NON-NLS-1$
+    }
+}
\ No newline at end of file

Deleted: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestExtractFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestExtractFunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestExtractFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,114 +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.jdbc.oracle;
-
-import java.sql.Timestamp;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
-import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
-import com.metamatrix.connector.language.IElement;
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.IGroup;
-import com.metamatrix.connector.language.ILanguageFactory;
-import com.metamatrix.connector.language.ILiteral;
-import com.metamatrix.query.unittest.TimestampUtil;
-
-/**
- */
-public class TestExtractFunctionModifier extends TestCase {
-
-    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
-
-    /**
-     * Constructor for TestMonthFunctionModifier.
-     * @param name
-     */
-    public TestExtractFunctionModifier(String name) {
-        super(name);
-    }
-
-    public IExpression helpTestMod(IExpression c, String expectedStr, String target) throws Exception {
-        IFunction func = LANG_FACTORY.createFunction(target, 
-            new IExpression[] { c },
-            Integer.class);
-        
-        ExtractFunctionModifier mod = new ExtractFunctionModifier (target);
-        IExpression expr = mod.modify(func);
-
-        OracleSQLTranslator trans = new OracleSQLTranslator();
-        trans.registerFunctionModifier("extract", mod);
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
-        
-        SQLConversionVisitor sqlVisitor = new SQLConversionVisitor(trans); 
-
-        //sqlVisitor.setFunctionModifiers(trans.getFunctionModifiers());
-        sqlVisitor.append(expr);  
-        //System.out.println(" expected: " + expectedStr + " \t actual: " + sqlVisitor.toString());
-        assertEquals(expectedStr, sqlVisitor.toString());
-        
-        return expr;
-    }
-    public void test1() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createDate(104, 0, 21), java.sql.Date.class);
-        helpTestMod(arg1, "EXTRACT(MONTH FROM {d'2004-01-21'})" , "month");   //$NON-NLS-1$ //$NON-NLS-2$
-    }
-    
-    public void test2() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 17, 5, 0, 0), Timestamp.class);
-        helpTestMod(arg1, "EXTRACT(MONTH FROM {ts'2004-01-21 17:05:00.0'})", "month"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-    
-    public void test3() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createDate(104, 0, 21), java.sql.Date.class);
-        helpTestMod(arg1, "EXTRACT(YEAR FROM {d'2004-01-21'})", "year"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void test4() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 17, 5, 0, 0), Timestamp.class);
-        helpTestMod(arg1, "EXTRACT(YEAR FROM {ts'2004-01-21 17:05:00.0'})", "year"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-    
-    public void test5() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createDate(104, 0, 21), java.sql.Date.class);
-        helpTestMod(arg1, "EXTRACT(DAY FROM {d'2004-01-21'})", "dayofmonth"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void test6() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 17, 5, 0, 0), Timestamp.class);
-        helpTestMod(arg1, "EXTRACT(DAY FROM {ts'2004-01-21 17:05:00.0'})", "dayofmonth"); //$NON-NLS-1$ //$NON-NLS-2$
-    }    
-
-    public void test11() throws Exception {
-        IGroup group = LANG_FACTORY.createGroup(null, "group", null); //$NON-NLS-1$
-        IElement elem = LANG_FACTORY.createElement("col", group, null, TypeFacility.RUNTIME_TYPES.DATE); //$NON-NLS-1$
-        helpTestMod(elem, "EXTRACT(DAY FROM col)", "dayofmonth"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-    
-}
-

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestExtractFunctionModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestExtractFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestExtractFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestExtractFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,118 @@
+/*
+ * 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.oracle;
+
+import java.sql.Timestamp;
+import java.util.Arrays;
+import java.util.Properties;
+
+import org.teiid.connector.jdbc.oracle.ExtractFunctionModifier;
+import org.teiid.connector.jdbc.oracle.OracleSQLTranslator;
+import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
+
+import junit.framework.TestCase;
+
+import com.metamatrix.cdk.CommandBuilder;
+import com.metamatrix.cdk.api.EnvironmentUtility;
+import com.metamatrix.connector.api.TypeFacility;
+import com.metamatrix.connector.language.IElement;
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.IGroup;
+import com.metamatrix.connector.language.ILanguageFactory;
+import com.metamatrix.connector.language.ILiteral;
+import com.metamatrix.query.unittest.TimestampUtil;
+
+/**
+ */
+public class TestExtractFunctionModifier extends TestCase {
+
+    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
+
+    /**
+     * Constructor for TestMonthFunctionModifier.
+     * @param name
+     */
+    public TestExtractFunctionModifier(String name) {
+        super(name);
+    }
+
+    public IExpression helpTestMod(IExpression c, String expectedStr, String target) throws Exception {
+        IFunction func = LANG_FACTORY.createFunction(target, 
+            Arrays.asList(c),
+            Integer.class);
+        
+        ExtractFunctionModifier mod = new ExtractFunctionModifier (target);
+        IExpression expr = mod.modify(func);
+
+        OracleSQLTranslator trans = new OracleSQLTranslator();
+        trans.registerFunctionModifier("extract", mod);
+        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        
+        SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
+
+        //sqlVisitor.setFunctionModifiers(trans.getFunctionModifiers());
+        sqlVisitor.append(expr);  
+        //System.out.println(" expected: " + expectedStr + " \t actual: " + sqlVisitor.toString());
+        assertEquals(expectedStr, sqlVisitor.toString());
+        
+        return expr;
+    }
+    public void test1() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createDate(104, 0, 21), java.sql.Date.class);
+        helpTestMod(arg1, "EXTRACT(MONTH FROM {d'2004-01-21'})" , "month");   //$NON-NLS-1$ //$NON-NLS-2$
+    }
+    
+    public void test2() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 17, 5, 0, 0), Timestamp.class);
+        helpTestMod(arg1, "EXTRACT(MONTH FROM {ts'2004-01-21 17:05:00.0'})", "month"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+    
+    public void test3() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createDate(104, 0, 21), java.sql.Date.class);
+        helpTestMod(arg1, "EXTRACT(YEAR FROM {d'2004-01-21'})", "year"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void test4() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 17, 5, 0, 0), Timestamp.class);
+        helpTestMod(arg1, "EXTRACT(YEAR FROM {ts'2004-01-21 17:05:00.0'})", "year"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+    
+    public void test5() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createDate(104, 0, 21), java.sql.Date.class);
+        helpTestMod(arg1, "EXTRACT(DAY FROM {d'2004-01-21'})", "dayofmonth"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void test6() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 17, 5, 0, 0), Timestamp.class);
+        helpTestMod(arg1, "EXTRACT(DAY FROM {ts'2004-01-21 17:05:00.0'})", "dayofmonth"); //$NON-NLS-1$ //$NON-NLS-2$
+    }    
+
+    public void test11() throws Exception {
+        IGroup group = LANG_FACTORY.createGroup(null, "group", null); //$NON-NLS-1$
+        IElement elem = LANG_FACTORY.createElement("col", group, null, TypeFacility.RUNTIME_TYPES.DATE); //$NON-NLS-1$
+        helpTestMod(elem, "EXTRACT(DAY FROM col)", "dayofmonth"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+    
+}
+

Deleted: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLeftOrRightFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestLeftOrRightFunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLeftOrRightFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,83 +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.jdbc.oracle;
-
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
-import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.ILanguageFactory;
-import com.metamatrix.connector.language.ILiteral;
-
-/**
- */
-public class TestLeftOrRightFunctionModifier extends TestCase {
-
-    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
-
-    /**
-     * Constructor for TestHourFunctionModifier.
-     * @param name
-     */
-    public TestLeftOrRightFunctionModifier(String name) {
-        super(name);
-    }
-
-    public IExpression helpTestMod(ILiteral c, ILiteral d, String target, String expectedStr) throws Exception {
-        IFunction func = LANG_FACTORY.createFunction(target,
-            new IExpression[] { c, d },
-            String.class);
-        
-        LeftOrRightFunctionModifier mod = new LeftOrRightFunctionModifier (LANG_FACTORY);
-        IExpression expr = mod.modify(func);
-        
-        OracleSQLTranslator trans = new OracleSQLTranslator();
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
-        
-        SQLConversionVisitor sqlVisitor = new SQLConversionVisitor(trans); 
-        sqlVisitor.append(expr);  
-        //System.out.println(" expected: " + expectedStr + " \t actual: " + sqlVisitor.toString());
-        assertEquals(expectedStr, sqlVisitor.toString());
-        
-        return expr;
-    }
-
-    public void test1() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral("1234214", String.class); //$NON-NLS-1$
-        ILiteral count = LANG_FACTORY.createLiteral(new Integer(11), Integer.class);
-        helpTestMod(arg1, count, "left", //$NON-NLS-1$
-            "SUBSTR('1234214', 1, 11)"); //$NON-NLS-1$
-    }
-    
-    public void test2() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral("1234214", String.class); //$NON-NLS-1$
-        ILiteral count = LANG_FACTORY.createLiteral(new Integer(2), Integer.class);
-        helpTestMod(arg1, count, "right", //$NON-NLS-1$
-            "SUBSTR('1234214', (-1 * 2))"); //$NON-NLS-1$
-    }
-}
\ No newline at end of file

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLeftOrRightFunctionModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestLeftOrRightFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLeftOrRightFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLeftOrRightFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,87 @@
+/*
+ * 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.oracle;
+
+import java.util.Arrays;
+import java.util.Properties;
+
+import org.teiid.connector.jdbc.oracle.LeftOrRightFunctionModifier;
+import org.teiid.connector.jdbc.oracle.OracleSQLTranslator;
+import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
+
+import junit.framework.TestCase;
+
+import com.metamatrix.cdk.CommandBuilder;
+import com.metamatrix.cdk.api.EnvironmentUtility;
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageFactory;
+import com.metamatrix.connector.language.ILiteral;
+
+/**
+ */
+public class TestLeftOrRightFunctionModifier extends TestCase {
+
+    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
+
+    /**
+     * Constructor for TestHourFunctionModifier.
+     * @param name
+     */
+    public TestLeftOrRightFunctionModifier(String name) {
+        super(name);
+    }
+
+    public IExpression helpTestMod(ILiteral c, ILiteral d, String target, String expectedStr) throws Exception {
+        IFunction func = LANG_FACTORY.createFunction(target,
+            Arrays.asList( c, d ),
+            String.class);
+        
+        LeftOrRightFunctionModifier mod = new LeftOrRightFunctionModifier (LANG_FACTORY);
+        IExpression expr = mod.modify(func);
+        
+        OracleSQLTranslator trans = new OracleSQLTranslator();
+        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        
+        SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
+        sqlVisitor.append(expr);  
+        //System.out.println(" expected: " + expectedStr + " \t actual: " + sqlVisitor.toString());
+        assertEquals(expectedStr, sqlVisitor.toString());
+        
+        return expr;
+    }
+
+    public void test1() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral("1234214", String.class); //$NON-NLS-1$
+        ILiteral count = LANG_FACTORY.createLiteral(new Integer(11), Integer.class);
+        helpTestMod(arg1, count, "left", //$NON-NLS-1$
+            "SUBSTR('1234214', 1, 11)"); //$NON-NLS-1$
+    }
+    
+    public void test2() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral("1234214", String.class); //$NON-NLS-1$
+        ILiteral count = LANG_FACTORY.createLiteral(new Integer(2), Integer.class);
+        helpTestMod(arg1, count, "right", //$NON-NLS-1$
+            "SUBSTR('1234214', (-1 * 2))"); //$NON-NLS-1$
+    }
+}
\ No newline at end of file

Deleted: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLocateFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestLocateFunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLocateFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,104 +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.jdbc.oracle;
-
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
-import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.ILanguageFactory;
-
-/**
- */
-public class TestLocateFunctionModifier extends TestCase {
-
-    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
-
-    /**
-     * Constructor for TestLocateFunctionModifier.
-     * @param name
-     */
-    public TestLocateFunctionModifier(String name) {
-        super(name);
-    }
-
-    public IExpression helpTestMod(IExpression[] args, String expectedStr) throws Exception {
-        IFunction func = LANG_FACTORY.createFunction("hour",  //$NON-NLS-1$
-            args,
-            Integer.class);
-        
-        LocateFunctionModifier mod = new LocateFunctionModifier(LANG_FACTORY);
-        IExpression expr = mod.modify(func);
-        
-        OracleSQLTranslator trans = new OracleSQLTranslator();
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
-        
-        SQLConversionVisitor sqlVisitor = new SQLConversionVisitor(trans); 
-        sqlVisitor.append(expr);  
-        
-        assertEquals(expectedStr, sqlVisitor.toString());
-        
-        return expr;
-    }
-
-    public void testTwoArgs() throws Exception {
-        IExpression[] args = new IExpression[] {
-            LANG_FACTORY.createLiteral(".", String.class), //$NON-NLS-1$
-            LANG_FACTORY.createLiteral("a.b.c", String.class)             //$NON-NLS-1$
-        }; 
-        helpTestMod(args, "instr('a.b.c', '.')"); //$NON-NLS-1$
-    }
-
-    public void testThreeArgsWithConstant() throws Exception {
-        IExpression[] args = new IExpression[] {
-            LANG_FACTORY.createLiteral(".", String.class), //$NON-NLS-1$
-            LANG_FACTORY.createLiteral("a.b.c", String.class),             //$NON-NLS-1$
-            LANG_FACTORY.createLiteral(new Integer(2), Integer.class)            
-        }; 
-        helpTestMod(args, "instr('a.b.c', '.', 3)"); //$NON-NLS-1$
-    }
-
-    public void testThreeArgsWithElement() throws Exception {
-        IExpression[] args = new IExpression[] {
-            LANG_FACTORY.createLiteral(".", String.class), //$NON-NLS-1$
-            LANG_FACTORY.createLiteral("a.b.c", String.class),             //$NON-NLS-1$
-            LANG_FACTORY.createElement("e1", null, null, Integer.class)             //$NON-NLS-1$
-        }; 
-        helpTestMod(args, "instr('a.b.c', '.', (e1 + 1))"); //$NON-NLS-1$
-    }
-
-    public void testThreeArgsWithNull() throws Exception {
-        IExpression[] args = new IExpression[] {
-            LANG_FACTORY.createLiteral(".", String.class), //$NON-NLS-1$
-            LANG_FACTORY.createLiteral("a.b.c", String.class),             //$NON-NLS-1$
-            LANG_FACTORY.createLiteral(null, Integer.class)            
-        }; 
-        helpTestMod(args, "instr('a.b.c', '.', NULL)"); //$NON-NLS-1$
-    }
-
-}

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLocateFunctionModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestLocateFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLocateFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLocateFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,108 @@
+/*
+ * 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.oracle;
+
+import java.util.Arrays;
+import java.util.Properties;
+
+import org.teiid.connector.jdbc.oracle.LocateFunctionModifier;
+import org.teiid.connector.jdbc.oracle.OracleSQLTranslator;
+import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
+
+import junit.framework.TestCase;
+
+import com.metamatrix.cdk.CommandBuilder;
+import com.metamatrix.cdk.api.EnvironmentUtility;
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageFactory;
+
+/**
+ */
+public class TestLocateFunctionModifier extends TestCase {
+
+    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
+
+    /**
+     * Constructor for TestLocateFunctionModifier.
+     * @param name
+     */
+    public TestLocateFunctionModifier(String name) {
+        super(name);
+    }
+
+    public IExpression helpTestMod(IExpression[] args, String expectedStr) throws Exception {
+        IFunction func = LANG_FACTORY.createFunction("hour",  //$NON-NLS-1$
+            Arrays.asList(args),
+            Integer.class);
+        
+        LocateFunctionModifier mod = new LocateFunctionModifier(LANG_FACTORY);
+        IExpression expr = mod.modify(func);
+        
+        OracleSQLTranslator trans = new OracleSQLTranslator();
+        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        
+        SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
+        sqlVisitor.append(expr);  
+        
+        assertEquals(expectedStr, sqlVisitor.toString());
+        
+        return expr;
+    }
+
+    public void testTwoArgs() throws Exception {
+        IExpression[] args = new IExpression[] {
+            LANG_FACTORY.createLiteral(".", String.class), //$NON-NLS-1$
+            LANG_FACTORY.createLiteral("a.b.c", String.class)             //$NON-NLS-1$
+        }; 
+        helpTestMod(args, "instr('a.b.c', '.')"); //$NON-NLS-1$
+    }
+
+    public void testThreeArgsWithConstant() throws Exception {
+        IExpression[] args = new IExpression[] {
+            LANG_FACTORY.createLiteral(".", String.class), //$NON-NLS-1$
+            LANG_FACTORY.createLiteral("a.b.c", String.class),             //$NON-NLS-1$
+            LANG_FACTORY.createLiteral(new Integer(2), Integer.class)            
+        }; 
+        helpTestMod(args, "instr('a.b.c', '.', 3)"); //$NON-NLS-1$
+    }
+
+    public void testThreeArgsWithElement() throws Exception {
+        IExpression[] args = new IExpression[] {
+            LANG_FACTORY.createLiteral(".", String.class), //$NON-NLS-1$
+            LANG_FACTORY.createLiteral("a.b.c", String.class),             //$NON-NLS-1$
+            LANG_FACTORY.createElement("e1", null, null, Integer.class)             //$NON-NLS-1$
+        }; 
+        helpTestMod(args, "instr('a.b.c', '.', (e1 + 1))"); //$NON-NLS-1$
+    }
+
+    public void testThreeArgsWithNull() throws Exception {
+        IExpression[] args = new IExpression[] {
+            LANG_FACTORY.createLiteral(".", String.class), //$NON-NLS-1$
+            LANG_FACTORY.createLiteral("a.b.c", String.class),             //$NON-NLS-1$
+            LANG_FACTORY.createLiteral(null, Integer.class)            
+        }; 
+        helpTestMod(args, "instr('a.b.c', '.', NULL)"); //$NON-NLS-1$
+    }
+
+}

Deleted: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLog10FunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestLog10FunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLog10FunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,69 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.connector.jdbc.oracle;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.ILiteral;
-import com.metamatrix.connector.visitor.util.SQLStringVisitor;
-
-/**
- */
-public class TestLog10FunctionModifier extends TestCase {
-
-    /**
-     * Constructor for TestLog10FunctionModifier.
-     * @param name
-     */
-    public TestLog10FunctionModifier(String name) {
-        super(name);
-    }
-
-    public void testModifier() {
-        ILiteral arg = CommandBuilder.getLanuageFactory().createLiteral(new Double(5.2), Double.class);
-        IFunction func = CommandBuilder.getLanuageFactory().createFunction("log10", new IExpression[] {arg}, Double.class); //$NON-NLS-1$
-        
-        Log10FunctionModifier modifier = new Log10FunctionModifier(CommandBuilder.getLanuageFactory());
-        IExpression outExpr = modifier.modify(func);
-        
-        assertTrue(outExpr instanceof IFunction);
-        IFunction outFunc = (IFunction) outExpr;
-        
-        assertEquals("log", outFunc.getName()); //$NON-NLS-1$
-        assertEquals(func.getType(), outFunc.getType());
-        
-        IExpression[] outArgs = func.getParameters();
-        assertEquals(2, outArgs.length);
-        assertEquals(arg, outArgs[1]);
-        
-        assertTrue(outArgs[1] instanceof ILiteral);
-        ILiteral newArg = (ILiteral) outArgs[0];
-        assertEquals(Integer.class, newArg.getType());
-        assertEquals(new Integer(10), newArg.getValue());
-        
-        assertEquals("log(10, 5.2)", SQLStringVisitor.getSQLString(outFunc));              //$NON-NLS-1$
-    }
-}

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLog10FunctionModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestLog10FunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLog10FunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestLog10FunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,74 @@
+/*
+ * 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.oracle;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.teiid.connector.jdbc.oracle.Log10FunctionModifier;
+
+import junit.framework.TestCase;
+
+import com.metamatrix.cdk.CommandBuilder;
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILiteral;
+import com.metamatrix.connector.visitor.util.SQLStringVisitor;
+
+/**
+ */
+public class TestLog10FunctionModifier extends TestCase {
+
+    /**
+     * Constructor for TestLog10FunctionModifier.
+     * @param name
+     */
+    public TestLog10FunctionModifier(String name) {
+        super(name);
+    }
+
+    public void testModifier() {
+        ILiteral arg = CommandBuilder.getLanuageFactory().createLiteral(new Double(5.2), Double.class);
+        IFunction func = CommandBuilder.getLanuageFactory().createFunction("log10", Arrays.asList(arg), Double.class); //$NON-NLS-1$
+        
+        Log10FunctionModifier modifier = new Log10FunctionModifier(CommandBuilder.getLanuageFactory());
+        IExpression outExpr = modifier.modify(func);
+        
+        assertTrue(outExpr instanceof IFunction);
+        IFunction outFunc = (IFunction) outExpr;
+        
+        assertEquals("log", outFunc.getName()); //$NON-NLS-1$
+        assertEquals(func.getType(), outFunc.getType());
+        
+        List<IExpression> outArgs = func.getParameters();
+        assertEquals(2, outArgs.size());
+        assertEquals(arg, outArgs.get(1));
+        
+        assertTrue(outArgs.get(1) instanceof ILiteral);
+        ILiteral newArg = (ILiteral) outArgs.get(0);
+        assertEquals(Integer.class, newArg.getType());
+        assertEquals(new Integer(10), newArg.getValue());
+        
+        assertEquals("log(10, 5.2)", SQLStringVisitor.getSQLString(outFunc));              //$NON-NLS-1$
+    }
+}

Deleted: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestMonthOrDayNameFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestMonthOrDayNameFunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestMonthOrDayNameFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,93 +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.jdbc.oracle;
-
-import java.sql.Timestamp;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
-import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.ILanguageFactory;
-import com.metamatrix.connector.language.ILiteral;
-import com.metamatrix.query.unittest.TimestampUtil;
-
-/**
- */
-public class TestMonthOrDayNameFunctionModifier extends TestCase {
-
-    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
-
-    /**
-     * Constructor for TestHourFunctionModifier.
-     * @param name
-     */
-    public TestMonthOrDayNameFunctionModifier(String name) {
-        super(name);
-    }
-
-    public IExpression helpTestMod(ILiteral c, String format, String expectedStr) throws Exception {
-        IFunction func = LANG_FACTORY.createFunction(format.toLowerCase()+"name",  // "monthname" //$NON-NLS-1$ 
-            new IExpression[] { c },
-            String.class);
-        
-        MonthOrDayNameFunctionModifier mod = new MonthOrDayNameFunctionModifier (LANG_FACTORY, format);
-        IExpression expr = mod.modify(func);
-        
-        OracleSQLTranslator trans = new OracleSQLTranslator();
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
-        
-        SQLConversionVisitor sqlVisitor = new SQLConversionVisitor(trans); 
-        sqlVisitor.append(expr);  
-        assertEquals(expectedStr, sqlVisitor.toString());
-        return expr;
-    }
-
-    public void test1() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 0), Timestamp.class);
-        helpTestMod(arg1, "Month", //$NON-NLS-1$
-            "RTRIM(TO_CHAR({ts'2004-01-21 10:05:00.0'}, 'Month'))"); //$NON-NLS-1$
-    }
-
-    public void test2() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createDate(104, 0, 21), java.sql.Date.class);
-        helpTestMod(arg1, "Month", //$NON-NLS-1$
-            "RTRIM(TO_CHAR({d'2004-01-21'}, 'Month'))"); //$NON-NLS-1$
-    }
-    
-    public void test3() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 0), Timestamp.class);
-        helpTestMod(arg1, "Day",  //$NON-NLS-1$
-            "RTRIM(TO_CHAR({ts'2004-01-21 10:05:00.0'}, 'Day'))"); //$NON-NLS-1$
-    }
-
-    public void test4() throws Exception {
-        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createDate(104, 0, 21), java.sql.Date.class);
-        helpTestMod(arg1, "Day", //$NON-NLS-1$
-            "RTRIM(TO_CHAR({d'2004-01-21'}, 'Day'))"); //$NON-NLS-1$
-    }
-}
\ No newline at end of file

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestMonthOrDayNameFunctionModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestMonthOrDayNameFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestMonthOrDayNameFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestMonthOrDayNameFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,97 @@
+/*
+ * 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.oracle;
+
+import java.sql.Timestamp;
+import java.util.Arrays;
+import java.util.Properties;
+
+import org.teiid.connector.jdbc.oracle.MonthOrDayNameFunctionModifier;
+import org.teiid.connector.jdbc.oracle.OracleSQLTranslator;
+import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
+
+import junit.framework.TestCase;
+
+import com.metamatrix.cdk.CommandBuilder;
+import com.metamatrix.cdk.api.EnvironmentUtility;
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageFactory;
+import com.metamatrix.connector.language.ILiteral;
+import com.metamatrix.query.unittest.TimestampUtil;
+
+/**
+ */
+public class TestMonthOrDayNameFunctionModifier extends TestCase {
+
+    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
+
+    /**
+     * Constructor for TestHourFunctionModifier.
+     * @param name
+     */
+    public TestMonthOrDayNameFunctionModifier(String name) {
+        super(name);
+    }
+
+    public IExpression helpTestMod(ILiteral c, String format, String expectedStr) throws Exception {
+        IFunction func = LANG_FACTORY.createFunction(format.toLowerCase()+"name",  // "monthname" //$NON-NLS-1$ 
+            Arrays.asList( c ),
+            String.class);
+        
+        MonthOrDayNameFunctionModifier mod = new MonthOrDayNameFunctionModifier (LANG_FACTORY, format);
+        IExpression expr = mod.modify(func);
+        
+        OracleSQLTranslator trans = new OracleSQLTranslator();
+        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        
+        SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
+        sqlVisitor.append(expr);  
+        assertEquals(expectedStr, sqlVisitor.toString());
+        return expr;
+    }
+
+    public void test1() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 0), Timestamp.class);
+        helpTestMod(arg1, "Month", //$NON-NLS-1$
+            "RTRIM(TO_CHAR({ts'2004-01-21 10:05:00.0'}, 'Month'))"); //$NON-NLS-1$
+    }
+
+    public void test2() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createDate(104, 0, 21), java.sql.Date.class);
+        helpTestMod(arg1, "Month", //$NON-NLS-1$
+            "RTRIM(TO_CHAR({d'2004-01-21'}, 'Month'))"); //$NON-NLS-1$
+    }
+    
+    public void test3() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 0), Timestamp.class);
+        helpTestMod(arg1, "Day",  //$NON-NLS-1$
+            "RTRIM(TO_CHAR({ts'2004-01-21 10:05:00.0'}, 'Day'))"); //$NON-NLS-1$
+    }
+
+    public void test4() throws Exception {
+        ILiteral arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createDate(104, 0, 21), java.sql.Date.class);
+        helpTestMod(arg1, "Day", //$NON-NLS-1$
+            "RTRIM(TO_CHAR({d'2004-01-21'}, 'Day'))"); //$NON-NLS-1$
+    }
+}
\ No newline at end of file

Deleted: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestOracleConvertModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleConvertModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,518 +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.jdbc.oracle;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.sql.Timestamp;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
-import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.ILanguageFactory;
-import com.metamatrix.query.unittest.TimestampUtil;
-
-/**
- */
-public class TestOracleConvertModifier extends TestCase {
-
-    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
-
-    /**
-     * Constructor for TestSybaseConvertModifier.
-     * @param name
-     */
-    public TestOracleConvertModifier(String name) {
-        super(name);
-    }
-
-    public String helpGetString(IExpression expr) throws Exception {
-        OracleSQLTranslator trans = new OracleSQLTranslator();
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
-        
-        SQLConversionVisitor sqlVisitor = new SQLConversionVisitor(trans); 
-        sqlVisitor.append(expr);  
-        
-        return sqlVisitor.toString();        
-    }
-
-    public void helpTest(IExpression srcExpression, String tgtType, String expectedExpression) throws Exception {
-        IFunction func = LANG_FACTORY.createFunction("convert",  //$NON-NLS-1$
-            new IExpression[] { 
-                srcExpression,
-                LANG_FACTORY.createLiteral(tgtType, String.class)},
-            TypeFacility.getDataTypeClass(tgtType));
-        
-        OracleConvertModifier mod = new OracleConvertModifier(LANG_FACTORY, null);
-        IExpression expr = mod.modify(func);
-        
-        assertEquals("Error converting from " + srcExpression.getType() + " to " + tgtType, //$NON-NLS-1$ //$NON-NLS-2$ 
-            expectedExpression, helpGetString(expr)); 
-    }
-
-    // Source = STRING
-
-    public void testStringToChar() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "char", "'5'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "boolean", "decode('5', 'true', 1, 'false', 0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "byte", "to_number('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "short", "to_number('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "integer", "to_number('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "long", "to_number('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "biginteger", "to_number('5')");  //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "float", "to_number('5')");//$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "double", "to_number('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToDate() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("2004-06-29", String.class), "date", "to_date('2004-06-29', 'YYYY-MM-DD')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToTime() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("23:59:59", String.class), "time", "to_date(('1970-01-01 ' || to_char('23:59:59', 'HH24:MI:SS')), 'YYYY-MM-DD HH24:MI:SS')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToTimestamp() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("2004-06-29 23:59:59.987", String.class), "timestamp", "to_timestamp('2004-06-29 23:59:59.987', 'YYYY-MM-DD HH24:MI:SS.FF')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testStringToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral("5", String.class), "bigdecimal", "to_number('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    // Source = CHAR
-    
-    public void testCharToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Character('5'), Character.class), "string", "'5'"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = BOOLEAN
-    
-    public void testBooleanToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "string", "decode(1, 0, 'false', 1, 'true')"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "byte", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "short", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testBooleanToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-    
-    // Source = BYTE
-    
-    public void testByteToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "string", "to_char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "boolean", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "short", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testByteToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = SHORT
-    
-    public void testShortToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "string", "to_char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "boolean", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "byte", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testShortToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = INTEGER
-    
-    public void testIntegerToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "string", "to_char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "boolean", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "byte", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "short", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testIntegerToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = LONG
-    
-    public void testLongToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "string", "to_char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "boolean", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "byte", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "short", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testLongToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = BIGINTEGER
-    
-    public void testBigIntegerToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "string", "to_char(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "boolean", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "byte", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "short", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigIntegerToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    // Source = FLOAT
-    
-    public void testFloatToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "string", "to_char(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "boolean", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "byte", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "short", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "integer", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "long", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "biginteger", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToDouble() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "double", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testFloatToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "bigdecimal", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = DOUBLE
-    
-    public void testDoubleToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "string", "to_char(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "boolean", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "byte", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "short", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "integer", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "long", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "biginteger", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "float", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDoubleToBigDecimal() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "bigdecimal", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = BIGDECIMAL
-    
-    public void testBigDecimalToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "string", "to_char(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToBoolean() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "boolean", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToByte() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "byte", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToShort() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "short", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "integer", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToLong() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "long", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToBigInteger() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "biginteger", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToFloat() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "float", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    public void testBigDecimalToDoublel() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "double", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-    }
-
-    // Source = DATE
-
-    public void testDateToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createDate(103, 10, 1), java.sql.Date.class), "string", "to_char({d'2003-11-01'}, 'YYYY-MM-DD')"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testDateToTimestamp() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createDate(103, 10, 1), java.sql.Date.class), "timestamp", "cast({d'2003-11-01'} AS timestamp)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = TIME
-
-    public void testTimeToString() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createTime(23, 59, 59), java.sql.Time.class), "string", "to_char({ts'1970-01-01 23:59:59'}, 'HH24:MI:SS')"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testTimeToTimestamp() throws Exception {
-        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createTime(23, 59, 59), java.sql.Time.class), "timestamp", "cast({ts'1970-01-01 23:59:59'} AS timestamp)"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    // Source = TIMESTAMP
-    
-    public void testTimestampToString() throws Exception {
-        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);        
-        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "string", "to_char({ts'2003-11-01 12:05:02.0'}, 'YYYY-MM-DD HH24:MI:SS.FF')"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testTimestampToDate() throws Exception {
-        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);        
-        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "date", "trunc({ts'2003-11-01 12:05:02.0'})"); //$NON-NLS-1$ //$NON-NLS-2$
-    }
-
-    public void testTimestampToTime() throws Exception {
-        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);        
-        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "time", "to_date(('1970-01-01 ' || to_char({ts'2003-11-01 12:05:02.0'}, 'HH24:MI:SS')), 'YYYY-MM-DD HH24:MI:SS')"); //$NON-NLS-1$ //$NON-NLS-2$
-    }    
-
-}

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleConvertModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestOracleConvertModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleConvertModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleConvertModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,522 @@
+/*
+ * 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.oracle;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.sql.Timestamp;
+import java.util.Arrays;
+import java.util.Properties;
+
+import org.teiid.connector.jdbc.oracle.OracleConvertModifier;
+import org.teiid.connector.jdbc.oracle.OracleSQLTranslator;
+import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
+
+import junit.framework.TestCase;
+
+import com.metamatrix.cdk.CommandBuilder;
+import com.metamatrix.cdk.api.EnvironmentUtility;
+import com.metamatrix.connector.api.TypeFacility;
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageFactory;
+import com.metamatrix.query.unittest.TimestampUtil;
+
+/**
+ */
+public class TestOracleConvertModifier extends TestCase {
+
+    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
+
+    /**
+     * Constructor for TestSybaseConvertModifier.
+     * @param name
+     */
+    public TestOracleConvertModifier(String name) {
+        super(name);
+    }
+
+    public String helpGetString(IExpression expr) throws Exception {
+        OracleSQLTranslator trans = new OracleSQLTranslator();
+        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+        
+        SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
+        sqlVisitor.append(expr);  
+        
+        return sqlVisitor.toString();        
+    }
+
+    public void helpTest(IExpression srcExpression, String tgtType, String expectedExpression) throws Exception {
+        IFunction func = LANG_FACTORY.createFunction("convert",  //$NON-NLS-1$
+            Arrays.asList( 
+                srcExpression,
+                LANG_FACTORY.createLiteral(tgtType, String.class)),
+            TypeFacility.getDataTypeClass(tgtType));
+        
+        OracleConvertModifier mod = new OracleConvertModifier(LANG_FACTORY, null);
+        IExpression expr = mod.modify(func);
+        
+        assertEquals("Error converting from " + srcExpression.getType() + " to " + tgtType, //$NON-NLS-1$ //$NON-NLS-2$ 
+            expectedExpression, helpGetString(expr)); 
+    }
+
+    // Source = STRING
+
+    public void testStringToChar() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "char", "'5'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "boolean", "decode('5', 'true', 1, 'false', 0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "byte", "to_number('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "short", "to_number('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "integer", "to_number('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "long", "to_number('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "biginteger", "to_number('5')");  //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "float", "to_number('5')");//$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "double", "to_number('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToDate() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("2004-06-29", String.class), "date", "to_date('2004-06-29', 'YYYY-MM-DD')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToTime() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("23:59:59", String.class), "time", "to_date(('1970-01-01 ' || to_char('23:59:59', 'HH24:MI:SS')), 'YYYY-MM-DD HH24:MI:SS')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToTimestamp() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("2004-06-29 23:59:59.987", String.class), "timestamp", "to_timestamp('2004-06-29 23:59:59.987', 'YYYY-MM-DD HH24:MI:SS.FF')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testStringToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral("5", String.class), "bigdecimal", "to_number('5')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    // Source = CHAR
+    
+    public void testCharToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Character('5'), Character.class), "string", "'5'"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = BOOLEAN
+    
+    public void testBooleanToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "string", "decode(1, 0, 'false', 1, 'true')"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "byte", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "short", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testBooleanToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+    
+    // Source = BYTE
+    
+    public void testByteToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "string", "to_char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "boolean", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "short", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testByteToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Byte((byte)1), Byte.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = SHORT
+    
+    public void testShortToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "string", "to_char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "boolean", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "byte", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testShortToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Short((short)1), Short.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = INTEGER
+    
+    public void testIntegerToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "string", "to_char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "boolean", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "byte", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "short", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testIntegerToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Integer(1), Integer.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = LONG
+    
+    public void testLongToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "string", "to_char(1)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "boolean", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "byte", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "short", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "biginteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testLongToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Long(1), Long.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = BIGINTEGER
+    
+    public void testBigIntegerToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "string", "to_char(1)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "boolean", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "byte", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "short", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "integer", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "long", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "float", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigIntegerToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"), BigInteger.class), "bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    // Source = FLOAT
+    
+    public void testFloatToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "string", "to_char(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "boolean", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "byte", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "short", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "integer", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "long", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "biginteger", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToDouble() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "double", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testFloatToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Float(1.2f), Float.class), "bigdecimal", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = DOUBLE
+    
+    public void testDoubleToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "string", "to_char(1.2)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "boolean", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "byte", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "short", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "integer", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "long", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "biginteger", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "float", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDoubleToBigDecimal() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new Double(1.2), Double.class), "bigdecimal", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = BIGDECIMAL
+    
+    public void testBigDecimalToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "string", "to_char(1.0)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToBoolean() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "boolean", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToByte() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "byte", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToShort() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "short", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "integer", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToLong() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "long", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToBigInteger() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "biginteger", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToFloat() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "float", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    public void testBigDecimalToDoublel() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(new BigDecimal("1.0"), BigDecimal.class), "double", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+    }
+
+    // Source = DATE
+
+    public void testDateToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createDate(103, 10, 1), java.sql.Date.class), "string", "to_char({d'2003-11-01'}, 'YYYY-MM-DD')"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testDateToTimestamp() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createDate(103, 10, 1), java.sql.Date.class), "timestamp", "cast({d'2003-11-01'} AS timestamp)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = TIME
+
+    public void testTimeToString() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createTime(23, 59, 59), java.sql.Time.class), "string", "to_char({ts'1970-01-01 23:59:59'}, 'HH24:MI:SS')"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testTimeToTimestamp() throws Exception {
+        helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createTime(23, 59, 59), java.sql.Time.class), "timestamp", "cast({ts'1970-01-01 23:59:59'} AS timestamp)"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    // Source = TIMESTAMP
+    
+    public void testTimestampToString() throws Exception {
+        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);        
+        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "string", "to_char({ts'2003-11-01 12:05:02.0'}, 'YYYY-MM-DD HH24:MI:SS.FF')"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testTimestampToDate() throws Exception {
+        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);        
+        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "date", "trunc({ts'2003-11-01 12:05:02.0'})"); //$NON-NLS-1$ //$NON-NLS-2$
+    }
+
+    public void testTimestampToTime() throws Exception {
+        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);        
+        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "time", "to_date(('1970-01-01 ' || to_char({ts'2003-11-01 12:05:02.0'}, 'HH24:MI:SS')), 'YYYY-MM-DD HH24:MI:SS')"); //$NON-NLS-1$ //$NON-NLS-2$
+    }    
+
+}

Modified: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestOracleTranslator.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestOracleTranslator.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -20,18 +20,20 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.jdbc.oracle;
+package org.teiid.connector.jdbc.oracle;
 
 import java.util.Properties;
 
+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 junit.framework.TestCase;
 
 import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.cdk.unittest.FakeTranslationFactory;
 import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.jdbc.access.AccessSQLTranslator;
-import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
-import com.metamatrix.connector.jdbc.translator.Translator;
 import com.metamatrix.connector.language.ICommand;
 
 public class TestOracleTranslator extends TestCase {

Deleted: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestSubstringFunctionModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestSubstringFunctionModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestSubstringFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -1,105 +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.jdbc.oracle;
-
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import com.metamatrix.cdk.CommandBuilder;
-import com.metamatrix.cdk.api.EnvironmentUtility;
-import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.translator.FunctionModifier;
-import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
-import com.metamatrix.connector.language.IExpression;
-import com.metamatrix.connector.language.IFunction;
-import com.metamatrix.connector.language.ILanguageFactory;
-
-/**
- */
-public class TestSubstringFunctionModifier extends TestCase {
-
-    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
-
-
-    /**
-     * Constructor for TestSubstringFunctionModifier.
-     * @param name
-     */
-    public TestSubstringFunctionModifier(String name) {
-        super(name);
-    }
-
-    public IExpression helpTestMod(IExpression[] args, String expectedStr) throws Exception {
-        IFunction func = LANG_FACTORY.createFunction("substring",  //$NON-NLS-1$
-            args, TypeFacility.RUNTIME_TYPES.STRING);
-        
-        OracleSQLTranslator trans = new OracleSQLTranslator();
-        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
-
-        IExpression expr = ((FunctionModifier)trans.getFunctionModifiers().get("substring")).modify(func); //$NON-NLS-1$
-        
-        SQLConversionVisitor sqlVisitor = new SQLConversionVisitor(trans); 
-        sqlVisitor.append(expr);  
-        
-        assertEquals(expectedStr, sqlVisitor.toString());
-        
-        return expr;
-    }
-
-    public void testTwoArgs() throws Exception {
-        IExpression[] args = new IExpression[] {
-            LANG_FACTORY.createLiteral("a.b.c", String.class), //$NON-NLS-1$
-            LANG_FACTORY.createLiteral(new Integer(1), Integer.class)           
-        }; 
-        helpTestMod(args, "substr('a.b.c', 1)"); //$NON-NLS-1$
-    }
-
-    public void testThreeArgsWithConstant() throws Exception {
-        IExpression[] args = new IExpression[] {
-            LANG_FACTORY.createLiteral("a.b.c", String.class), //$NON-NLS-1$
-            LANG_FACTORY.createLiteral(new Integer(3), Integer.class),
-            LANG_FACTORY.createLiteral(new Integer(1), Integer.class) 
-        }; 
-        helpTestMod(args, "substr('a.b.c', 3, 1)"); //$NON-NLS-1$
-    }
-
-    public void testThreeArgsWithElement() throws Exception {
-        IExpression[] args = new IExpression[] {
-            LANG_FACTORY.createLiteral("a.b.c", String.class), //$NON-NLS-1$
-            LANG_FACTORY.createElement("e1", null, null, Integer.class), //$NON-NLS-1$
-            LANG_FACTORY.createLiteral(new Integer(1), Integer.class) 
-        }; 
-        helpTestMod(args, "substr('a.b.c', e1, 1)"); //$NON-NLS-1$
-    }
-
-    public void testThreeArgsWithNull() throws Exception {
-        IExpression[] args = new IExpression[] {
-            LANG_FACTORY.createLiteral("a.b.c", String.class), //$NON-NLS-1$
-            LANG_FACTORY.createLiteral(null, Integer.class),
-            LANG_FACTORY.createLiteral(new Integer(5), Integer.class) 
-        }; 
-        helpTestMod(args, "substr('a.b.c', NULL, 5)"); //$NON-NLS-1$
-    }
-
-}

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestSubstringFunctionModifier.java (from rev 488, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/oracle/TestSubstringFunctionModifier.java)
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestSubstringFunctionModifier.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/oracle/TestSubstringFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -0,0 +1,108 @@
+/*
+ * 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.oracle;
+
+import java.util.Arrays;
+import java.util.Properties;
+
+import org.teiid.connector.jdbc.oracle.OracleSQLTranslator;
+import org.teiid.connector.jdbc.translator.FunctionModifier;
+import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
+
+import junit.framework.TestCase;
+
+import com.metamatrix.cdk.CommandBuilder;
+import com.metamatrix.cdk.api.EnvironmentUtility;
+import com.metamatrix.connector.api.TypeFacility;
+import com.metamatrix.connector.language.IExpression;
+import com.metamatrix.connector.language.IFunction;
+import com.metamatrix.connector.language.ILanguageFactory;
+
+/**
+ */
+public class TestSubstringFunctionModifier extends TestCase {
+
+    private static final ILanguageFactory LANG_FACTORY = CommandBuilder.getLanuageFactory();
+
+
+    /**
+     * Constructor for TestSubstringFunctionModifier.
+     * @param name
+     */
+    public TestSubstringFunctionModifier(String name) {
+        super(name);
+    }
+
+    public IExpression helpTestMod(IExpression[] args, String expectedStr) throws Exception {
+        IFunction func = LANG_FACTORY.createFunction("substring",  //$NON-NLS-1$
+            Arrays.asList(args), TypeFacility.RUNTIME_TYPES.STRING);
+        
+        OracleSQLTranslator trans = new OracleSQLTranslator();
+        trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
+
+        IExpression expr = ((FunctionModifier)trans.getFunctionModifiers().get("substring")).modify(func); //$NON-NLS-1$
+        
+        SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
+        sqlVisitor.append(expr);  
+        
+        assertEquals(expectedStr, sqlVisitor.toString());
+        
+        return expr;
+    }
+
+    public void testTwoArgs() throws Exception {
+        IExpression[] args = new IExpression[] {
+            LANG_FACTORY.createLiteral("a.b.c", String.class), //$NON-NLS-1$
+            LANG_FACTORY.createLiteral(new Integer(1), Integer.class)           
+        }; 
+        helpTestMod(args, "substr('a.b.c', 1)"); //$NON-NLS-1$
+    }
+
+    public void testThreeArgsWithConstant() throws Exception {
+        IExpression[] args = new IExpression[] {
+            LANG_FACTORY.createLiteral("a.b.c", String.class), //$NON-NLS-1$
+            LANG_FACTORY.createLiteral(new Integer(3), Integer.class),
+            LANG_FACTORY.createLiteral(new Integer(1), Integer.class) 
+        }; 
+        helpTestMod(args, "substr('a.b.c', 3, 1)"); //$NON-NLS-1$
+    }
+
+    public void testThreeArgsWithElement() throws Exception {
+        IExpression[] args = new IExpression[] {
+            LANG_FACTORY.createLiteral("a.b.c", String.class), //$NON-NLS-1$
+            LANG_FACTORY.createElement("e1", null, null, Integer.class), //$NON-NLS-1$
+            LANG_FACTORY.createLiteral(new Integer(1), Integer.class) 
+        }; 
+        helpTestMod(args, "substr('a.b.c', e1, 1)"); //$NON-NLS-1$
+    }
+
+    public void testThreeArgsWithNull() throws Exception {
+        IExpression[] args = new IExpression[] {
+            LANG_FACTORY.createLiteral("a.b.c", String.class), //$NON-NLS-1$
+            LANG_FACTORY.createLiteral(null, Integer.class),
+            LANG_FACTORY.createLiteral(new Integer(5), Integer.class) 
+        }; 
+        helpTestMod(args, "substr('a.b.c', NULL, 5)"); //$NON-NLS-1$
+    }
+
+}

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/postgresql (from rev 486, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/postgresql)


Property changes on: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/postgresql
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/postgresql/TestPostgreSQLTranslator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/postgresql/TestPostgreSQLTranslator.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/postgresql/TestPostgreSQLTranslator.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -20,17 +20,19 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.jdbc.postgresql;
+package org.teiid.connector.jdbc.postgresql;
 
 import java.util.Map;
 import java.util.Properties;
 
+import org.teiid.connector.jdbc.MetadataFactory;
+import org.teiid.connector.jdbc.postgresql.PostgreSQLTranslator;
+import org.teiid.connector.jdbc.translator.TranslatedCommand;
+
 import junit.framework.TestCase;
 
 import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.jdbc.MetadataFactory;
-import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
 import com.metamatrix.connector.language.ICommand;
 
 /**

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sqlserver (from rev 486, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/sqlserver)


Property changes on: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sqlserver
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sqlserver/TestSqlServerConversionVisitor.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/sqlserver/TestSqlServerConversionVisitor.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sqlserver/TestSqlServerConversionVisitor.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -20,19 +20,21 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.jdbc.sqlserver;
+package org.teiid.connector.jdbc.sqlserver;
 
 import java.util.Map;
 import java.util.Properties;
 
+import org.teiid.connector.jdbc.MetadataFactory;
+import org.teiid.connector.jdbc.sqlserver.SqlServerSQLTranslator;
+import org.teiid.connector.jdbc.translator.FunctionReplacementVisitor;
+import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
+import org.teiid.connector.jdbc.translator.TranslatedCommand;
+
 import junit.framework.TestCase;
 
 import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.jdbc.MetadataFactory;
-import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
-import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
-import com.metamatrix.connector.jdbc.util.FunctionReplacementVisitor;
 import com.metamatrix.connector.language.ICommand;
 
 /**
@@ -84,7 +86,7 @@
         SqlServerSQLTranslator trans = new SqlServerSQLTranslator();
         trans.initialize(EnvironmentUtility.createEnvironment(props, false));
         // Convert back to SQL
-        SQLConversionVisitor sqlVisitor = new SQLConversionVisitor(trans);
+        SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor();
         
         TranslatedCommand tc = new TranslatedCommand(EnvironmentUtility.createSecurityContext("user"), trans, sqlVisitor, funcVisitor); //$NON-NLS-1$
         tc.translateCommand(obj);

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sybase (from rev 486, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/sybase)


Property changes on: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sybase
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sybase/TestSybaseConvertModifier.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/sybase/TestSybaseConvertModifier.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sybase/TestSybaseConvertModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -20,19 +20,22 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.jdbc.sybase;
+package org.teiid.connector.jdbc.sybase;
 
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.sql.Timestamp;
 import java.util.Properties;
 
+import org.teiid.connector.jdbc.sybase.SybaseConvertModifier;
+import org.teiid.connector.jdbc.sybase.SybaseSQLTranslator;
+import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
+
 import junit.framework.TestCase;
 
 import com.metamatrix.cdk.CommandBuilder;
 import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.common.types.DataTypeManager;
-import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;
 import com.metamatrix.connector.language.ILanguageFactory;
@@ -57,7 +60,7 @@
         SybaseSQLTranslator trans = new SybaseSQLTranslator();
         trans.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
         
-        SQLConversionVisitor sqlVisitor = new SQLConversionVisitor(trans); 
+        SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor(); 
         sqlVisitor.append(expr);  
         
         return sqlVisitor.toString();        

Modified: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sybase/TestSybaseSQLConversionVisitor.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/sybase/TestSybaseSQLConversionVisitor.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/sybase/TestSybaseSQLConversionVisitor.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -20,18 +20,20 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.jdbc.sybase;
+package org.teiid.connector.jdbc.sybase;
 
 import java.util.Properties;
 
+import org.teiid.connector.jdbc.MetadataFactory;
+import org.teiid.connector.jdbc.sybase.SybaseSQLTranslator;
+import org.teiid.connector.jdbc.translator.FunctionReplacementVisitor;
+import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
+import org.teiid.connector.jdbc.translator.TranslatedCommand;
+
 import junit.framework.TestCase;
 
 import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.jdbc.MetadataFactory;
-import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
-import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
-import com.metamatrix.connector.jdbc.util.FunctionReplacementVisitor;
 import com.metamatrix.connector.language.ICommand;
 
 /**
@@ -68,7 +70,7 @@
         FunctionReplacementVisitor funcVisitor = new FunctionReplacementVisitor(trans.getFunctionModifiers());
 
         // Convert back to SQL
-        SQLConversionVisitor sqlVisitor = new SQLConversionVisitor(trans);      
+        SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor();     
         TranslatedCommand tc = new TranslatedCommand(EnvironmentUtility.createSecurityContext("user"), trans, sqlVisitor, funcVisitor);
 		try {
 			tc.translateCommand(obj);

Copied: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/util (from rev 486, trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/util)


Property changes on: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/util
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/util/TestFunctionReplacementVisitor.java
===================================================================
--- trunk/connectors/connector-jdbc/src/test/java/com/metamatrix/connector/jdbc/util/TestFunctionReplacementVisitor.java	2009-02-24 14:21:49 UTC (rev 486)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/util/TestFunctionReplacementVisitor.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -20,15 +20,17 @@
  * 02110-1301 USA.
  */
 
-package com.metamatrix.connector.jdbc.util;
+package org.teiid.connector.jdbc.util;
 
 import java.util.HashMap;
 import java.util.Map;
 
+import org.teiid.connector.jdbc.MetadataFactory;
+import org.teiid.connector.jdbc.translator.DropFunctionModifier;
+import org.teiid.connector.jdbc.translator.FunctionReplacementVisitor;
+
 import junit.framework.TestCase;
 
-import com.metamatrix.connector.jdbc.MetadataFactory;
-import com.metamatrix.connector.jdbc.translator.DropFunctionModifier;
 import com.metamatrix.connector.language.ICommand;
 
 /**

Modified: trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialCapabilities.java
===================================================================
--- trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialCapabilities.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialCapabilities.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -22,9 +22,10 @@
 
 package com.metamatrix.connector.jdbc.oracle.spatial;
 
-import com.metamatrix.connector.jdbc.oracle.*;
 import java.util.*;
 
+import org.teiid.connector.jdbc.oracle.*;
+
 public class OracleSpatialCapabilities extends OracleCapabilities {
 
     public List getSupportedFunctions() {

Modified: trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialConnector.java
===================================================================
--- trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialConnector.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialConnector.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -28,10 +28,11 @@
  */
 package com.metamatrix.connector.jdbc.oracle.spatial;
 
+import org.teiid.connector.jdbc.JDBCConnector;
+
 import com.metamatrix.connector.api.ConnectorCapabilities;
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
-import com.metamatrix.connector.jdbc.JDBCConnector;
 
 public class OracleSpatialConnector extends JDBCConnector {
     

Modified: trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialFunctionModifier.java
===================================================================
--- trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialFunctionModifier.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialFunctionModifier.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -24,7 +24,8 @@
 
 import java.util.List;
 
-import com.metamatrix.connector.jdbc.translator.BasicFunctionModifier;
+import org.teiid.connector.jdbc.translator.BasicFunctionModifier;
+
 import com.metamatrix.connector.language.IExpression;
 import com.metamatrix.connector.language.IFunction;
 import com.metamatrix.connector.language.ILiteral;

Modified: trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialSQLTranslator.java
===================================================================
--- trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialSQLTranslator.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/connectors/sandbox/connector-oracle-spatial/src/main/java/com/metamatrix/connector/jdbc/oracle/spatial/OracleSpatialSQLTranslator.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -26,11 +26,12 @@
 import java.util.Iterator;
 import java.util.List;
 
+import org.teiid.connector.jdbc.translator.Translator;
+
 import com.metamatrix.connector.api.ConnectorEnvironment;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.ExecutionContext;
 import com.metamatrix.connector.api.TypeFacility;
-import com.metamatrix.connector.jdbc.translator.Translator;
 import com.metamatrix.connector.language.ICommand;
 import com.metamatrix.connector.language.ICriteria;
 import com.metamatrix.connector.language.IFunction;

Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/Request.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/Request.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/Request.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -416,7 +416,7 @@
         }
         
         if (tc != null){ 
-            Assertion.assertTrue(tc.getTransactionType() != TransactionContext.TRANSACTION_REQUEST);
+            Assertion.assertTrue(tc.getTransactionType() != TransactionContext.Scope.TRANSACTION_REQUEST, "Transaction already associated with request."); //$NON-NLS-1$
         }
         
         if (tc == null || !tc.isInTransaction()) {

Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/RequestWorkItem.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/RequestWorkItem.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/process/RequestWorkItem.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -285,7 +285,7 @@
 					this.transactionState = TransactionState.END;
 				}
 			}
-			if (this.transactionState == TransactionState.END && transactionContext.getTransactionType() == TransactionContext.TRANSACTION_REQUEST) {
+			if (this.transactionState == TransactionState.END && transactionContext.getTransactionType() == TransactionContext.Scope.TRANSACTION_REQUEST) {
 				this.transactionService.getTransactionServer().commit(transactionContext);
 				this.transactionState = TransactionState.DONE;
 			}
@@ -345,7 +345,7 @@
 			this.transactionState = TransactionState.END;
 		} 
 		
-		if (this.transactionState == TransactionState.END && transactionContext.getTransactionType() == TransactionContext.TRANSACTION_REQUEST) {
+		if (this.transactionState == TransactionState.END && transactionContext.getTransactionType() == TransactionContext.Scope.TRANSACTION_REQUEST) {
 			this.transactionState = TransactionState.DONE;
             try {
         		this.transactionService.getTransactionServer().rollback(transactionContext);

Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/transaction/TransactionContextImpl.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/transaction/TransactionContextImpl.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/transaction/TransactionContextImpl.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -45,7 +45,7 @@
     private MMXid xid;
     private String txnID;
     private Transaction transaction;
-    private int transactionType = TRANSACTION_NONE;
+    private Scope transactionType = Scope.TRANSACTION_NONE;
     private Set suspendedBy = Collections.newSetFromMap(new ConcurrentHashMap());
     private int transactionTimeout = -1;
     private Set xaResources = Collections.newSetFromMap(new ConcurrentHashMap());
@@ -79,11 +79,11 @@
         return this.txnID;
     }
 
-    void setTransactionType(int transactionType) {
+    void setTransactionType(Scope transactionType) {
         this.transactionType = transactionType;
     }
 
-    public int getTransactionType() {
+    public Scope getTransactionType() {
         return transactionType;
     }
 

Modified: trunk/engine/src/main/java/com/metamatrix/dqp/internal/transaction/TransactionServerImpl.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/dqp/internal/transaction/TransactionServerImpl.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/engine/src/main/java/com/metamatrix/dqp/internal/transaction/TransactionServerImpl.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -42,7 +42,6 @@
 import com.metamatrix.common.xa.MMXid;
 import com.metamatrix.common.xa.XATransactionException;
 import com.metamatrix.connector.xa.api.TransactionContext;
-import com.metamatrix.connector.xa.api.XAConnector;
 import com.metamatrix.core.util.Assertion;
 import com.metamatrix.dqp.DQPPlugin;
 import com.metamatrix.dqp.internal.transaction.TransactionProvider.XAConnectionSource;
@@ -228,7 +227,7 @@
             case XAResource.TMNOFLAGS: {
                 checkXAState(threadId, xid, false, false);
                 tc = transactions.getOrCreateTransactionContext(threadId);
-                if (tc.getTransactionType() != TransactionContext.TRANSACTION_NONE) {
+                if (tc.getTransactionType() != TransactionContext.Scope.TRANSACTION_NONE) {
                     throw new XATransactionException(XAException.XAER_PROTO, DQPPlugin.Util.getString("TransactionServer.existing_transaction")); //$NON-NLS-1$
                 }
                 Transaction tx;
@@ -255,14 +254,14 @@
                 tc.setTransaction(tx, provider.getTransactionID(tx));
                 tc.setTransactionTimeout(timeout);
                 tc.setXid(xid);
-                tc.setTransactionType(TransactionContext.TRANSACTION_GLOBAL);
+                tc.setTransactionType(TransactionContext.Scope.TRANSACTION_GLOBAL);
                 break;
             }
             case XAResource.TMJOIN:
             case XAResource.TMRESUME: {
                 tc = checkXAState(threadId, xid, true, false);
                 TransactionContextImpl threadContext = transactions.getOrCreateTransactionContext(threadId);
-                if (threadContext.getTransactionType() != TransactionContext.TRANSACTION_NONE) {
+                if (threadContext.getTransactionType() != TransactionContext.Scope.TRANSACTION_NONE) {
                     throw new XATransactionException(XAException.XAER_PROTO, DQPPlugin.Util.getString("TransactionServer.existing_transaction")); //$NON-NLS-1$
                 }
                 
@@ -323,7 +322,7 @@
             }
             if (!threadBound) {
                 tc = transactions.getOrCreateTransactionContext(threadId);
-                if (tc.getTransactionType() != TransactionContext.TRANSACTION_NONE) {
+                if (tc.getTransactionType() != TransactionContext.Scope.TRANSACTION_NONE) {
                     throw new XATransactionException(XAException.XAER_PROTO, DQPPlugin.Util.getString("TransactionServer.existing_transaction", new Object[] {xid, threadId})); //$NON-NLS-1$
                 }
             }
@@ -350,8 +349,8 @@
 
         final TransactionManager tm = getTransactionManager();
 
-        if (tc.getTransactionType() != TransactionContext.TRANSACTION_NONE) {
-            if (tc.getTransactionType() != TransactionContext.TRANSACTION_LOCAL) {
+        if (tc.getTransactionType() != TransactionContext.Scope.TRANSACTION_NONE) {
+            if (tc.getTransactionType() != TransactionContext.Scope.TRANSACTION_LOCAL) {
                 throw new NotSupportedException(DQPPlugin.Util.getString("TransactionServer.existing_transaction")); //$NON-NLS-1$
             }
             if (!transactionExpected) {
@@ -372,7 +371,7 @@
             tm.begin();
             Transaction tx = tm.suspend();
             tc.setTransaction(tx, provider.getTransactionID(tx));
-            tc.setTransactionType(TransactionContext.TRANSACTION_LOCAL);
+            tc.setTransactionType(TransactionContext.Scope.TRANSACTION_LOCAL);
             return tc;
         } catch (InvalidTransactionException err) {
             throw new XATransactionException(err);
@@ -446,14 +445,14 @@
         TransactionContextImpl tc = (TransactionContextImpl)context;
 
         try {
-            if (tc.getTransactionType() != TransactionContext.TRANSACTION_NONE) {
+            if (tc.getTransactionType() != TransactionContext.Scope.TRANSACTION_NONE) {
                 throw new XATransactionException(DQPPlugin.Util.getString("TransactionServer.existing_transaction")); //$NON-NLS-1$
             }
             tm.begin();
             Transaction tx = tm.suspend();
             
             tc.setTransaction(tx, provider.getTransactionID(tx));
-            tc.setTransactionType(TransactionContext.TRANSACTION_REQUEST);
+            tc.setTransactionType(TransactionContext.Scope.TRANSACTION_REQUEST);
             return tc;
         } catch (NotSupportedException e) {
             throw new XATransactionException(e);
@@ -461,13 +460,13 @@
     }
 
     public TransactionContext commit(TransactionContext context) throws XATransactionException, SystemException {
-        Assertion.assertTrue(context.getTransactionType() == TransactionContext.TRANSACTION_REQUEST);
+        Assertion.assertTrue(context.getTransactionType() == TransactionContext.Scope.TRANSACTION_REQUEST);
         TransactionContextImpl tc = (TransactionContextImpl)context;
         
         //commit may be called multiple times by the processworker, if this is a subsequent call, then the current
         //context will not be active
         TransactionContextImpl currentContext = transactions.getTransactionContext(tc.getThreadId());
-        if (currentContext == null || currentContext.getTransactionType() == TransactionContext.TRANSACTION_NONE) {
+        if (currentContext == null || currentContext.getTransactionType() == TransactionContext.Scope.TRANSACTION_NONE) {
             return currentContext;
         }
         TransactionManager tm = getTransactionManager();
@@ -494,7 +493,7 @@
     }
 
     public TransactionContext rollback(TransactionContext context) throws XATransactionException, SystemException {
-        Assertion.assertTrue(context.getTransactionType() == TransactionContext.TRANSACTION_REQUEST);
+        Assertion.assertTrue(context.getTransactionType() == TransactionContext.Scope.TRANSACTION_REQUEST);
         TransactionManager tm = getTransactionManager();
         try {
             tm.resume(context.getTransaction());
@@ -584,11 +583,11 @@
     public void cancelTransactions(String threadId, boolean requestOnly) throws InvalidTransactionException, SystemException {
         TransactionContextImpl tc = transactions.getTransactionContext(threadId);
         
-        if (tc == null || tc.getTransactionType() == TransactionContext.TRANSACTION_NONE) {
+        if (tc == null || tc.getTransactionType() == TransactionContext.Scope.TRANSACTION_NONE) {
             return;
         }
         
-        if (requestOnly && tc.getTransactionType() != TransactionContext.TRANSACTION_REQUEST) {
+        if (requestOnly && tc.getTransactionType() != TransactionContext.Scope.TRANSACTION_REQUEST) {
             return;
         }
         

Modified: trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/extension/TestSQLConversionVisitor.java
===================================================================
--- trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/extension/TestSQLConversionVisitor.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/extension/TestSQLConversionVisitor.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -26,17 +26,18 @@
 import java.util.Map;
 import java.util.Properties;
 
+import org.teiid.connector.jdbc.JDBCPropertyNames;
+import org.teiid.connector.jdbc.translator.FunctionReplacementVisitor;
+import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
+import org.teiid.connector.jdbc.translator.TranslatedCommand;
+import org.teiid.connector.jdbc.translator.Translator;
+
 import junit.framework.TestCase;
 
 import com.metamatrix.cdk.api.EnvironmentUtility;
 import com.metamatrix.cdk.api.TranslationUtility;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.jdbc.JDBCPropertyNames;
-import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
-import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
-import com.metamatrix.connector.jdbc.translator.Translator;
-import com.metamatrix.connector.jdbc.util.FunctionReplacementVisitor;
 import com.metamatrix.connector.language.ICommand;
 import com.metamatrix.connector.language.ILanguageObject;
 import com.metamatrix.connector.metadata.runtime.RuntimeMetadata;
@@ -120,7 +121,7 @@
         props.setProperty(JDBCPropertyNames.USE_COMMENTS_SOURCE_QUERY, Boolean.TRUE.toString());
         Translator trans = new Translator();
         trans.initialize(EnvironmentUtility.createEnvironment(props, false));
-        SQLConversionVisitor visitor = new SQLConversionVisitor(trans);
+        SQLConversionVisitor visitor = trans.getSQLConversionVisitor();
         visitor.setExecutionContext(context);
         visitor.append(obj);
         return visitor.toString();
@@ -146,7 +147,7 @@
         }
         trans.initialize(EnvironmentUtility.createEnvironment(p, false));
         // Convert back to SQL
-        SQLConversionVisitor sqlVisitor = new SQLConversionVisitor(trans);
+        SQLConversionVisitor sqlVisitor = trans.getSQLConversionVisitor();
         
         TranslatedCommand tc = new TranslatedCommand(new FakeExecutionContextImpl(), trans, sqlVisitor, funcVisitor);
         tc.translateCommand(obj);

Modified: trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/oracle/TestOracleSQLConversionVisitor.java
===================================================================
--- trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/oracle/TestOracleSQLConversionVisitor.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/oracle/TestOracleSQLConversionVisitor.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -25,6 +25,13 @@
 import java.util.Map;
 import java.util.Properties;
 
+import org.teiid.connector.jdbc.JDBCPropertyNames;
+import org.teiid.connector.jdbc.oracle.ExtractFunctionModifier;
+import org.teiid.connector.jdbc.oracle.OracleSQLTranslator;
+import org.teiid.connector.jdbc.translator.FunctionReplacementVisitor;
+import org.teiid.connector.jdbc.translator.SQLConversionVisitor;
+import org.teiid.connector.jdbc.translator.TranslatedCommand;
+
 import junit.framework.TestCase;
 
 import com.metamatrix.cdk.CommandBuilder;
@@ -33,10 +40,6 @@
 import com.metamatrix.common.types.DataTypeManager;
 import com.metamatrix.connector.api.ConnectorException;
 import com.metamatrix.connector.api.ExecutionContext;
-import com.metamatrix.connector.jdbc.JDBCPropertyNames;
-import com.metamatrix.connector.jdbc.translator.SQLConversionVisitor;
-import com.metamatrix.connector.jdbc.translator.TranslatedCommand;
-import com.metamatrix.connector.jdbc.util.FunctionReplacementVisitor;
 import com.metamatrix.connector.language.ICommand;
 import com.metamatrix.connector.metadata.runtime.RuntimeMetadata;
 import com.metamatrix.core.util.UnitTestUtil;
@@ -121,7 +124,7 @@
         }
         translator.initialize(EnvironmentUtility.createEnvironment(p, false));
         // Convert back to SQL
-        SQLConversionVisitor sqlVisitor = new SQLConversionVisitor(translator);      
+        SQLConversionVisitor sqlVisitor = translator.getSQLConversionVisitor();      
         sqlVisitor.setExecutionContext(context);
         TranslatedCommand tc = new TranslatedCommand(context, translator, sqlVisitor, funcVisitor);
         tc.translateCommand(obj);

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-02-24 16:41:35 UTC (rev 490)
+++ trunk/test-integration/src/test/java/com/metamatrix/connector/jdbc/util/TestJDBCExecutionHelper.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -28,6 +28,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.teiid.connector.jdbc.JDBCExecutionHelper;
+
 import junit.framework.TestCase;
 
 import com.metamatrix.common.types.DataTypeManager;

Modified: trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestTPCR.java
===================================================================
--- trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestTPCR.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestTPCR.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -25,8 +25,9 @@
 import java.util.Arrays;
 import java.util.List;
 
-import com.metamatrix.connector.jdbc.oracle.OracleCapabilities;
-import com.metamatrix.connector.jdbc.sqlserver.SqlServerCapabilities;
+import org.teiid.connector.jdbc.oracle.OracleCapabilities;
+import org.teiid.connector.jdbc.sqlserver.SqlServerCapabilities;
+
 import com.metamatrix.core.util.UnitTestUtil;
 import com.metamatrix.dqp.internal.datamgr.CapabilitiesConverter;
 import com.metamatrix.query.metadata.QueryMetadataInterface;

Modified: trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestXMLTypeTranslations.java
===================================================================
--- trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestXMLTypeTranslations.java	2009-02-24 16:41:35 UTC (rev 490)
+++ trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestXMLTypeTranslations.java	2009-02-24 18:28:11 UTC (rev 491)
@@ -28,7 +28,8 @@
 import java.util.List;
 import java.util.Set;
 
-import com.metamatrix.connector.jdbc.oracle.OracleCapabilities;
+import org.teiid.connector.jdbc.oracle.OracleCapabilities;
+
 import com.metamatrix.core.util.UnitTestUtil;
 import com.metamatrix.dqp.internal.datamgr.CapabilitiesConverter;
 import com.metamatrix.query.metadata.QueryMetadataInterface;




More information about the teiid-commits mailing list