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

Scott> I guess I'm still finding the documentation confusing, then.  Section
Scott> 20.4.50 strongly implies that the way to distinguish whether a NULL result
Scott> from mysql_store_result() means there was an error, or an empty result set,
Scott> is to use mysql_num_fields().  But, you're indicating the mysql_num_fields()
Scott> will return 0 if there was either an error or an empty result set, so it
Scott> does _not_ provide a way to distinguish between those two cases.  Is the
Scott> documentation wrong, or am I just thinking about it the wrong way?

Scott> I can see how you might use mysql_num_fields() to distinguish between the
Scott> results of, say, and INSERT statement, and a SELECT statement that returned
Scott> no rows (in the first case, the result set is NULL, and mysql_num_fields()
Scott> returns 0.  In the second case, the result set is NULL, and
Scott> mysql_num_fields() returns the number of fields in the SELECT.  Or at least
Scott> that's what I'd expect to happen).

The manual was wrong, I am now updated it!.

Scott> [BTW, I'm just checking the error.  I don't _want_ to use mysql_num_fields()
Scott> instead, I just want to figure out if the documentation on this point is
Scott> wrong, or if I'm missing something.]

In this case, just check mysql_errno() !

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