Bug #25379 INOUT parameters add extra delimiters for the char ' (single quote)
Submitted: 3 Jan 2007 6:16 Modified: 22 Feb 2007 11:19
Reporter: Noble Paul Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:3.1.10 OS:Any (ANY)
Assigned to: CPU Architecture:Any
Tags: Stored procdure INOUT

[3 Jan 2007 6:16] Noble Paul
Description:
//create a table
create table tbl_4(col char(40))

//Create a SP
CREATE PROCEDURE ins_4 (INOUT invalue char(255))
BEGIN
insert into tbl_4(col) values(invalue);
END

run the following jdbc code

Connection conn = getMySqlConn();
CallableStatement stmt = conn.prepareCall("{call ins_4(?)}");
stmt.setString(1,"'john'");
stmt.executeUpdate();
System.out.println("stmt.getString() = " + stmt.getString(1));

The output is 

stmt.getString() = \'john\'

now query the table 

select * from tbl_4

You will see the same value inserted
 \'john\'

note: if the parameter is of type IN this does not happen 

How to repeat:
as above
[5 Jan 2007 12:23] Tonci Grgin
Hi Paul and thanks for your report.
What happens if you registerOutputParameter() as described in documentation 
"Using CallableStatements to Execute Stored Procedures" ?
[5 Jan 2007 13:03] Noble Paul
even after calling  
stmt.registerOutParameter(1,Types.CHAR);
the behavior remains same
[10 Jan 2007 23:48] 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/17896
[22 Feb 2007 11:19] MC Brown
A note has been added to 5.0.5 changelog.