Bug #1293 mysql_fetch_fields gives invalid information
Submitted: 15 Sep 2003 23:52 Modified: 20 Jan 2004 8:24
Reporter: van pelt bart Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0.15 OS:Linux (Linux)
Assigned to: Dean Ellis CPU Architecture:Any

[15 Sep 2003 23:52] van pelt bart
Description:
In a user written program I

- Initialize database connection

- Execute query 

- Get result

- Get meta information about fields in the result set by calling mysql_fetch_fields. This results in a valid entry for the first field. I'am especially interested in the (MYSQL_FIELD *).length entry which is documented as the length from the table definition. And use this to determine the amount of memory I need to allocate to store the result. So by creating a loop using mysql_numrows() I want this information for each field. mysql_fetch_fields() yields invalid information for each following field.

How to repeat:
See above
[28 Sep 2003 12:49] ddd ddd
I was experiencing exactly the same issue. I was using an old (3.x) dll to run my application, while the database was upgraded to 4.0.15.

Copying the right libmySQL.dll into my app path solved the problem.
[21 Oct 2003 9:00] Dean Ellis
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.mysql.com/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to 'Open'.

Thank you for your interest in MySQL.

I am unable to duplicate this.

If the suggestion above is inapplicable, could you submit a test case which demonstrates the behaviour?  Include a mysqldump containing a CREATE TABLE statement and sample data, and a sample of the code you are using.

You can send your test case to

ftp://support.mysql.com/pub/mysql/secret

Thank you
[20 Jan 2004 2:32] van pelt bart
I found the solution.

Initially my system used Redhat with an mysql-devel-3.23.XX rpm file.
This creates /usr/include/mysql/....

I installed mysql-4.0.15 from the tar.gz file.
This creates /usr/local/include/mysql...

During compilation the compiler searches a standard path and finds /usr/include/mysql before any -I<include file> statements.

Solved the problem by renaming /usr/include/mysql to /usr/include/mysql-3.23
Or removing the mysql-devel-3.23.xxx rpm kit.
[20 Jan 2004 8:24] Dean Ellis
Thank you for the update.