[teiid-commits] teiid SVN: r911 - in trunk: connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql and 2 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Mon May 11 18:00:47 EDT 2009


Author: shawkins
Date: 2009-05-11 18:00:47 -0400 (Mon, 11 May 2009)
New Revision: 911

Added:
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQL5Capabilities.java
   trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQL5Translator.java
Modified:
   trunk/connector-api/src/main/java/org/teiid/connector/visitor/util/SQLStringVisitor.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/resources/connector-jdbc.xml
   trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/mysql/TestMySQLTranslator.java
Log:
TEIID-105 adding mysql support for bit operations and creating a mysql 5 specific translator/capabilities.

Modified: trunk/connector-api/src/main/java/org/teiid/connector/visitor/util/SQLStringVisitor.java
===================================================================
--- trunk/connector-api/src/main/java/org/teiid/connector/visitor/util/SQLStringVisitor.java	2009-05-11 21:39:16 UTC (rev 910)
+++ trunk/connector-api/src/main/java/org/teiid/connector/visitor/util/SQLStringVisitor.java	2009-05-11 22:00:47 UTC (rev 911)
@@ -22,8 +22,11 @@
 
 package org.teiid.connector.visitor.util;
 
+import java.util.Arrays;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.language.IAggregate;
@@ -81,6 +84,9 @@
  */
 public class SQLStringVisitor extends AbstractLanguageVisitor implements SQLReservedWords {
    
+    private Set<String> infixFunctions = new HashSet<String>(Arrays.asList("%", "+", "-", "*", "+", "/", "||", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ 
+    		"&", "~", "|", "^"));   //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ 
+	
     private static final String ESCAPED_QUOTE = "''"; //$NON-NLS-1$    
 
     protected static final String UNDEFINED = "<undefined>"; //$NON-NLS-1$
@@ -388,6 +394,10 @@
               .append(SPACE);
         append(obj.getItems());
     }
+        
+    protected boolean isInfixFunction(String function) {
+    	return infixFunctions.contains(function);
+    }
 
     /**
      * @see com.metamatrix.data.visitor.LanguageObjectVisitor#visit(org.teiid.connector.language.IFunction)
@@ -415,7 +425,7 @@
             }
             buffer.append(typeValue);
             buffer.append(RPAREN); 
-        } else if(name.equals("%") || name.equals("+") || name.equals("-") || name.equals("*") || name.equals("/") || name.equals("||")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+        } else if(isInfixFunction(name)) { 
             buffer.append(LPAREN); 
 
             if(args != null) {

Added: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQL5Capabilities.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQL5Capabilities.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQL5Capabilities.java	2009-05-11 22:00:47 UTC (rev 911)
@@ -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.mysql;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.teiid.connector.api.SourceSystemFunctions;
+
+
+
+/** 
+ * @since 4.3
+ */
+public class MySQL5Capabilities extends MySQLCapabilities {
+
+    public List<String> getSupportedFunctions() {
+        List<String> supportedFunctions = new ArrayList<String>();
+        supportedFunctions.addAll(super.getSupportedFunctions());
+        supportedFunctions.add(SourceSystemFunctions.TIMESTAMPADD);
+        supportedFunctions.add(SourceSystemFunctions.TIMESTAMPDIFF);
+        return supportedFunctions;
+    }
+    
+    @Override
+    public boolean supportsInlineViews() {
+    	return true;
+    }
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQL5Capabilities.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQL5Translator.java
===================================================================
--- trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQL5Translator.java	                        (rev 0)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQL5Translator.java	2009-05-11 22:00:47 UTC (rev 911)
@@ -0,0 +1,34 @@
+/*
+ * 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 org.teiid.connector.api.ConnectorCapabilities;
+
+public class MySQL5Translator extends MySQLTranslator {
+	
+	@Override
+	public Class<? extends ConnectorCapabilities> getDefaultCapabilities() {
+		return MySQL5Capabilities.class;
+	}
+	
+}


Property changes on: trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQL5Translator.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: 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/MySQLCapabilities.java	2009-05-11 21:39:16 UTC (rev 910)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLCapabilities.java	2009-05-11 22:00:47 UTC (rev 911)
@@ -22,9 +22,10 @@
 
 package org.teiid.connector.jdbc.mysql;
 
-import java.util.ArrayList;
-import java.util.List;
+import java.util.ArrayList;
+import java.util.List;
 
+import org.teiid.connector.api.SourceSystemFunctions;
 import org.teiid.connector.jdbc.JDBCCapabilities;
 
 
@@ -34,246 +35,236 @@
  */
 public class MySQLCapabilities extends JDBCCapabilities {
 
-    public List getSupportedFunctions() {
-        List supportedFunctions = new ArrayList();
-        supportedFunctions.addAll(super.getSupportedFunctions());
+    public List<String> getSupportedFunctions() {
+        List<String> supportedFunctions = new ArrayList<String>();
+        supportedFunctions.addAll(super.getSupportedFunctions());
+
+        supportedFunctions.add(SourceSystemFunctions.ABS); 
+        supportedFunctions.add(SourceSystemFunctions.ACOS); 
+        supportedFunctions.add(SourceSystemFunctions.ASIN);
+        supportedFunctions.add(SourceSystemFunctions.ATAN);
+        supportedFunctions.add(SourceSystemFunctions.ATAN2);
+        supportedFunctions.add(SourceSystemFunctions.BITAND);
+        supportedFunctions.add(SourceSystemFunctions.BITNOT);
+        supportedFunctions.add(SourceSystemFunctions.BITOR);
+        supportedFunctions.add(SourceSystemFunctions.BITXOR);
+        supportedFunctions.add(SourceSystemFunctions.CEILING);
+        supportedFunctions.add(SourceSystemFunctions.COS);
+        supportedFunctions.add(SourceSystemFunctions.COT);
+        supportedFunctions.add(SourceSystemFunctions.DEGREES);
+        supportedFunctions.add(SourceSystemFunctions.EXP);
+        supportedFunctions.add(SourceSystemFunctions.FLOOR);
+        supportedFunctions.add(SourceSystemFunctions.LOG);
+        supportedFunctions.add(SourceSystemFunctions.LOG10);
+        supportedFunctions.add(SourceSystemFunctions.MOD);
+        supportedFunctions.add(SourceSystemFunctions.PI);
+        supportedFunctions.add(SourceSystemFunctions.POWER);
+        supportedFunctions.add(SourceSystemFunctions.RADIANS);
+        supportedFunctions.add(SourceSystemFunctions.ROUND);
+        supportedFunctions.add(SourceSystemFunctions.SIGN);
+        supportedFunctions.add(SourceSystemFunctions.SIN);
+        supportedFunctions.add(SourceSystemFunctions.SQRT);
+        supportedFunctions.add(SourceSystemFunctions.TAN);
+
+        supportedFunctions.add(SourceSystemFunctions.ASCII);
+        supportedFunctions.add(SourceSystemFunctions.CHAR);
+        supportedFunctions.add(SourceSystemFunctions.CONCAT);
+        supportedFunctions.add(SourceSystemFunctions.INSERT);
+        supportedFunctions.add(SourceSystemFunctions.LCASE);
+        supportedFunctions.add(SourceSystemFunctions.LEFT);
+        supportedFunctions.add(SourceSystemFunctions.LENGTH);
+        supportedFunctions.add(SourceSystemFunctions.LOCATE);
+        supportedFunctions.add(SourceSystemFunctions.LPAD);
+        supportedFunctions.add(SourceSystemFunctions.LTRIM);
+        supportedFunctions.add(SourceSystemFunctions.REPEAT);
+        supportedFunctions.add(SourceSystemFunctions.REPLACE);
+        supportedFunctions.add(SourceSystemFunctions.RIGHT);
+        supportedFunctions.add(SourceSystemFunctions.RPAD);
+        supportedFunctions.add(SourceSystemFunctions.RTRIM);
+        supportedFunctions.add(SourceSystemFunctions.SUBSTRING);
+        supportedFunctions.add(SourceSystemFunctions.UCASE);
+        
+        // These are executed within the server and never pushed down
+//        supportedFunctions.add("CURDATE"); //$NON-NLS-1$
+//        supportedFunctions.add("CURTIME"); //$NON-NLS-1$
+//        supportedFunctions.add("NOW"); //$NON-NLS-1$
+        supportedFunctions.add(SourceSystemFunctions.DAYNAME);
+        supportedFunctions.add(SourceSystemFunctions.DAYOFMONTH);
+        supportedFunctions.add(SourceSystemFunctions.DAYOFWEEK);
+        supportedFunctions.add(SourceSystemFunctions.DAYOFYEAR);
+        
+        // These should not be pushed down since the grammar for string conversion is different
+//        supportedFunctions.add("FORMATDATE"); //$NON-NLS-1$
+//        supportedFunctions.add("FORMATTIME"); //$NON-NLS-1$
+//        supportedFunctions.add("FORMATTIMESTAMP"); //$NON-NLS-1$
+        supportedFunctions.add(SourceSystemFunctions.HOUR);
+        supportedFunctions.add(SourceSystemFunctions.MINUTE);
+        supportedFunctions.add(SourceSystemFunctions.MONTH);
+        supportedFunctions.add(SourceSystemFunctions.MONTHNAME);
+        
+        // These should not be pushed down since the grammar for string conversion is different
+//        supportedFunctions.add("PARSEDATE"); //$NON-NLS-1$
+//        supportedFunctions.add("PARSETIME"); //$NON-NLS-1$
+//        supportedFunctions.add("PARSETIMESTAMP"); //$NON-NLS-1$
+        supportedFunctions.add(SourceSystemFunctions.QUARTER);
+        supportedFunctions.add(SourceSystemFunctions.SECOND);
+//        supportedFunctions.add(SourceSystemFunctions.TIMESTAMPADD);
+//        supportedFunctions.add(SourceSystemFunctions.TIMESTAMPDIFF);
+        supportedFunctions.add(SourceSystemFunctions.WEEK);
+        supportedFunctions.add(SourceSystemFunctions.YEAR);
+
+        supportedFunctions.add(SourceSystemFunctions.CONVERT);
+        supportedFunctions.add(SourceSystemFunctions.IFNULL);
+        supportedFunctions.add(SourceSystemFunctions.COALESCE);
+        
+//        supportedFunctions.add("GREATEST"); //$NON-NLS-1$
+//        supportedFunctions.add("ISNULL"); //$NON-NLS-1$
+//        supportedFunctions.add("LEAST"); //$NON-NLS-1$
+//        supportedFunctions.add("STRCMP"); // String-specific //$NON-NLS-1$
+//        
+//        // String
+//        supportedFunctions.add("BIN"); //$NON-NLS-1$
+//        supportedFunctions.add("BIT_LENGTH"); //$NON-NLS-1$
+//        supportedFunctions.add("CHAR_LENGTH"); //$NON-NLS-1$
+//        supportedFunctions.add("CHARACTER_LENGTH"); //$NON-NLS-1$
+//        supportedFunctions.add("COMPRESS"); //$NON-NLS-1$
+//        supportedFunctions.add("CONCAT_WS"); //$NON-NLS-1$
+//        supportedFunctions.add("CONV"); //$NON-NLS-1$
+//        supportedFunctions.add("ELT"); //$NON-NLS-1$
+//        supportedFunctions.add("EXPORT_SET"); //$NON-NLS-1$
+//        supportedFunctions.add("FIELD"); //$NON-NLS-1$
+//        supportedFunctions.add("FIND_IN_SET"); //$NON-NLS-1$
+//        supportedFunctions.add("FORMAT"); //$NON-NLS-1$
+//        supportedFunctions.add("HEX"); //$NON-NLS-1$
+//        supportedFunctions.add("INSTR"); //$NON-NLS-1$
+//        supportedFunctions.add("LOAD_FILE"); //$NON-NLS-1$
+//        supportedFunctions.add("MAKE_SET"); //$NON-NLS-1$
+//        supportedFunctions.add("MID"); //$NON-NLS-1$
+//        supportedFunctions.add("OCT"); //$NON-NLS-1$
+//        supportedFunctions.add("OCTET_LENGTH"); //$NON-NLS-1$
+//        supportedFunctions.add("ORD"); //$NON-NLS-1$
+//        supportedFunctions.add("QUOTE"); //$NON-NLS-1$
+//        supportedFunctions.add("REVERSE"); //$NON-NLS-1$
+//        supportedFunctions.add("SOUNDEX"); //$NON-NLS-1$
+//        supportedFunctions.add("SPACE"); //$NON-NLS-1$
+//        supportedFunctions.add("SUBSTR"); //$NON-NLS-1$
+//        supportedFunctions.add("SUBSTRING_INDEX"); //$NON-NLS-1$
+//        supportedFunctions.add("TRIM"); //$NON-NLS-1$
+//        supportedFunctions.add("UNCOMPRESS"); //$NON-NLS-1$
+//        supportedFunctions.add("UNHEX"); //$NON-NLS-1$
+//        
+//        // Math
+//        supportedFunctions.add("CEIL"); //$NON-NLS-1$
+//        supportedFunctions.add("CRC32"); //$NON-NLS-1$
+//          // DIV is an operator equivalent to '/'
+//        supportedFunctions.add("DIV"); //$NON-NLS-1$
+//        supportedFunctions.add("FORMAT"); //$NON-NLS-1$
+//        supportedFunctions.add("LN"); //$NON-NLS-1$
+//        supportedFunctions.add("LOG2"); //$NON-NLS-1$
+//        supportedFunctions.add("POW"); //$NON-NLS-1$
+//        supportedFunctions.add("RAND"); //$NON-NLS-1$
+//        supportedFunctions.add("TRUNCATE"); //$NON-NLS-1$
+//        
+//        // Date / Time
+//        supportedFunctions.add("ADDDATE"); //$NON-NLS-1$
+//        supportedFunctions.add("ADDTIME"); //$NON-NLS-1$
+//        supportedFunctions.add("CONVERT_TZ"); //$NON-NLS-1$
+//        supportedFunctions.add("CURRENT_DATE"); //$NON-NLS-1$
+//        supportedFunctions.add("CURRENT_TIME"); //$NON-NLS-1$
+//        supportedFunctions.add("CURRENT_TIMESTAMP"); //$NON-NLS-1$
+//        supportedFunctions.add("DATE"); //$NON-NLS-1$
+//        supportedFunctions.add("DATEDIFF"); //$NON-NLS-1$
+////        supportedFunctions.add("DATE_ADD");
+////        supportedFunctions.add("DATE_SUB");
+//        supportedFunctions.add("DATE_FORMAT"); //$NON-NLS-1$
+//        supportedFunctions.add("DAY"); //$NON-NLS-1$
+////        supportedFunctions.add("EXTRACT");
+//        supportedFunctions.add("FROM_DAYS"); //$NON-NLS-1$
+//        supportedFunctions.add("FROM_UNIXTIME"); //$NON-NLS-1$
+//        supportedFunctions.add("GET_FORMAT"); //$NON-NLS-1$
+//        supportedFunctions.add("LAST_DAY"); //$NON-NLS-1$
+//        supportedFunctions.add("LOCALTIME"); //$NON-NLS-1$
+//        supportedFunctions.add("LOCALTIMESTAMP"); //$NON-NLS-1$
+//        supportedFunctions.add("MAKEDATE"); //$NON-NLS-1$
+//        supportedFunctions.add("MAKETIME"); //$NON-NLS-1$
+//        supportedFunctions.add("MICROSECOND"); //$NON-NLS-1$
+//        supportedFunctions.add("PERIOD_ADD"); //$NON-NLS-1$
+//        supportedFunctions.add("PERIOD_DIFF"); //$NON-NLS-1$
+//        supportedFunctions.add("SEC_TO_TIME"); //$NON-NLS-1$
+//        supportedFunctions.add("STR_TO_DATE"); //$NON-NLS-1$
+//        supportedFunctions.add("SUBDATE"); //$NON-NLS-1$
+//        supportedFunctions.add("SUBTIME"); //$NON-NLS-1$
+//        supportedFunctions.add("SYSDATE"); //$NON-NLS-1$
+//        supportedFunctions.add("TIME"); //$NON-NLS-1$
+//        supportedFunctions.add("TIMEDIFF"); //$NON-NLS-1$
+//        supportedFunctions.add("TIMESTAMP"); //$NON-NLS-1$
+//        supportedFunctions.add("TIME_FORMAT"); //$NON-NLS-1$
+//        supportedFunctions.add("TIME_TO_SEC"); //$NON-NLS-1$
+//        supportedFunctions.add("TO_DAYS"); //$NON-NLS-1$
+//        supportedFunctions.add("UNIX_TIMESTAMP"); //$NON-NLS-1$
+//        supportedFunctions.add("UTC_DATE"); //$NON-NLS-1$
+//        supportedFunctions.add("UTC_TIME"); //$NON-NLS-1$
+//        supportedFunctions.add("UTC_TIMESTAMP"); //$NON-NLS-1$
+//        supportedFunctions.add("WEEKDAY"); //$NON-NLS-1$
+//        supportedFunctions.add("WEEKOFYEAR"); //$NON-NLS-1$
+//        supportedFunctions.add("YEARWEEK"); //$NON-NLS-1$
+//        
+//        // Bit
+//        supportedFunctions.add("|"); //$NON-NLS-1$
+//        supportedFunctions.add("&"); //$NON-NLS-1$
+//        supportedFunctions.add("^"); //$NON-NLS-1$
+//        supportedFunctions.add("<<"); //$NON-NLS-1$
+//        supportedFunctions.add(">>"); //$NON-NLS-1$
+//        supportedFunctions.add("~"); //$NON-NLS-1$
+//        supportedFunctions.add("BIT_COUNT"); //$NON-NLS-1$
+//        
+//        // Encryption
+//        supportedFunctions.add("AES_ENCRYPT"); //$NON-NLS-1$
+//        supportedFunctions.add("AES_DECRYPT"); //$NON-NLS-1$
+//        supportedFunctions.add("DECODE"); //$NON-NLS-1$
+//        supportedFunctions.add("ENCODE"); //$NON-NLS-1$
+//        supportedFunctions.add("DES_ENCRYPT"); //$NON-NLS-1$
+//        supportedFunctions.add("DES_DECRYPT"); //$NON-NLS-1$
+//        supportedFunctions.add("MD5"); //$NON-NLS-1$
+//        supportedFunctions.add("OLD_PASSWORD"); //$NON-NLS-1$
+//        supportedFunctions.add("PASSWORD"); //$NON-NLS-1$
+//        supportedFunctions.add("SHA"); //$NON-NLS-1$
+//        supportedFunctions.add("SHA1"); //$NON-NLS-1$
+//        
+//        // Information
+//        supportedFunctions.add("BENCHMARK"); //$NON-NLS-1$
+//        supportedFunctions.add("CHARSET"); //$NON-NLS-1$
+//        supportedFunctions.add("COERCIBILITY"); //$NON-NLS-1$
+//        supportedFunctions.add("COLLATION"); //$NON-NLS-1$
+//        supportedFunctions.add("CONNECTION_ID"); //$NON-NLS-1$
+//        supportedFunctions.add("CURRENT_USER"); //$NON-NLS-1$
+//        supportedFunctions.add("DATABASE"); //$NON-NLS-1$
+//        supportedFunctions.add("FOUND_ROWS"); //$NON-NLS-1$
+//        supportedFunctions.add("LAST_INSERT_ID"); //$NON-NLS-1$
+//        supportedFunctions.add("ROW_COUNT"); //$NON-NLS-1$
+//        supportedFunctions.add("SCHEMA"); //$NON-NLS-1$
+//        supportedFunctions.add("SESSION_USER"); //$NON-NLS-1$
+//        supportedFunctions.add("SYSTEM_USER"); //$NON-NLS-1$
+//        supportedFunctions.add("USER"); //$NON-NLS-1$
+//        supportedFunctions.add("VERSION"); //$NON-NLS-1$
+//        
+//        // Misc.
+//        supportedFunctions.add("DEFAULT"); //$NON-NLS-1$
+//        supportedFunctions.add("FORMAT"); //$NON-NLS-1$
+////        supportedFunctions.add("GET_LOCK"); //$NON-NLS-1$
+//        supportedFunctions.add("INET_ATON"); //$NON-NLS-1$
+//        supportedFunctions.add("INET_NTOA"); //$NON-NLS-1$
+////        supportedFunctions.add("IS_FREE_LOCK"); //$NON-NLS-1$
+////        supportedFunctions.add("IS_USED_LOCK"); //$NON-NLS-1$
+////        supportedFunctions.add("MASTER_POS_WAIT"); //$NON-NLS-1$
+////        supportedFunctions.add("NAME_CONST"); //$NON-NLS-1$
+////        supportedFunctions.add("RELEASE_LOCK"); //$NON-NLS-1$
+////        supportedFunctions.add("SLEEP"); //$NON-NLS-1$
+//        supportedFunctions.add("UUID"); //$NON-NLS-1$
+//        supportedFunctions.add("VALUES"); //$NON-NLS-1$
+        return supportedFunctions;
+    }
 
-        supportedFunctions.add("ABS"); //$NON-NLS-1$
-        supportedFunctions.add("ACOS"); //$NON-NLS-1$
-        supportedFunctions.add("ASIN"); //$NON-NLS-1$
-        supportedFunctions.add("ATAN"); //$NON-NLS-1$
-        supportedFunctions.add("ATAN2"); //$NON-NLS-1$
-        // These are executed within the server and never pushed down
-//        supportedFunctions.add("BITAND"); //$NON-NLS-1$
-//        supportedFunctions.add("BITNOT"); //$NON-NLS-1$
-//        supportedFunctions.add("BITOR"); //$NON-NLS-1$
-//        supportedFunctions.add("BITXOR"); //$NON-NLS-1$
-        supportedFunctions.add("CEILING"); //$NON-NLS-1$
-        supportedFunctions.add("COS"); //$NON-NLS-1$
-        supportedFunctions.add("COT"); //$NON-NLS-1$
-        supportedFunctions.add("DEGREES"); //$NON-NLS-1$
-        supportedFunctions.add("EXP"); //$NON-NLS-1$
-        supportedFunctions.add("FLOOR"); //$NON-NLS-1$
-        supportedFunctions.add("LOG"); //$NON-NLS-1$
-        supportedFunctions.add("LOG10"); //$NON-NLS-1$
-        supportedFunctions.add("MOD"); //$NON-NLS-1$
-        supportedFunctions.add("PI"); //$NON-NLS-1$
-        supportedFunctions.add("POWER"); //$NON-NLS-1$
-        supportedFunctions.add("RADIANS"); //$NON-NLS-1$
-        supportedFunctions.add("ROUND"); //$NON-NLS-1$
-        supportedFunctions.add("SIGN"); //$NON-NLS-1$
-        supportedFunctions.add("SIN"); //$NON-NLS-1$
-        supportedFunctions.add("SQRT"); //$NON-NLS-1$
-        supportedFunctions.add("TAN"); //$NON-NLS-1$
-        
-        supportedFunctions.add("ASCII"); //$NON-NLS-1$
-        supportedFunctions.add("CHR"); //$NON-NLS-1$
-        supportedFunctions.add("CHAR"); //$NON-NLS-1$
-        supportedFunctions.add("||"); //$NON-NLS-1$
-        supportedFunctions.add("CONCAT"); //$NON-NLS-1$
-        supportedFunctions.add("INSERT"); //$NON-NLS-1$
-        supportedFunctions.add("LCASE"); //$NON-NLS-1$
-        supportedFunctions.add("LEFT"); //$NON-NLS-1$
-        supportedFunctions.add("LENGTH"); //$NON-NLS-1$
-        supportedFunctions.add("LOCATE"); //$NON-NLS-1$
-        supportedFunctions.add("LOWER"); //$NON-NLS-1$
-        supportedFunctions.add("LPAD"); //$NON-NLS-1$
-        supportedFunctions.add("LTRIM"); //$NON-NLS-1$
-        supportedFunctions.add("REPEAT"); //$NON-NLS-1$
-        supportedFunctions.add("REPLACE"); //$NON-NLS-1$
-        supportedFunctions.add("RIGHT"); //$NON-NLS-1$
-        supportedFunctions.add("RPAD"); //$NON-NLS-1$
-        supportedFunctions.add("RTRIM"); //$NON-NLS-1$
-        supportedFunctions.add("SUBSTRING"); //$NON-NLS-1$
-        supportedFunctions.add("UCASE"); //$NON-NLS-1$
-        supportedFunctions.add("UPPER"); //$NON-NLS-1$
-        
-        // These are executed within the server and never pushed down
-//        supportedFunctions.add("CURDATE"); //$NON-NLS-1$
-//        supportedFunctions.add("CURTIME"); //$NON-NLS-1$
-//        supportedFunctions.add("NOW"); //$NON-NLS-1$
-        supportedFunctions.add("DAYNAME"); //$NON-NLS-1$
-        supportedFunctions.add("DAYOFMONTH"); //$NON-NLS-1$
-        supportedFunctions.add("DAYOFWEEK"); //$NON-NLS-1$
-        supportedFunctions.add("DAYOFYEAR"); //$NON-NLS-1$
-        
-        // These should not be pushed down since the grammar for string conversion is different
-//        supportedFunctions.add("FORMATDATE"); //$NON-NLS-1$
-//        supportedFunctions.add("FORMATTIME"); //$NON-NLS-1$
-//        supportedFunctions.add("FORMATTIMESTAMP"); //$NON-NLS-1$
-        supportedFunctions.add("HOUR"); //$NON-NLS-1$
-        supportedFunctions.add("MINUTE"); //$NON-NLS-1$
-        supportedFunctions.add("MONTH"); //$NON-NLS-1$
-        supportedFunctions.add("MONTHNAME"); //$NON-NLS-1$
-        
-        // These should not be pushed down since the grammar for string conversion is different
-//        supportedFunctions.add("PARSEDATE"); //$NON-NLS-1$
-//        supportedFunctions.add("PARSETIME"); //$NON-NLS-1$
-//        supportedFunctions.add("PARSETIMESTAMP"); //$NON-NLS-1$
-        supportedFunctions.add("QUARTER"); //$NON-NLS-1$
-        supportedFunctions.add("SECOND"); //$NON-NLS-1$
-        supportedFunctions.add("TIMESTAMPADD"); //$NON-NLS-1$
-//        supportedFunctions.add("TIMESTAMPDIFF"); //$NON-NLS-1$
-        supportedFunctions.add("WEEK"); //$NON-NLS-1$
-        supportedFunctions.add("YEAR"); //$NON-NLS-1$
-        
-        supportedFunctions.add("CAST"); //$NON-NLS-1$
-        supportedFunctions.add("CONVERT"); //$NON-NLS-1$
-        supportedFunctions.add("IFNULL"); //$NON-NLS-1$
-        supportedFunctions.add("NVL"); //$NON-NLS-1$
-        
-        //   ADDITIONAL functions supported by MySQL
-        
-//        // Comparison
-        supportedFunctions.add("COALESCE"); //$NON-NLS-1$
-//        supportedFunctions.add("GREATEST"); //$NON-NLS-1$
-//        supportedFunctions.add("ISNULL"); //$NON-NLS-1$
-//        supportedFunctions.add("LEAST"); //$NON-NLS-1$
-//        supportedFunctions.add("STRCMP"); // String-specific //$NON-NLS-1$
-//        
-//        // String
-//        supportedFunctions.add("BIN"); //$NON-NLS-1$
-//        supportedFunctions.add("BIT_LENGTH"); //$NON-NLS-1$
-//        supportedFunctions.add("CHAR_LENGTH"); //$NON-NLS-1$
-//        supportedFunctions.add("CHARACTER_LENGTH"); //$NON-NLS-1$
-//        supportedFunctions.add("COMPRESS"); //$NON-NLS-1$
-//        supportedFunctions.add("CONCAT_WS"); //$NON-NLS-1$
-//        supportedFunctions.add("CONV"); //$NON-NLS-1$
-//        supportedFunctions.add("ELT"); //$NON-NLS-1$
-//        supportedFunctions.add("EXPORT_SET"); //$NON-NLS-1$
-//        supportedFunctions.add("FIELD"); //$NON-NLS-1$
-//        supportedFunctions.add("FIND_IN_SET"); //$NON-NLS-1$
-//        supportedFunctions.add("FORMAT"); //$NON-NLS-1$
-//        supportedFunctions.add("HEX"); //$NON-NLS-1$
-//        supportedFunctions.add("INSTR"); //$NON-NLS-1$
-//        supportedFunctions.add("LOAD_FILE"); //$NON-NLS-1$
-//        supportedFunctions.add("MAKE_SET"); //$NON-NLS-1$
-//        supportedFunctions.add("MID"); //$NON-NLS-1$
-//        supportedFunctions.add("OCT"); //$NON-NLS-1$
-//        supportedFunctions.add("OCTET_LENGTH"); //$NON-NLS-1$
-//        supportedFunctions.add("ORD"); //$NON-NLS-1$
-//        supportedFunctions.add("QUOTE"); //$NON-NLS-1$
-//        supportedFunctions.add("REVERSE"); //$NON-NLS-1$
-//        supportedFunctions.add("SOUNDEX"); //$NON-NLS-1$
-//        supportedFunctions.add("SPACE"); //$NON-NLS-1$
-//        supportedFunctions.add("SUBSTR"); //$NON-NLS-1$
-//        supportedFunctions.add("SUBSTRING_INDEX"); //$NON-NLS-1$
-//        supportedFunctions.add("TRIM"); //$NON-NLS-1$
-//        supportedFunctions.add("UNCOMPRESS"); //$NON-NLS-1$
-//        supportedFunctions.add("UNHEX"); //$NON-NLS-1$
-//        
-//        // Math
-//        supportedFunctions.add("CEIL"); //$NON-NLS-1$
-//        supportedFunctions.add("CRC32"); //$NON-NLS-1$
-//          // DIV is an operator equivalent to '/'
-//        supportedFunctions.add("DIV"); //$NON-NLS-1$
-//        supportedFunctions.add("FORMAT"); //$NON-NLS-1$
-//        supportedFunctions.add("LN"); //$NON-NLS-1$
-//        supportedFunctions.add("LOG2"); //$NON-NLS-1$
-//        supportedFunctions.add("POW"); //$NON-NLS-1$
-//        supportedFunctions.add("RAND"); //$NON-NLS-1$
-//        supportedFunctions.add("TRUNCATE"); //$NON-NLS-1$
-//        
-//        // Date / Time
-//        supportedFunctions.add("ADDDATE"); //$NON-NLS-1$
-//        supportedFunctions.add("ADDTIME"); //$NON-NLS-1$
-//        supportedFunctions.add("CONVERT_TZ"); //$NON-NLS-1$
-//        supportedFunctions.add("CURRENT_DATE"); //$NON-NLS-1$
-//        supportedFunctions.add("CURRENT_TIME"); //$NON-NLS-1$
-//        supportedFunctions.add("CURRENT_TIMESTAMP"); //$NON-NLS-1$
-//        supportedFunctions.add("DATE"); //$NON-NLS-1$
-//        supportedFunctions.add("DATEDIFF"); //$NON-NLS-1$
-////        supportedFunctions.add("DATE_ADD");
-////        supportedFunctions.add("DATE_SUB");
-//        supportedFunctions.add("DATE_FORMAT"); //$NON-NLS-1$
-//        supportedFunctions.add("DAY"); //$NON-NLS-1$
-////        supportedFunctions.add("EXTRACT");
-//        supportedFunctions.add("FROM_DAYS"); //$NON-NLS-1$
-//        supportedFunctions.add("FROM_UNIXTIME"); //$NON-NLS-1$
-//        supportedFunctions.add("GET_FORMAT"); //$NON-NLS-1$
-//        supportedFunctions.add("LAST_DAY"); //$NON-NLS-1$
-//        supportedFunctions.add("LOCALTIME"); //$NON-NLS-1$
-//        supportedFunctions.add("LOCALTIMESTAMP"); //$NON-NLS-1$
-//        supportedFunctions.add("MAKEDATE"); //$NON-NLS-1$
-//        supportedFunctions.add("MAKETIME"); //$NON-NLS-1$
-//        supportedFunctions.add("MICROSECOND"); //$NON-NLS-1$
-//        supportedFunctions.add("PERIOD_ADD"); //$NON-NLS-1$
-//        supportedFunctions.add("PERIOD_DIFF"); //$NON-NLS-1$
-//        supportedFunctions.add("SEC_TO_TIME"); //$NON-NLS-1$
-//        supportedFunctions.add("STR_TO_DATE"); //$NON-NLS-1$
-//        supportedFunctions.add("SUBDATE"); //$NON-NLS-1$
-//        supportedFunctions.add("SUBTIME"); //$NON-NLS-1$
-//        supportedFunctions.add("SYSDATE"); //$NON-NLS-1$
-//        supportedFunctions.add("TIME"); //$NON-NLS-1$
-//        supportedFunctions.add("TIMEDIFF"); //$NON-NLS-1$
-//        supportedFunctions.add("TIMESTAMP"); //$NON-NLS-1$
-//        supportedFunctions.add("TIME_FORMAT"); //$NON-NLS-1$
-//        supportedFunctions.add("TIME_TO_SEC"); //$NON-NLS-1$
-//        supportedFunctions.add("TO_DAYS"); //$NON-NLS-1$
-//        supportedFunctions.add("UNIX_TIMESTAMP"); //$NON-NLS-1$
-//        supportedFunctions.add("UTC_DATE"); //$NON-NLS-1$
-//        supportedFunctions.add("UTC_TIME"); //$NON-NLS-1$
-//        supportedFunctions.add("UTC_TIMESTAMP"); //$NON-NLS-1$
-//        supportedFunctions.add("WEEKDAY"); //$NON-NLS-1$
-//        supportedFunctions.add("WEEKOFYEAR"); //$NON-NLS-1$
-//        supportedFunctions.add("YEARWEEK"); //$NON-NLS-1$
-//        
-//        // Bit
-//        supportedFunctions.add("|"); //$NON-NLS-1$
-//        supportedFunctions.add("&"); //$NON-NLS-1$
-//        supportedFunctions.add("^"); //$NON-NLS-1$
-//        supportedFunctions.add("<<"); //$NON-NLS-1$
-//        supportedFunctions.add(">>"); //$NON-NLS-1$
-//        supportedFunctions.add("~"); //$NON-NLS-1$
-//        supportedFunctions.add("BIT_COUNT"); //$NON-NLS-1$
-//        
-//        // Encryption
-//        supportedFunctions.add("AES_ENCRYPT"); //$NON-NLS-1$
-//        supportedFunctions.add("AES_DECRYPT"); //$NON-NLS-1$
-//        supportedFunctions.add("DECODE"); //$NON-NLS-1$
-//        supportedFunctions.add("ENCODE"); //$NON-NLS-1$
-//        supportedFunctions.add("DES_ENCRYPT"); //$NON-NLS-1$
-//        supportedFunctions.add("DES_DECRYPT"); //$NON-NLS-1$
-//        supportedFunctions.add("MD5"); //$NON-NLS-1$
-//        supportedFunctions.add("OLD_PASSWORD"); //$NON-NLS-1$
-//        supportedFunctions.add("PASSWORD"); //$NON-NLS-1$
-//        supportedFunctions.add("SHA"); //$NON-NLS-1$
-//        supportedFunctions.add("SHA1"); //$NON-NLS-1$
-//        
-//        // Information
-//        supportedFunctions.add("BENCHMARK"); //$NON-NLS-1$
-//        supportedFunctions.add("CHARSET"); //$NON-NLS-1$
-//        supportedFunctions.add("COERCIBILITY"); //$NON-NLS-1$
-//        supportedFunctions.add("COLLATION"); //$NON-NLS-1$
-//        supportedFunctions.add("CONNECTION_ID"); //$NON-NLS-1$
-//        supportedFunctions.add("CURRENT_USER"); //$NON-NLS-1$
-//        supportedFunctions.add("DATABASE"); //$NON-NLS-1$
-//        supportedFunctions.add("FOUND_ROWS"); //$NON-NLS-1$
-//        supportedFunctions.add("LAST_INSERT_ID"); //$NON-NLS-1$
-//        supportedFunctions.add("ROW_COUNT"); //$NON-NLS-1$
-//        supportedFunctions.add("SCHEMA"); //$NON-NLS-1$
-//        supportedFunctions.add("SESSION_USER"); //$NON-NLS-1$
-//        supportedFunctions.add("SYSTEM_USER"); //$NON-NLS-1$
-//        supportedFunctions.add("USER"); //$NON-NLS-1$
-//        supportedFunctions.add("VERSION"); //$NON-NLS-1$
-//        
-//        // Misc.
-//        supportedFunctions.add("DEFAULT"); //$NON-NLS-1$
-//        supportedFunctions.add("FORMAT"); //$NON-NLS-1$
-////        supportedFunctions.add("GET_LOCK"); //$NON-NLS-1$
-//        supportedFunctions.add("INET_ATON"); //$NON-NLS-1$
-//        supportedFunctions.add("INET_NTOA"); //$NON-NLS-1$
-////        supportedFunctions.add("IS_FREE_LOCK"); //$NON-NLS-1$
-////        supportedFunctions.add("IS_USED_LOCK"); //$NON-NLS-1$
-////        supportedFunctions.add("MASTER_POS_WAIT"); //$NON-NLS-1$
-////        supportedFunctions.add("NAME_CONST"); //$NON-NLS-1$
-////        supportedFunctions.add("RELEASE_LOCK"); //$NON-NLS-1$
-////        supportedFunctions.add("SLEEP"); //$NON-NLS-1$
-//        supportedFunctions.add("UUID"); //$NON-NLS-1$
-//        supportedFunctions.add("VALUES"); //$NON-NLS-1$
-        return supportedFunctions;
-    }
-
     public boolean supportsFullOuterJoins() {
         return false;
     }

Modified: 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/mysql/MySQLTranslator.java	2009-05-11 21:39:16 UTC (rev 910)
+++ trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/mysql/MySQLTranslator.java	2009-05-11 22:00:47 UTC (rev 911)
@@ -33,7 +33,7 @@
 import org.teiid.connector.api.ConnectorEnvironment;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.api.SourceSystemFunctions;
-import org.teiid.connector.jdbc.derby.DerbyCapabilities;
+import org.teiid.connector.jdbc.translator.AliasModifier;
 import org.teiid.connector.jdbc.translator.Translator;
 
 
@@ -46,7 +46,11 @@
 	@Override
     public void initialize(ConnectorEnvironment env) throws ConnectorException {
         super.initialize(env);
-        registerFunctionModifier(SourceSystemFunctions.CONVERT, new MySQLConvertModifier(getLanguageFactory()));
+        registerFunctionModifier(SourceSystemFunctions.CONVERT, new MySQLConvertModifier(getLanguageFactory()));
+        registerFunctionModifier(SourceSystemFunctions.BITAND, new AliasModifier("&")); //$NON-NLS-1$
+        registerFunctionModifier(SourceSystemFunctions.BITNOT, new AliasModifier("~")); //$NON-NLS-1$
+        registerFunctionModifier(SourceSystemFunctions.BITOR, new AliasModifier("|")); //$NON-NLS-1$
+        registerFunctionModifier(SourceSystemFunctions.BITXOR, new AliasModifier("^")); //$NON-NLS-1$
     }  
 	
 	@Override
@@ -97,7 +101,7 @@
 	
 	@Override
 	public Class<? extends ConnectorCapabilities> getDefaultCapabilities() {
-		return DerbyCapabilities.class;
+		return MySQLCapabilities.class;
 	}
 	
 }

Modified: trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml
===================================================================
--- trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml	2009-05-11 21:39:16 UTC (rev 910)
+++ trunk/connectors/connector-jdbc/src/main/resources/connector-jdbc.xml	2009-05-11 22:00:47 UTC (rev 911)
@@ -74,6 +74,12 @@
             <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" Multiplicity="1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
             <PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="org.teiid.connector.jdbc.mysql.MySQLTranslator" Multiplicity="0..1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
         </ComponentType>
+        <ComponentType Name="MySQL 5 JDBC Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="JDBC Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" CreatedBy="ConfigurationStartup">
+            <PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="com.mysql.jdbc.Driver" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />        
+            <PropertyDefinition Name="URL" DisplayName="JDBC URL" ShortDescription="" DefaultValue="jdbc:mysql://&lt;host&gt;:3306/&lt;databaseName&gt;" Multiplicity="1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="false" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="true" />
+            <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" Multiplicity="1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
+            <PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="org.teiid.connector.jdbc.mysql.MySQL5Translator" Multiplicity="0..1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
+        </ComponentType>
         <ComponentType Name="MySQL JDBC XA Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="JDBC Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" CreatedBy="ConfigurationStartup">
             <PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />        
             <PropertyDefinition Name="PortNumber" DisplayName="Port Number" DefaultValue="3306" ShortDescription="" Multiplicity="1" PropertyType="Integer" ValueDelimiter="," IsConstrainedToAllowedValues="false" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="true" />
@@ -83,6 +89,15 @@
 			<PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="org.teiid.connector.jdbc.mysql.MySQLTranslator" Multiplicity="0..1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />            
             <PropertyDefinition Name="IsXA" DisplayName="Is XA" ShortDescription="Is XA" DefaultValue="true" Multiplicity="1" PropertyType="Boolean" IsConstrainedToAllowedValues="true" IsPreferred="true" />
         </ComponentType>
+        <ComponentType Name="MySQL 5 JDBC XA Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="JDBC Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" CreatedBy="ConfigurationStartup">
+            <PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />        
+            <PropertyDefinition Name="PortNumber" DisplayName="Port Number" DefaultValue="3306" ShortDescription="" Multiplicity="1" PropertyType="Integer" ValueDelimiter="," IsConstrainedToAllowedValues="false" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="true" />
+			<PropertyDefinition Name="ServerName" DisplayName="Server Name" ShortDescription="" Multiplicity="1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="false" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="true" />
+            <PropertyDefinition Name="DatabaseName" DisplayName="Database Name" ShortDescription="" Multiplicity="1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="false" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="true" />
+            <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" Multiplicity="1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
+			<PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="org.teiid.connector.jdbc.mysql.MySQL5Translator" Multiplicity="0..1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />            
+            <PropertyDefinition Name="IsXA" DisplayName="Is XA" ShortDescription="Is XA" DefaultValue="true" Multiplicity="1" PropertyType="Boolean" IsConstrainedToAllowedValues="true" IsPreferred="true" />
+        </ComponentType>
         <ComponentType Name="PostgreSQL JDBC Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="JDBC Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" CreatedBy="ConfigurationStartup">
             <PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="org.postgresql.Driver" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />        
             <PropertyDefinition Name="URL" DisplayName="JDBC URL" ShortDescription="" DefaultValue="jdbc:postgresql://&lt;host&gt;:5432/&lt;databaseName&gt;" Multiplicity="1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="false" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="true" />
@@ -110,7 +125,7 @@
             <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription="" Multiplicity="1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
             <PropertyDefinition Name="ExtensionTranslationClass" DisplayName="Extension SQL Translation Class" ShortDescription="" DefaultValue="org.teiid.connector.jdbc.derby.DerbySQLTranslator" Multiplicity="0..1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsExpert="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />
         </ComponentType>
-        <ComponentType Name="Teiid JDBC 6 Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="JDBC Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" CreatedBy="ConfigurationStartup">
+        <ComponentType Name="Teiid 6 JDBC Connector" ComponentTypeCode="2" Deployable="true" Deprecated="false" Monitorable="false" SuperComponentType="JDBC Connector" ParentComponentType="Connectors" LastChangedBy="ConfigurationStartup" CreatedBy="ConfigurationStartup">
             <PropertyDefinition Name="ConnectionSource" DisplayName="Connection Source Class" ShortDescription="Driver, DataSource, or XADataSource class name" DefaultValue="com.metamatrix.jdbc.MMDriver" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />
             <PropertyDefinition Name="URL" DisplayName="JDBC URL" ShortDescription="" DefaultValue="jdbc:metamatrix:&lt;vdbName&gt;@mm://&lt;host&gt;:&lt;port&gt;" Multiplicity="1" IsConstrainedToAllowedValues="false" IsPreferred="true" />            
             <PropertyDefinition Name="ConnectorClassPath" DisplayName="Class Path" ShortDescription=""  Multiplicity="0..1" PropertyType="String" ValueDelimiter="," IsConstrainedToAllowedValues="true" IsHidden="false" IsMasked="false" IsModifiable="true" IsPreferred="false" />        

Modified: 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/mysql/TestMySQLTranslator.java	2009-05-11 21:39:16 UTC (rev 910)
+++ trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/mysql/TestMySQLTranslator.java	2009-05-11 22:00:47 UTC (rev 911)
@@ -22,40 +22,31 @@
 
 package org.teiid.connector.jdbc.mysql;
 
-import java.util.Map;
+import static org.junit.Assert.*;
+
 import java.util.Properties;
 
+import org.junit.BeforeClass;
+import org.junit.Test;
 import org.teiid.connector.api.ConnectorException;
 import org.teiid.connector.jdbc.MetadataFactory;
-import org.teiid.connector.jdbc.mysql.MySQLTranslator;
 import org.teiid.connector.jdbc.translator.TranslatedCommand;
+import org.teiid.connector.jdbc.translator.Translator;
 import org.teiid.connector.language.ICommand;
 
-import junit.framework.TestCase;
-
 import com.metamatrix.cdk.api.EnvironmentUtility;
 
 /**
  */
-public class TestMySQLTranslator extends TestCase {
+public class TestMySQLTranslator {
 
-    private static Map MODIFIERS;
     private static MySQLTranslator TRANSLATOR; 
-    
-    static {
-        try {
-            TRANSLATOR = new MySQLTranslator();        
-            TRANSLATOR.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
-            MODIFIERS = TRANSLATOR.getFunctionModifiers();
-        } catch(ConnectorException e) {
-            e.printStackTrace();    
-        }
+    
+    @BeforeClass public static void oneTimeSetup() throws ConnectorException {
+        TRANSLATOR = new MySQLTranslator();        
+        TRANSLATOR.initialize(EnvironmentUtility.createEnvironment(new Properties(), false));
     }
 
-    public TestMySQLTranslator(String name) {
-        super(name);
-    }
-
     private String getTestVDB() {
         return MetadataFactory.PARTS_VDB;
     }
@@ -64,11 +55,11 @@
         return MetadataFactory.BQT_VDB; 
     }
     
-    public void helpTestVisitor(String vdb, String input, Map modifiers, String expectedOutput) throws ConnectorException {
+    public static void helpTestVisitor(String vdb, String input, String expectedOutput, Translator translator) throws ConnectorException {
         // Convert from sql to objects
         ICommand obj = MetadataFactory.helpTranslate(vdb, input);
         
-        TranslatedCommand tc = new TranslatedCommand(EnvironmentUtility.createSecurityContext("user"), TRANSLATOR);
+        TranslatedCommand tc = new TranslatedCommand(EnvironmentUtility.createSecurityContext("user"), translator); //$NON-NLS-1$
         tc.translateCommand(obj);
         
         
@@ -76,144 +67,139 @@
         assertEquals("Did not get correct sql", expectedOutput, tc.getSql());             //$NON-NLS-1$
     }
 
-    public void testRewriteConversion1() throws Exception {
+    @Test public void testRewriteConversion1() throws Exception {
         String input = "SELECT char(convert(PART_WEIGHT, integer) + 100) FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT char((convert(PARTS.PART_WEIGHT, SIGNED INTEGER) + 100)) FROM PARTS";  //$NON-NLS-1$
 
         helpTestVisitor(getTestVDB(),
             input, 
-            MODIFIERS,
-            output);
+            output, TRANSLATOR);
     }
           
-    public void testRewriteConversion2() throws Exception {
+    @Test public void testRewriteConversion2() throws Exception {
         String input = "SELECT convert(PART_WEIGHT, long) FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT convert(PARTS.PART_WEIGHT, SIGNED) FROM PARTS";  //$NON-NLS-1$
 
         helpTestVisitor(getTestVDB(),
             input, 
-            MODIFIERS,
-            output);
+            output, TRANSLATOR);
     }
           
-    public void testRewriteConversion3() throws Exception {
+    @Test public void testRewriteConversion3() throws Exception {
         String input = "SELECT convert(convert(PART_WEIGHT, long), string) FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT convert(convert(PARTS.PART_WEIGHT, SIGNED), CHAR) FROM PARTS";  //$NON-NLS-1$
 
         helpTestVisitor(getTestVDB(),
             input, 
-            MODIFIERS,
-            output);
+            output, TRANSLATOR);
     }
           
-    public void testRewriteConversion4() throws Exception {
+    @Test public void testRewriteConversion4() throws Exception {
         String input = "SELECT convert(convert(PART_WEIGHT, date), string) FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT date_format(DATE(PARTS.PART_WEIGHT), '%Y-%m-%d') FROM PARTS";  //$NON-NLS-1$
 
         helpTestVisitor(getTestVDB(),
             input, 
-            MODIFIERS,
-            output);
+            output, TRANSLATOR);
     }
-    public void testRewriteConversion5() throws Exception {
+    @Test public void testRewriteConversion5() throws Exception {
         String input = "SELECT convert(convert(PART_WEIGHT, time), string) FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT date_format(TIME(PARTS.PART_WEIGHT), '%H:%i:%S') FROM PARTS";  //$NON-NLS-1$
 
         helpTestVisitor(getTestVDB(),
             input, 
-            MODIFIERS,
-            output);
+            output, TRANSLATOR);
     }
-    public void testRewriteConversion6() throws Exception {
+    @Test public void testRewriteConversion6() throws Exception {
         String input = "SELECT convert(convert(PART_WEIGHT, timestamp), string) FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT date_format(TIMESTAMP(PARTS.PART_WEIGHT), '%Y-%m-%d %H:%i:%S.%f') FROM PARTS";  //$NON-NLS-1$
 
         helpTestVisitor(getTestVDB(),
             input, 
-            MODIFIERS,
-            output);
+            output, TRANSLATOR);
     }
-    public void testRewriteConversion8() throws Exception {
+    @Test public void testRewriteConversion8() throws Exception {
         String input = "SELECT ifnull(PART_WEIGHT, 'otherString') FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT ifnull(PARTS.PART_WEIGHT, 'otherString') FROM PARTS";  //$NON-NLS-1$
 
         helpTestVisitor(getTestVDB(),
             input, 
-            MODIFIERS,
-            output);
+            output, TRANSLATOR);
     }
-    public void testRewriteConversion7() throws Exception {
+    @Test public void testRewriteConversion7() throws Exception {
         String input = "SELECT convert(convert(PART_WEIGHT, integer), string) FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT convert(convert(PARTS.PART_WEIGHT, SIGNED INTEGER), CHAR) FROM PARTS";  //$NON-NLS-1$
 
         helpTestVisitor(getTestVDB(),
             input, 
-            MODIFIERS,
-            output);
+            output, TRANSLATOR);
     }
-    public void testRewriteInsert() throws Exception {
+    @Test public void testRewriteInsert() throws Exception {
         String input = "SELECT insert(PART_WEIGHT, 1, 5, 'chimp') FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT insert(PARTS.PART_WEIGHT, 1, 5, 'chimp') FROM PARTS";  //$NON-NLS-1$
 
         helpTestVisitor(getTestVDB(),
             input, 
-            MODIFIERS,
-            output);
+            output, TRANSLATOR);
     }
-    public void testRewriteLocate() throws Exception {
+    @Test public void testRewriteLocate() throws Exception {
         String input = "SELECT locate(PART_WEIGHT, 'chimp', 1) FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT locate(PARTS.PART_WEIGHT, 'chimp', 1) FROM PARTS";  //$NON-NLS-1$
 
         helpTestVisitor(getTestVDB(),
             input, 
-            MODIFIERS,
-            output);
+            output, TRANSLATOR);
     }
-    public void testRewriteSubstring1() throws Exception {
+    @Test public void testRewriteSubstring1() throws Exception {
         String input = "SELECT substring(PART_WEIGHT, 1) FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT substring(PARTS.PART_WEIGHT, 1) FROM PARTS";  //$NON-NLS-1$
 
         helpTestVisitor(getTestVDB(),
             input, 
-            MODIFIERS,
-            output);
+            output, TRANSLATOR);
     }
-    public void testRewriteSubstring2() throws Exception {
+    @Test public void testRewriteSubstring2() throws Exception {
         String input = "SELECT substring(PART_WEIGHT, 1, 5) FROM PARTS"; //$NON-NLS-1$
         String output = "SELECT substring(PARTS.PART_WEIGHT, 1, 5) FROM PARTS";  //$NON-NLS-1$
 
         helpTestVisitor(getTestVDB(),
             input, 
-            MODIFIERS,
-            output);
+            output, TRANSLATOR);
     }
-    public void testRewriteUnionWithOrderBy() throws Exception {
+    @Test public void testRewriteUnionWithOrderBy() throws Exception {
         String input = "SELECT PART_ID FROM PARTS UNION SELECT PART_ID FROM PARTS ORDER BY PART_ID"; //$NON-NLS-1$
         String output = "(SELECT PARTS.PART_ID FROM PARTS) UNION (SELECT PARTS.PART_ID FROM PARTS) ORDER BY PART_ID";  //$NON-NLS-1$
 
         helpTestVisitor(getTestVDB(),
             input, 
-            MODIFIERS,
-            output);
+            output, TRANSLATOR);
     }
     
-    public void testRowLimit2() throws Exception {
+    @Test public void testRowLimit2() throws Exception {
         String input = "select intkey from bqt1.smalla limit 100"; //$NON-NLS-1$
         String output = "SELECT SmallA.IntKey FROM SmallA LIMIT 100"; //$NON-NLS-1$
                
         helpTestVisitor(getTestBQTVDB(),
             input, 
-            MODIFIERS,
-            output);        
-    }
-    public void testRowLimit3() throws Exception {
+            output, TRANSLATOR);        
+    }
+    
+    @Test public void testRowLimit3() throws Exception {
         String input = "select intkey from bqt1.smalla limit 50, 100"; //$NON-NLS-1$
         String output = "SELECT SmallA.IntKey FROM SmallA LIMIT 50, 100"; //$NON-NLS-1$
                
         helpTestVisitor(getTestBQTVDB(),
             input, 
-            MODIFIERS,
-            output);        
-    }
+            output, TRANSLATOR);        
+    }
+    
+    @Test public void testBitAnd() throws Exception {
+        String input = "select bitand(intkey, intnum) from bqt1.smalla"; //$NON-NLS-1$
+        String output = "SELECT (SmallA.IntKey & SmallA.IntNum) FROM SmallA"; //$NON-NLS-1$
+               
+        TestMySQLTranslator.helpTestVisitor(MetadataFactory.BQT_VDB,
+            input, 
+            output, TRANSLATOR);        
+    }
           
 }




More information about the teiid-commits mailing list