cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r438392 - in /incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/dba/mysql: MySQLAdapter.java types.xml
Date Wed, 30 Aug 2006 06:32:38 GMT
Author: aadamchik
Date: Tue Aug 29 23:32:37 2006
New Revision: 438392

URL: http://svn.apache.org/viewvc?rev=438392&view=rev
Log:
CAY-639

Modified:
    incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/dba/mysql/MySQLAdapter.java
    incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/dba/mysql/types.xml

Modified: incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/dba/mysql/MySQLAdapter.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/dba/mysql/MySQLAdapter.java?rev=438392&r1=438391&r2=438392&view=diff
==============================================================================
--- incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/dba/mysql/MySQLAdapter.java
(original)
+++ incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/dba/mysql/MySQLAdapter.java
Tue Aug 29 23:32:37 2006
@@ -142,33 +142,49 @@
             int precision,
             boolean allowNulls) {
 
+        if (typeName != null) {
+            typeName = typeName.toLowerCase();
+        }
+
         // all LOB types are returned by the driver as OTHER... must remap them manually
         // (at least on MySQL 3.23)
         if (type == Types.OTHER) {
-            if ("longblob".equalsIgnoreCase(typeName)) {
+            if ("longblob".equals(typeName)) {
                 type = Types.BLOB;
             }
-            else if ("mediumblob".equalsIgnoreCase(typeName)) {
+            else if ("mediumblob".equals(typeName)) {
                 type = Types.BLOB;
             }
-            else if ("blob".equalsIgnoreCase(typeName)) {
+            else if ("blob".equals(typeName)) {
                 type = Types.BLOB;
             }
-            else if ("tinyblob".equalsIgnoreCase(typeName)) {
+            else if ("tinyblob".equals(typeName)) {
                 type = Types.VARBINARY;
             }
-            else if ("longtext".equalsIgnoreCase(typeName)) {
+            else if ("longtext".equals(typeName)) {
                 type = Types.CLOB;
             }
-            else if ("mediumtext".equalsIgnoreCase(typeName)) {
+            else if ("mediumtext".equals(typeName)) {
                 type = Types.CLOB;
             }
-            else if ("text".equalsIgnoreCase(typeName)) {
+            else if ("text".equals(typeName)) {
                 type = Types.CLOB;
             }
-            else if ("tinytext".equalsIgnoreCase(typeName)) {
+            else if ("tinytext".equals(typeName)) {
                 type = Types.VARCHAR;
             }
+        }
+        // types like "int unsigned" map to Long
+        else if (typeName != null && typeName.endsWith(" unsigned")) {
+            // per
+            // http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-type-conversions.html
+            if (typeName.equals("int unsigned")
+                    || typeName.equals("integer unsigned")
+                    || typeName.equals("mediumint unsigned")) {
+                type = Types.BIGINT;
+            }
+            // BIGINT UNSIGNED maps to BigInteger according to MySQL docs, but there is no
+            // JDBC mapping for BigInteger
         }
 
         return super.buildAttribute(name, typeName, type, size, precision, allowNulls);

Modified: incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/dba/mysql/types.xml
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/dba/mysql/types.xml?rev=438392&r1=438391&r2=438392&view=diff
==============================================================================
--- incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/dba/mysql/types.xml
(original)
+++ incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/dba/mysql/types.xml
Tue Aug 29 23:32:37 2006
@@ -8,6 +8,9 @@
    <jdbc-type name="ARRAY"/>
    <jdbc-type name="BIGINT">
        <db-type name="BIGINT"/>
+       <db-type name="INT UNSIGNED"/>
+       <db-type name="INTEGER UNSIGNED"/>
+       <db-type name="MEDIUMINT UNSIGNED"/>
    </jdbc-type>
    <jdbc-type name="BINARY">
        <db-type name="BINARY"/>



Mime
View raw message