Bug #86119 SERVER_PS_OUT_PARAMS not set with prepared call statement
Submitted: 27 Apr 2017 19:27 Modified: 11 May 2017 13:31
Reporter: John Dow Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S3 (Non-critical)
Version:5.7.18 OS:Debian
Assigned to: CPU Architecture:Any

[27 Apr 2017 19:27] John Dow
Description:
SERVER_PS_OUT_PARAMS is not set in server_status when using a prepared call statement with OUT/INOUT parameters, like in the example from 

https://dev.mysql.com/doc/refman/5.7/en/c-api-prepared-call-statements.html

Linked with:
-L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -latomic -ldl

How to repeat:
compile and run the sample from 
https://dev.mysql.com/doc/refman/5.7/en/c-api-prepared-call-statements.html

Output is:

Number of columns in result: 3
Data: this result set is produced by the procedure
 val[0] = 10; val[1] = NULL; val[2] = 30;
Number of columns in result: 3
Data: this result set is produced by the procedure
 val[0] = 100; val[1] = 200; val[2] = 300;
Number of columns in result: 2
Data: this result set is produced by the procedure <--- Should 'contains OUT/INOUT parameters'
 val[0] = 200; val[1] = 300;
End of procedure output
[11 May 2017 8:50] Chiranjeevi Battula
Hello John Dow,

Thank you for the bug report.
This is most likely duplicate of Bug #79662, please see Bug #79662.

Thanks,
Chiranjeevi.
[11 May 2017 13:31] John Dow
Hello Chiranjeevi,

I "do not have access to bug #79662."
[29 Aug 2023 19:02] Rene' Cannao'
John,

SERVER_PS_OUT_PARAMS is never sent if CLIENT_DEPRECATE_EOF capability flag is set (since MySQL 5.7.5).

If CLIENT_DEPRECATE_EOF is NOT set (see https://dev.mysql.com/doc/dev/mysql-server/latest/group__group__cs__capabilities__flags.ht...) a resultset has:
* a packet with column_count
* column_count packets with column definition
* a first EOF packet
* a packet for each row in the resultset
* a second EOF packet

If CLIENT_DEPRECATE_EOF is set, the first EOF is not sent, and the second EOF is replaced with an OK packet.

The problem?
SERVER_PS_OUT_PARAMS is sent in the first EOF only.
Therefore, because CLIENT_DEPRECATE_EOF disables the first EOF packet, SERVER_PS_OUT_PARAMS is never sent.
References using MySQL 8.0.33 as an example (other versions have the same issue):
https://github.com/mysql/mysql-server/blob/mysql-8.0.33/sql/protocol_classic.cc#L300-L307
https://github.com/mysql/mysql-server/blob/mysql-8.0.33/sql/protocol_classic.cc#L3686-L370...

In other words, CLIENT_DEPRECATE_EOF is incompatible with SERVER_PS_OUT_PARAMS .
This makes the documentation on https://dev.mysql.com/doc/c-api/8.0/en/c-api-prepared-call-statements.html incorrect since MySQL 5.7.5 .