List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:July 30 1999 3:51pm
Subject:MYSQL error? (fwd)
View as plain text  
>>>>> "Claudia" == Claudia M Castaneda <claudia@stripped>
> writes:

Claudia> ---------- Forwarded message ----------
Claudia> Date: Tue, 13 Jul 1999 09:59:49 -0400
Claudia> From: Gyorgy Fekete <gyuri@stripped>
Claudia> To: bane@stripped, claudia@stripped
Claudia> Subject: MYSQL error?


Claudia> In case anyone cares...

Claudia>   In mysql documentation (Node: mysql_fetch_field_direct)
Claudia>   the example given:

Claudia> 	MYSQL_FIELD *field;
Claudia> 	field = mysql_fetch_field_direct(result, i);

Claudia>   is wrong. It should be:

Claudia> 	field = &mysql_fetch_field_direct(res, ui);
Claudia>   --------------^----------------
Claudia> The docs give the prototype 
Claudia> MYSQL_FIELD *mysql_fetch_field_direct(MYSQL_RES *result, unsigned int
> fieldnr)
Claudia> which *SEEMS* correct, but the mysql.h file revelas that this function is 
Claudia> really a macro, therefore the type checking is weak. Discovery of this error
Claudia> came from the compiler message:

Claudia>     mt.c: In function `main':
Claudia>     mt.c:53: incompatible types in assignment
Claudia>     make: *** [mt.o] Error 1

Claudia> for the line

Claudia>     field = mysql_fetch_field_direct(res, ui); // res, ui are as approrpiate

Claudia> I changed it to:

Claudia>     field = &mysql_fetch_field_direct(res, ui); 

Claudia> and everything was fine.

Hi!

The bug is actually in mysql.h;  I have now added & to the macro to
return a pointer.

This is compatible with MySQL 3.23, where everything is functions.
This change was done because it makes the libmysqlclient.so library
much safer against version changes!

Regards,
Monty

Thread
MYSQL error? (fwd)Claudia M. Castaneda13 Jul
  • MYSQL error? (fwd)sinisa14 Jul
  • MYSQL error? (fwd)Michael Widenius30 Jul