Description:
MYSQL_FIELD is used for only mysql_fetch_field_direct() befor MySQL 5.5.
The explanation is described on this manual.
https://dev.mysql.com/doc/refman/5.6/en/c-api-data-structures.html
MySQL 5.5 or later (including 5.6, 5.7), MYSQL_FIELD is also used for SERVER_PS_OUT_PARAMS. But the contents of MYSQL_FIELD are differennt between mysql_fetch_field_direct's result and SERVER_PS_OUT_PARAMS.
For example, the document said 'How to distinguish between VARCHAR and VARBINARY' with charsetnr of MYSQL_FIELS as belows.
//->Quote
To distinguish between binary and nonbinary data for string data types, check whether the charsetnr value is 63. If so, the character set is binary, which indicates binary rather than nonbinary data. This enables you to distinguish BINARY from CHAR, VARBINARY from VARCHAR, and the BLOB types from the TEXT types.
//<-Quote
It's true when using mysql_fetch_field_direct,
But it's not true when using SERVER_PS_OUT_PARAMS.
In case of SERVER_PS_OUT_PARAMS, charsetnr always return charsetnr=63, type=MYSQL_TYPE_VAR_STRING for both of thme (VARCHAR, VARBINARY), so we cannot distinguish using charsetnr = 63 or not. So at that time, we have to do additional check for flags's BINARY_FLAG.
As a matter of fact, the results are different between mysql_fetch_field_direct and SERVER_PS_OUT_PARAMS. And the document describe for only mysql_fetch_field_direct.
How to repeat:
Get MYSQL_FIELD result with SERVER_PS_OUT_PARAMS on MySQL 5.5/5.6/5.7.
Suggested fix:
Need MYSQL_FIELD document for SERVER_PS_OUT_PARAMS.