---------- Forwarded message ----------
Date: Tue, 13 Jul 1999 09:59:49 -0400
From: Gyorgy Fekete <gyuri@stripped>
To: bane@stripped, claudia@stripped
Subject: MYSQL error?
In case anyone cares...
In mysql documentation (Node: mysql_fetch_field_direct)
the example given:
MYSQL_FIELD *field;
field = mysql_fetch_field_direct(result, i);
is wrong. It should be:
field = &mysql_fetch_field_direct(res, ui);
--------------^----------------
The docs give the prototype
MYSQL_FIELD *mysql_fetch_field_direct(MYSQL_RES *result, unsigned int fieldnr)
which *SEEMS* correct, but the mysql.h file revelas that this function is
really a macro, therefore the type checking is weak. Discovery of this error
came from the compiler message:
mt.c: In function `main':
mt.c:53: incompatible types in assignment
make: *** [mt.o] Error 1
for the line
field = mysql_fetch_field_direct(res, ui); // res, ui are as approrpiate
I changed it to:
field = &mysql_fetch_field_direct(res, ui);
and everything was fine.