Bug #92429 When using SQL_C_WCHAR with SQLGetData, binary data is not returned as hex.
Submitted: 14 Sep 2018 21:28 Modified: 29 Jan 2020 20:46
Reporter: Kari Heinola Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:8.00.12.00 UNICODE OS:Windows
Assigned to: Bogdan Degtyariov CPU Architecture:Any

[14 Sep 2018 21:28] Kari Heinola
Description:
When using SQL_C_WCHAR with SQLGetData, binary data is not returned correctly as hex. Using SQL_C_CHAR with SQLGetData, binary data is returned as hex.

Seems like web post describes the same issue:
https://stackoverflow.com/questions/43846489/sqlbindcol-sql-varbinary-column-to-sql-c-wcha...

How to repeat:
Use call like below to get binary data:
SQLGetData(hStmt, (SQLUSMALLINT)(i + 1), SQL_C_WCHAR, resultData, BUFF_SIZE, &outlen)
[18 Sep 2018 10:41] Bogdan Degtyariov
The bug is verified.
Accordingly to ODBC Specs it should convert binary data to hexacecimal representation:

https://docs.microsoft.com/en-us/sql/odbc/reference/appendixes/sql-to-c-binary?view=sql-se...
[29 Jan 2020 20:46] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Connector/ODBC 8.0.20 release, and here's the proposed changelog entry from the documentation team:

When using SQL_C_WCHAR with SQLGetData, binary data was not returned
correctly as its hexacecimal representation. Related, using SQL_C_CHAR
with SQLGetData did return binary data as hex.

Thank you for the bug report.