List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:September 1 1999 10:58am
Subject:mysql_num_fields() vs empty results from mysql_store_result().
View as plain text  
>>>>> "Scott" == Scott Hess <scott@stripped> writes:

Scott> Manual section 20.4.50 Why is it that after mysql_query() returns success,
Scott> mysql_store_result() sometimes returns NULL?' states:

Scott> "You can always check whether or not the statement should have produced a
Scott> non-empty result by calling mysql_num_fields(). If mysql_num_fields()
Scott> returns zero, the result is empty and the last query was a statement that
Scott> does not return values (for example, an INSERT or a DELETE). If
Scott> mysql_num_fields() returns a non-zero value, the statement should have
Scott> produced a non-empty result. See the description of the mysql_num_fields()
Scott> function for an example."


Scott> I'm unable to reconcile this with the API functions.  Since
Scott> mysql_num_fields() accepts a MYSQL_RES parameter, if mysql_store_result()
Scott> returns a NULL MYSQL_RES, then what value would you pass to
Scott> mysql_num_fields() in order to get the zero return?

Scott> Later,
Scott> scott

Hi!

The mysql_num_fields(MYSQL_RES *) should be mysql_field_count(MYSQL *)

In MySQL 3.22 mysql_num_fields is a macro that will work both for the
MYSQL and MYSQL_RES structure.

Starting with MySQL 3.23 and MYSQL 3.22.25 one should use
mysql_field_count instead!

Regards,
Monty
Thread
perl DBI syntex.Mike31 Aug
  • perl DBI syntex.Jani Tolonen31 Aug
RE: perl DBI syntex.Darren L Sweeney31 Aug
  • Re: perl DBI syntex.Mike31 Aug
    • Re: perl DBI syntex.Bill Gerrard31 Aug
      • mysql_num_fields() vs empty results from mysql_store_result().Scott Hess1 Sep
        • Re: mysql_num_fields() vs empty results from mysql_store_result().Martin Ramsch1 Sep
        • mysql_num_fields() vs empty results from mysql_store_result().sinisa1 Sep
        • mysql_num_fields() vs empty results from mysql_store_result().Michael Widenius1 Sep
      • Re: mysql_num_fields() vs empty results from mysql_store_result().Scott Hess1 Sep
        • Re: mysql_num_fields() vs empty results from mysql_store_result().Michael Widenius2 Sep
      • Re: mysql_num_fields() vs empty results from mysql_store_result().Scott Hess2 Sep
        • Re: mysql_num_fields() vs empty results from mysql_store_result().Michael Widenius2 Sep
RE: perl DBI syntex.Darren L Sweeney31 Aug