2 messages in com.mysql.lists.mysqlMySQL embedded server example bug| From | Sent On | Attachments |
|---|---|---|
| Vladimir Espinosa Angarica | 15 Aug 2003 07:38 | |
| Victoria Reznichenko | 18 Aug 2003 02:45 |
| Subject: | MySQL embedded server example bug![]() |
|---|---|
| From: | Vladimir Espinosa Angarica (vesp...@bioinfo.cu) |
| Date: | 08/15/2003 07:38:48 AM |
| List: | com.mysql.lists.mysql |
Hi Team:
I've found a bug in the example presented in the Official MySQL Manual in the section 9.1.15.6 A Simple Embedded Server Example. I tried to compile the program following the instructions depicted in the manual and a compiling error arose. The error was:
gcc -g -W -Wall -I/usr/local/mysql/include -D_THREAD_SAFE -D_REENTRANT -c -o test_libmysqld.o test_libmysqld.c test_libmysqld.c: In function `db_do_query': test_libmysqld.c:125: `res' undeclared (first use in this function) test_libmysqld.c:125: (Each undeclared identifier is reported only once test_libmysqld.c:125: for each function it appears in.) make: *** [test_libmysqld.o] Error 1
I came back to the program and I realized that in the function db_do_query the variable res was declared within the if block, so it's out of scope when it is called in the statement: line 125: mysql_free_result(res); A simple movement of the declaration line to the beginning of the function solve the problem.
Regards
Vladimir
-- BSc. Vladimir Espinosa Angarica Researcher National Bioinformatics Center Ministry of Science Technology and the Environment Industria y San José, Habana Vieja Capitolio Nacional CUBA Fax: (53-7) 8609614 Tel: (53-7) 8604397 E-mail: vesp...@bioinfo.cu




