Bug #22227 ulong not defined for client library
Submitted: 11 Sep 2006 1:34 Modified: 21 Feb 2007 8:04
Reporter: Eric Huss (Candidate Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.0.24a OS:FreeBSD (FreeBSD)
Assigned to: Ramil Kalimullin
Tags: ulong

[11 Sep 2006 1:34] Eric Huss
Description:
5.0.24a changed the definition of the CLIENT_MULTI_STATEMENTS and CLIENT_MULTI_RESULTS flags to include a cast to "ulong".  Due to the way the include files are organized, simply including mysql.h in your C application is no longer sufficient to be able to access these flags.

This is for FreeBSD 4 and 6 using gcc 2.95.4 and 3.4.4.

How to repeat:
Try to access CLIENT_MULTI_STATEMENTS or CLIENT_MULTI_RESULTS from a client C application that only includes mysql.h.

A workaround is to include my_global.h before mysql.h.

Suggested fix:
Revert the definitions to their pre 5.0.24a values (65536 and 131072) or include my_global.h in mysql.h or duplicate the typedef for ulong in mysql.h (it appears that my_ulonglong is already duplicated).
[11 Sep 2006 1:37] Eric Huss
Sample file to compile.

Attachment: ulong_test.c (text/x-csrc), 167 bytes.

[11 Sep 2006 19:54] Sveta Smirnova
Thank you for the report.

Verified as described mysql-standard-5.0.24a-freebsd6.0-i386.tar.gz

On Linux all work fine.
[15 Sep 2006 17:17] [ name withheld ]
This problem exists on OS X, too.
Dan
[22 Sep 2006 9:48] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/12385

ChangeSet@1.2285, 2006-09-22 14:46:18+05:00, ramil@mysql.com +1 -0
  Fix for bug #22227: ulong not defined for client library
    - don't use (ulong) type cast in the include/mysql_com.h as it's not 
      a standard type and might cause compilation errors on some platforms.
[23 Sep 2006 0:26] Timothy Smith
Ramil, looks fine.  Might be nice, for consistency, to change this as well:

#define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */

to:

#define NULL_LENGTH (~0UL) /* For net_store_length */

But I'm not sold on that idea, it's up to you.
[3 Oct 2006 20:01] Chad MILLER
Available in 5.0.26.
[3 Oct 2006 20:14] Chad MILLER
Available in 5.1.12-beta.
[5 Oct 2006 15:59] Paul Dubois
Noted in 5.0.26, 5.1.12 changelogs.

mysql_com.h unnecessarily referred to the ulong type.
[9 Jan 2007 15:53] Ray Zimmerman
It seems this patch never actually made it in to 5.0.27. I can't find 5.0.26 anywhere to check.
[18 Feb 2007 18:36] Eric Huss
This bug still exists in 5.0.26 and 5.0.27.
[18 Feb 2007 18:55] Eric Huss
Appears to be fixed in 5.0.33.  It is very confusing when in-between releases disappear, and difficult to maintain backwards compatibility with older releases if we are unable to download them.  The free bitkeeper UI also makes it difficult to track which version a particular changeset is included in.