Bug #29814 SQL_LONGVARBINARY corrupted on database insertion
Submitted: 16 Jul 2007 2:53 Modified: 28 May 2013 8:38
Reporter: Pascal Janse van Vuuren Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51 OS:Windows (XP SP2)
Assigned to: CPU Architecture:Any

[16 Jul 2007 2:53] Pascal Janse van Vuuren
Description:
Parameter data bound through SQLBindParameter as SQL_LONGVARBINARY, with the data passed at execution through MFC, is stored in a corrupted format in the database. 

How to repeat:
Create a table with a binary field of type longblob. Engine is MyISAM and collation is UTF8. Run an insert query that inserts a binary chunk containing ê. Upon retrieval, that will be converted to ê.

The raw text string:

"Leêr naam"

contains ê (ASCII 136). Upon storing it in a binary field in the database through a normal insert query it is converted to ê, which breaks further processing of a chunk.

Inspecting the raw memory in the MFC source code at the point that SQLPutData( ) is called shows the correct values are in memory. Inspecting memory at the point where SQLGetData( ) is called shows the incorrect data was retrieved from the database.

I've looked through the driver code and suspect the problem occurs in mysql_odbc_escape_string, but cannot verify that.
[30 Jul 2007 8:10] Tonci Grgin
Hi Pascal and thanks for your report. I suspect you have charsets miss configured somewhere so please:
 - Attach full test case showing this problem (preferably not using DSN)
 - Attach my.ini/cnf file from your server
 - Attach DDL / DML statements needed for your test
 - Add info on MyODBC / MySQL server used

We are aware that MyODBC 3.51 is still not fully capable of handling MB charsets especially on retrieval but with all info provided I might be able to help you work around this.
[30 Aug 2007 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[28 May 2013 8:38] Bogdan Degtyariov
Cannot continue without feedback from the reporter.
The bug is closed.