You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2006/08/30 08:36:51 UTC
svn commit: r438397 - in
/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main:
java/org/apache/cayenne/dba/mysql/MySQLAdapter.java
resources/org/apache/cayenne/dba/mysql/types.xml
Author: aadamchik
Date: Tue Aug 29 23:36:51 2006
New Revision: 438397
URL: http://svn.apache.org/viewvc?rev=438397&view=rev
Log:
CAY-639 HEAD - 3.0
Modified:
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/resources/org/apache/cayenne/dba/mysql/types.xml
Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java?rev=438397&r1=438396&r2=438397&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/dba/mysql/MySQLAdapter.java Tue Aug 29 23:36:51 2006
@@ -106,33 +106,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/trunk/core/cayenne-jdk1.4/src/main/resources/org/apache/cayenne/dba/mysql/types.xml
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/resources/org/apache/cayenne/dba/mysql/types.xml?rev=438397&r1=438396&r2=438397&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/resources/org/apache/cayenne/dba/mysql/types.xml (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/resources/org/apache/cayenne/dba/mysql/types.xml Tue Aug 29 23:36:51 2006
@@ -27,6 +27,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"/>