Documentation Home
MySQL 9.3 C API Developer Guide
Download this Manual
PDF (US Ltr) - 1.4Mb
PDF (A4) - 1.4Mb


MySQL 9.3 C API Developer Guide  / ...  / Writing C API-Based Client Applications  / Using C API Features  /  NULL mysql_store_result() Return After mysql_query() Success

3.6.9 NULL mysql_store_result() Return After mysql_query() Success

It is possible formysql_store_result() to returnNULL following a successful call to the server usingmysql_real_query() ormysql_query(). When this happens, it means one of the following conditions occurred:

  • There was amalloc() failure (for example, if the result set was too large).

  • The data could not be read (an error occurred on the connection).

  • The query returned no data (for example, it was anINSERT,UPDATE, orDELETE).

You can always check whether the statement should have produced a nonempty result by callingmysql_field_count(). Ifmysql_field_count() returns zero, the result is empty and the last query was a statement that does not return values (for example, anINSERT or aDELETE). Ifmysql_field_count() returns a nonzero value, the statement should have produced a nonempty result. See the description of themysql_field_count() function for an example.

You can test for an error by callingmysql_error() ormysql_errno().