20.4.48 mysql_store_result()

MYSQL_RES *mysql_store_result(MYSQL *mysql)

20.4.48.1 Description

You must call mysql_store_result() or mysql_use_result() for every query which successfully retrieves data (SELECT, SHOW, DESCRIBE, EXPLAIN).

mysql_store_result() reads the entire result of a query to the client, allocates a MYSQL_RES structure, and places the result into this structure.

An empty result set is returned if there are no rows returned. (An empty result set differs from a NULL return value.)

Once you have called mysql_store_result(), you may call mysql_num_rows() to find out how many rows are in the result set.

You can call mysql_fetch_row() to fetch rows from the result set, or mysql_row_seek() and mysql_row_tell() to obtain or set the current row position within the result set.

You must call mysql_free_result() once you are done with the result set.

NULL mysql_store_result().

20.4.48.2 Return values

A MYSQL_RES result structure with the results. NULL if an error occurred.

20.4.48.3 Errors

CR_COMMANDS_OUT_OF_SYNC
Commands were executed in an improper order.
CR_OUT_OF_MEMORY
Out of memory.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.