Bug #27911 varbinary data returned from select queries is incorrect
Submitted: 18 Apr 2007 2:11 Modified: 23 Nov 2007 8:37
Reporter: Kenneth Brady Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:5.0.11 OS:Windows (XP and Vista)
Assigned to: CPU Architecture:Any

[18 Apr 2007 2:11] Kenneth Brady
Description:
I have tables with varbinary fields which, using MySQL Connector/ODBC 3.51.14 are well behaved.  Using the current beta 5.0.11, I get incorrect data returned from "select ..." queries using OdbcCommand.ExecuteReader and OdbcDataReader.GetBytes(...).

How to repeat:
Add varbinary data to a table using Connector/ODBC 3.51, and attempt to read same date using Connector/ODBC 5.0.11.
[2 May 2007 6:48] Tonci Grgin
Hi Kenneth. Thanks for your report and your kind words.

I think I noticed something similar too, analyzing.
[8 May 2007 12:46] Tonci Grgin
Hi Kenneth.

Due to Bug#10491 the problem with 3.51.14 is that it reports varbinary data even when the data is not binary at all... As for c/ODBC 5.0 I think this is related to Bug#20127 which has been fixed.
Can you provide us with complete test case showing this behavior?
[9 May 2007 1:41] Kenneth Brady
command-line executable that illustrates the problem

Attachment: Program.cs (text/plain), 3.07 KiB.

[10 May 2007 6:14] Tonci Grgin
Kenneth thanks. Next time please change status back to "Open" so that I see the change immediately.
[10 May 2007 11:12] Tonci Grgin
Kenneth thanks for your nice test case. I was unable to verify the problem (ie. every test evaluates to TRUE. I did only 1 irrelevant change to your code:
private static void Reset()
{
	using (OdbcConnection conn = new OdbcConnection(ConnStr3))
	{
		OdbcCommand cmd = conn.CreateCommand();
		conn.Open();
                cmd.CommandText = "DROP TABLE IF EXISTS bug27911";
                cmd.ExecuteNonQuery();
                cmd.CommandText = "CREATE TABLE bug27911 (Id INT UNSIGNED NOT NULL PRIMARY KEY, varbin VARBINARY(2000)) ENGINE=InnoDB DEFAULT CHARSET=latin1;";
                cmd.ExecuteNonQuery();

	}
}

Environment:
 - MySQL 5.0.38BK & 5.0.40-ntBK on WinXP Pro SP2 localhost
 - MyODBC 3.51.15GA & c/ODBC 5.0.12, 2007-05-10
 - tested both MyISAM and InnoDB tables

Result:
Save3 == Fetch3: True
Save5 == Fetch3: True
Save3 == Fetch5: True
Save5 == Fetch5: True
[10 May 2007 12:27] Kenneth Brady
When I run, I get this:

Save3 == Fetch3: True
Save5 == Fetch3: False
Save3 == Fetch5: False
Save5 == Fetch5: True

This reproduces on two machines, one running XP, the other Vista, both using .NET 2.0.  The Odbc connector versions are 3.51.06 and 5.00.11.
[10 May 2007 12:58] Tonci Grgin
Kenneth, please upgrade to 3.51.15 if possible. Latest snapshots of v5 you can find in URL http://downloads.mysql.com/snapshots/mysql-connector-odbc-5.0/
I used mysql-connector-odbc-5.0-win32-nightly-20070510.zip.
[11 May 2007 2:59] Kenneth Brady
I've installed 3.51.15.  I've not been able to install the most current v5 - after downloading either mysql-connector-odbc-5.0-win32-nightly-20070510.zip or mysql-connector-odbc-5.0-win32-nightly-20070509.zip, I get "End-of-central-directory signature not found" errors on the zip files.

The test program output remains:
Save3 == Fetch3: True
Save5 == Fetch3: False
Save3 == Fetch5: False
Save5 == Fetch5: True
[22 Oct 2007 13:48] Susanne Ebrecht
Kenneth,

we really can't reproduce your error.
Please, try our new MyODBC connector version 5.1 and give us feedback, if the error still occurs.
Many thanks,

Susanne
[23 Nov 2007 0: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".
[23 Nov 2007 8:37] Tonci Grgin
Not that I've expected anything else (as I wasn't able to repeat from the start) but this problem is not repeatable with todays versions of c/ODBC, 3.51.22 and 5.01.01 against MySQL server 5.0.54 on WinXP Pro SP2 localhost, net fw. 2. Closing the report.