Description:
We read MySQL as raw data without charset conversions.
I.e. we set character_set_client=binary, character_set_connection=binary, character_set_results=NULL.
We do the conversion ourselves, so we must know the columns' metadata including column and display sizes.
In version 9.1, the Connector/C reports wrong sizes for these types if the database's charset is utf8mb4:
TINYTEXT: Column Size: 63, Display Size: 255
MEDIUMTEXT: Column Size: 4194303, Display Size: 16777215
LONGTEXT: Column Size: 4GB, Display Size: 4GB
These sizes are wrong and incompatible with the metadata returned by connector 8.0 for the same database:
TINYTEXT: Column Size: 255, Display Size: 63
MEDIUMTEXT: Column Size: 16777215, Display Size: 4194303
LONGTEXT: Column Size: 4GB, Display Size: 1GB
This seems to be a bug and it critical for us.
Thanks
How to repeat:
We have a test program that reproduces the issue.
I'll be glad to provide it uopn request.
In summary, the programs connecst to a MySQL utf8mb4 database, sets binary mode, and gets the metadata of the various TEXT columns as follows:
SQLDescribeColW(hStmt, colIndex, colName,..., &dataType, &columnSize, ...);
SQLColAttributeW(hStmt, colIndex, SQL_DESC_DISPLAY_SIZE, ..., &displaySize);
Then it prints columnSize and displaySize.
When running the same program on the same database, while only changing the driver version, the printed sizes are different.
Suggested fix:
Make the size compatible with previous connector version.