List:General Discussion« Previous MessageNext Message »
From:Martin Ramsch Date:September 1 1999 11:46am
Subject:Re: mysql_num_fields() vs empty results from mysql_store_result().
View as plain text  
On Tue, 1999-08-31 14:59:43 -0700, Scott Hess wrote:
> Manual section 20.4.50 Why is it that after mysql_query() returns success,
> mysql_store_result() sometimes returns NULL?' states:

A NULL return value means an error.  I don't have a clue what kind of
errors could happen (network time-out ...?).

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

Well, you just wouldn't call mysql_num_fields() then!

Only if everything went okay, checking mysql_num_fields() can help to
distinguish between an empty result set which possibly could have rows
(num of fields > 0) but happens to be empty, and an empty result set
which only can be empty (like with UPDATE or DELETE).

I've never used the C API, so this just is my reading of the words ...

Regards,
  Martin
-- 
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26  E4 EC 80 58 7B 31 3A D7
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