List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:February 19 2003 5:13pm
Subject:Re: C API Question
View as plain text  
At 10:57 -0600 2/19/03, William R. Mattil wrote:
>Hello,
>
>I am having some cockpit trouble with the following
>
>MYSQL_RES *mysql_list_fields(MYSQL *mysql, const char *table, const char
>*wild);
>
>and it is like lack of understanding on my part. Syntax is:
>
>if (mysql_list_fields( &mysql, "some table name", "some field name"))
>
>mysql_store_result and mysql_fetch_row follow but nothing is ever
>returned. If I replace the mysql_list_fields with:
>
>if (mysql_query(&mysql,"Describe some_table_name"))
>
>everything works. Where am I missing the boat here ?

Nothing.  It's just that the documentation for this function is unclear/
incorrect.  I just came to realize this myself a few weeks ago. :-(

The information that mysql_list_fields() returns about the columns is
returned in the result set *metadata*.  So what you should do is call
mysql_fetch_field() to retrieve the metadata for each column of the result
set.

Note that the max_length value will always be zero.

>
>Thanks
>
>Bill
>--
>
>William R. Mattil       | Statisticians define a lottery as a tax  
>Sr. System Aministrator | on not understanding mathematics
>(972) 399-4106          |

Thread
C API QuestionWilliam R. Mattil19 Feb
  • Re: C API QuestionPaul DuBois19 Feb
    • Re: C API QuestionPaul DuBois19 Feb