Bug #37127 Blob field incorrectly retrieved as string
Submitted: 1 Jun 2008 13:01 Modified: 2 Jun 2008 8:11
Reporter: CoolKid K-Qha Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51.25 OS:Windows (XP SP2)
Assigned to: CPU Architecture:Any
Tags: BLOB, connector, string

[1 Jun 2008 13:01] CoolKid K-Qha
Description:
I developed an application using Turbo Delphi with MySQL 4.0.2a-nt as database server. For connecting to database, my app use ADO which connect to ODBC DSN using MyODBC 3.51.11-2. 

Recently, I've replace the MyODBC 3.51.11-2 with MyODBC 3.51.25. But after I run my app, I found a weird "new" behaviour of the newly ODBC driver. When I try to read the content of a blob field, somehow the content simply "interpreted" as string. For example, if I store 3 bytes binary value of "FF3344", it stored as 3 bytes, but if I retrieve the field, it represented as a string consists of "FF3344" characters (that's 6 characters/bytes). 

FYI, these odd behaviour didn't introduced in old driver I've been used (MyODBC 3.51.11-2). This simply happened when I try to replace my old MyODBC driver with a new one, and no coding changes occured at all in my app.

How to repeat:
1. From an existing TBlobField, try to copy the content into a TMemoryStream. E.g: Query1BlobData.SaveToStream(memstrm).

2. Save the content of the memory stream into a file. E.g: memstrm.SaveToFile('c:\strm_content.bin').

3. The size of the newly created file is twice the actual of the data in Query1BlobData, because it's hex value simply read as string.
[1 Jun 2008 13:54] CoolKid K-Qha
Change the title to the more appropriate one
[2 Jun 2008 8:11] Tonci Grgin
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments to the original bug instead.

Thank you for your interest in MySQL.

Explanation. Hi CoolKid :-) and thanks for your report. This is a duplicate of Bug#36373 so please see explanation there.