Bug #4320 mysql.h and libmysql.lib are not consistent
Submitted: 29 Jun 2004 2:32 Modified: 4 Sep 2004 13:20
Reporter: Barney Wrightson Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Packaging Severity:S2 (Serious)
Version:4.0.20a OS:Windows (windows)
Assigned to: Assigned Account CPU Architecture:Any

[29 Jun 2004 2:32] Barney Wrightson
Description:
When compiling against <mysql install dir>/include/mysql.h and linking <mysql install dir>/lib/<build type>/libmysql.lib from version 4.0.16 and 4.0.20a of mysql windows install.

The data in the MYSQL_FIELD structure after calling mysql_fetch_fields() on a MYSQL_RES structure returned from a query, appears to be garbled - as if the structure is defined differently in the header I am compiling against, compared to what is being returned by the mysql_fetch_fields() call.

ie. although the data I get is ok, the field type comes out as the wrong enum, or as some random number that is not in the enum. Other fields in the structure appear to be wrong or mixed up as well. eg. table name might be null but the string appears in the name field.

If I compile the same code with mysql.h and libmysql.lib from 4.1.0-alpha it seems to be ok.

On further investigation If I mix versions, ie. take the headers from 4.1.0 and link against the libs supplied with 4.0.20a then everything is dandy.

This indicates to me that the problem is either:

1. The headers being distributed with 4.0.20a (and earlier versions) are not up to date.

OR

2. The libs being distributed with 4.0.20a (and earlier versions) are coming from the 4.1.0 tree somewhere. (4.1.1 headers do not match either)

NB. Bug #4176 May be due to this issue also, rather than the deficiency it has been alluded to in the response to the bug report.

How to repeat:
1. Install 4.0.20a.
2. Compile a program that queries a db and then checks the field types.
3. Debug it and examine the MYSQL_FIELD returned from mysql_fetch_fields().

Suggested fix:
Distribute headers and libs that match.
[1 Jul 2004 6:52] MySQL Verification Team
I assume you are using the package release with installer
and I found that the libmysql.lib was built with a source
newer than the server 4.0.20a (the client info is 4.0.21).

This issue will be fixed in the next release.

Thanks you for the bug report.
[30 Jul 2004 18:35] Sergei Golubchik
Lenz, please close, if it's fixed
[4 Aug 2004 13:20] Lenz Grimmer
I would assume this has been fixed for the 4.0.20d Windows packages. Barney, can you confirm?
[14 Feb 2005 22:54] 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".