Bug #5101 DATA_TYPE for unsigned values returns java.sql.Types.OTHER
Submitted: 18 Aug 2004 23:17 Modified: 18 Aug 2004 23:33
Reporter: Bob Tellefson Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:3.0.14 OS:Linux (linux)
Assigned to: Mark Matthews CPU Architecture:Any

[18 Aug 2004 23:17] Bob Tellefson
Description:
Adding " unsigned" prior to calling MysqlDefs.mysqlToJavaType() causes unsigned types 
to report a DATA_TYPE of java.sql.Types.OTHER. 
 
Code excerpt from class DatabaseMetaData: 
 
                    if (typeInfo.toLowerCase().indexOf("unsigned") != -1) { 
                    	mysqlType = mysqlType + " unsigned"; 
                    } 
 
                    if (this.conn.capitalizeDBMDTypes()) { 
                        mysqlType = mysqlType.toUpperCase(); 
                    } 
 
                    /* 
                     * Convert to XOPEN (thanks JK) 
                     */ 
                    rowVal[4] = Integer.toString(MysqlDefs.mysqlToJavaType( 
                                mysqlType)).getBytes(); 
 
                    // DATA_TYPE (jdbc) 
                    rowVal[5] = s2b(mysqlType); // TYPE_NAME (native) 

How to repeat:
Create a table with an int field and an unsigned int field.  Fetch their DATA_TYPEs via the 
table's metadata result set.  They should return the same DATA_TYPE. 

Suggested fix:
Separate multiple usage of mysqlType.  It's being use for two different unrelated 
methods to represent both the type and the type name.
[18 Aug 2004 23:33] Mark Matthews
This is a duplicate of both BUG#4138 and BUG#4860, and has been fixed already.

Please see a nightly snapshot build of 3.0 from http://downloads.mysql.com/snapshots.php if you want to test it before 3.0.15 is released.