| Bug #25715 | BLOB INOUT parameter returns 7 bytes extra | ||
|---|---|---|---|
| Submitted: | 19 Jan 2007 9:14 | Modified: | 13 Apr 2007 8:35 |
| Reporter: | Noble Paul | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / J | Severity: | S3 (Non-critical) |
| Version: | c/MXJ 3.1.10, c/J 5.0SVN | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | calablestatement, INOUT | ||
[26 Mar 2007 14:35]
Tonci Grgin
Hi Paul and thanks for your report. There is 7 byte "extra" apended to your stream, _binary: 30 Query SHOW CREATE PROCEDURE `test`.`spbug25715` 30 Query SET @com_mysql_jdbc_outparam_mblob='_binary' 30 Query CALL spbug25715(@com_mysql_jdbc_outparam_mblob) 30 Query SELECT @com_mysql_jdbc_outparam_mblob Verified as described: - MySQL server 5.0.38BK on WinXP Pro SP2 localhost - c/J 5.0SVN, JDK 1.5.0_11
[26 Mar 2007 16:10]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/22948
[13 Apr 2007 8:35]
MC Brown
A note has been added to the 5.0.6 changelog.

Description: When a SP has a MEDIUMBLOB argument of type INOUT, the value returned contains 7 extra bytes How to repeat: Use the following code The SP: ======== CREATE PROCEDURE mblob_ins (INOUT mblob MEDIUMBLOB) BEGIN insert into MEDIUMBLOB_TBL values(mblob); END -------------------------------------------------- The table: CREATE TABLE MEDIUMBLOB_TBL ( COL mediumblob ) The code: ========= Connection conn = getMySqlConn(); CallableStatement stmt = conn.prepareCall("{call mblob_ins(?)}"); byte[] buf = new byte[65]; for(int i=0;i<65;i++) buf[i] = 1; System.out.println("in.length = " + buf.length); for(int j=0;j<65;j++) System.out.print(buf[j]); System.out.println(""); stmt.setBinaryStream("mblob", new ByteArrayInputStream(buf), buf.length); stmt.registerOutParameter("mblob",Types.BLOB); int i = stmt.executeUpdate(); InputStream is = stmt.getBlob("mblob").getBinaryStream(); buf = new byte[is.available()]; is.read(buf); System.out.println("out.length = " + buf.length); for(int j=0;j<65;j++) System.out.print(buf[j]); ---------------------- The output: ============ in.length = 65 11111111111111111111111111111111111111111111111111111111111111111 out.length = 72 9598105110971141211111111111111111111111111111111111111111111111111111111111