Bug #2852 getColumnClassName returns wrong classes for TINYINT and SMALLINT
Submitted: 17 Feb 2004 22:05 Modified: 18 Feb 2004 13:51
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:3.0.10 OS:Java
Assigned to: CPU Architecture:Any

[17 Feb 2004 22:05] [ name withheld ]
Description:
Fixing Bug #1913 to make TINYINT and SMALLINT to return Integer types was not accompanied by 
needed correction to ResultSetMetaData.getColumnClassName(), which should return java.lang.Integer

How to repeat:
For a TINYINT or SMALLINT in a ResultSet:

ResultSetMetaData.getColumnClassName()

Suggested fix:
    public String getColumnClassName(int column) throws SQLException {
        Field f = getField(column);

        switch (f.getSQLType()) {
        case Types.BIT:
            return "java.lang.Boolean";

        case Types.TINYINT:

             return "java.lang.Integer";

        case Types.SMALLINT:

             return "java.lang.Integer";

...
[18 Feb 2004 13:51] Mark Matthews
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html