From: Date: July 30 1999 5:51pm Subject: MYSQL error? (fwd) List-Archive: http://lists.mysql.com/mysql/8880 Message-Id: <14241.51632.430785.465284@monty.pp.sci.fi> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit >>>>> "Claudia" == Claudia M Castaneda writes: Claudia> ---------- Forwarded message ---------- Claudia> Date: Tue, 13 Jul 1999 09:59:49 -0400 Claudia> From: Gyorgy Fekete 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