Bug #362 ResultSetMetaData Returns Incorrect Display Length
Submitted: 2 May 2003 21:59 Modified: 4 Jun 2003 15:46
Reporter: Mike Brown Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:3.0.7 OS:Microsoft Windows (Win XP)
Assigned to: Mark Matthews CPU Architecture:Any

[2 May 2003 21:59] Mike Brown
Description:
Hello,

  When retrieving ResultSetMetaData information from a ResultSet that contains a LongBlob, the Column Display Size reports back 16777215 (The size of a MediumBlob as per the docs).  I was expecting the value be reported as 4294967295 (The size of a LongBlob as per the docs).  The underlying table type is InnoDB.  I was imagine the issue is the same for LongText but I have not tested this assumption.

Stats:
MySQL Version: 4.0.12-max-nt
MySQL/J Version: 3.0.7 (as well as 3.0.6)
OS: Windows XP w/ all patches (could test on RH7.3 if needed)
Hardware: AMD Athlon 2100+, 512M, ASUS Motherboard
JVM: 1.4.1_01

Please let me know if I can help in any way.

Thanks a lot!
Mike Brown
SRV Systems

How to repeat:
Produced By:
1) create table test4 (
    id int not null primary key,
    descr varchar(20),
    dbl double not null,
    bob longblob) type = InnoDB;

2) Manually inserted one record:
        PreparedStatement pstmt = conn.prepareStatement(
                "insert into test4 values (1, 'brown', 3.14, ?)");
        FileInputStream fis = new FileInputStream(<19Meg Zip File>);
        pstmt.setBinaryStream(1, fis, Integer.MAX_VALUE);
        pstmt.executeUpdate();
        pstmt.close();

3) Retrieved All Records (all one of them) and outputed its ResultSetMetaData:
        Statement stmt = conn.createStatement();
        ResultSet rs = stmt.executeQuery("Select * from test4");
        ResultSetMetaData rsmd = rs.getMetaData();
        for (int index = 1; index <= rsmd.getColumnCount(); index++) {
            System.out.println(
                    "Catalog Name: " + rsmd.getCatalogName(index) + "\n" +
                    "Column Display Size: " + rsmd.getColumnDisplaySize(index) + "\n" +
                    "Column Label: " + rsmd.getColumnLabel(index) + "\n" +
                    "Column Name: " + rsmd.getColumnName(index) + "\n" +
                    "Column Type: " + rsmd.getColumnType(index) + "\n" +
                    "Column Type Name: " + rsmd.getColumnTypeName(index) + "\n" +
                    "Is Auto-Increment: " + rsmd.isAutoIncrement(index) + "\n" +
                    "Is Case Sensitive: " + rsmd.isCaseSensitive(index) + "\n" +
                    "Is Currency: " + rsmd.isCurrency(index) + "\n" +
                    "Is Definitely Writable: " + rsmd.isDefinitelyWritable(index) + "\n" +
                    "Is Nullable: " + rsmd.isNullable(index) + "\n" +
                    "Is Read-Only: " + rsmd.isReadOnly(index) + "\n" +
                    "Is Searchable: " + rsmd.isSearchable(index) + "\n" +
                    "Is Signed: " + rsmd.isSigned(index) + "\n" +
                    "Is Writable: " + rsmd.isWritable(index) + "\n" +
                    "Precision: " + rsmd.getPrecision(index) + "\n" +
                    "Scale: " + rsmd.getScale(index) + "\n" +
                    "Schema Name: " + rsmd.getSchemaName(index) + "\n" +
                    "Table Name: " + rsmd.getTableName(index) + "\n");
        }
[4 Jun 2003 15:46] Mark Matthews
This is fixed in MySQL-4.1.1 (it's a MySQL protocol-level issue).