List:MySQL and Java« Previous MessageNext Message »
From:Don Cohen Date:December 26 2006 10:57am
Subject:patch for mysql-connector-java-5.0.4
View as plain text  
This is a solution to the problem I recently described on
java@stripped resulting in the error message

 PROCEDURE mydb.demoSp can't return a result set in the given context

All I've changed is src/com/mysql/jdbc/MysqlIO.java and only in 
three places that mention CLIENT_RESERVED.
I'm not sure the changes are right for 4.1.0, since I'm not sure
what's supposed to happen in that case.  But I think they're right
for anything from 4.1.1 onward.  How is this related to SSL and how
does it account for the error message above, you may wonder?
The flag allowing multiple results turns out to be in the upper
16 bits of the flag word, and before 4.1.1 that flag data was only
16 bits long.  Somehow the connector code was updated at 4.1.0 but
the ssl code (in lines > 3800) didn't get updated for >=4.1.1,
so that code was only sending 16 bits worth of flags.
CLIENT_MULTI_QUERIES and CLIENT_MULTI_RESULTS seem to be the only
flags so far in the upper 16 bits.

This patch allows me to to get my multiple results back while using
ssl.  I think I'm only actually using the change on line 3822.
I assume someone who understands this code better than I do will
take a closer look at the other two changes.

1191c1191,1192 
<                 if ((this.clientParam & CLIENT_RESERVED) != 0) {
---
>                 if ((this.clientParam & (CLIENT_PROTOCOL_41 | CLIENT_RESERVED))
> 		     != 0) {
3822c3823,3824
<         if ((this.clientParam & CLIENT_RESERVED) != 0) {
---
>         if ((this.clientParam & CLIENT_PROTOCOL_41 // CLIENT_RESERVED
> 	     ) != 0) {
3841c3843,3844
<             if ((this.clientParam & CLIENT_RESERVED) != 0) {
---
>             if ((this.clientParam & CLIENT_PROTOCOL_41 // CLIENT_RESERVED
> 		 ) != 0) {

Thread