(mysql.info.gz) mysql_store_result
Info Catalog
(mysql.info.gz) mysql_stat
(mysql.info.gz) C API functions
(mysql.info.gz) mysql_thread_id
22.2.3.58 `mysql_store_result()'
................................
`MYSQL_RES *mysql_store_result(MYSQL *mysql)'
Description
...........
You must call `mysql_store_result()' or `mysql_use_result()' for every
query that successfully retrieves data (`SELECT', `SHOW', `DESCRIBE',
`EXPLAIN', `CHECK TABLE', and so forth).
You don't have to call `mysql_store_result()' or `mysql_use_result()'
for other queries, but it will not do any harm or cause any notable
performance if you call `mysql_store_result()' in all cases. You can
detect if the query didn't have a result set by checking if
`mysql_store_result()' returns 0 (more about this later on).
If you want to know whether the query should return a result set, you
can use `mysql_field_count()' to check for this.
`mysql_field_count()' mysql_field_count.
`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.
`mysql_store_result()' returns a null pointer if the query didn't return
a result set (if the query was, for example, an `INSERT' statement).
`mysql_store_result()' also returns a null pointer if reading of the
result set failed. You can check whether an error occurred by checking
if `mysql_error()' returns a non-empty string, if `mysql_errno()'
returns non-zero, or if `mysql_field_count()' returns zero.
An empty result set is returned if there are no rows returned. (An
empty result set differs from a null pointer as a return value.)
Once you have called `mysql_store_result()' and got a result back that
isn't a null pointer, 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()' NULL mysql_store_result.
Return Values
.............
A `MYSQL_RES' result structure with the results. `NULL' if an error
occurred.
Errors
......
`mysql_store_result()' resets `mysql_error()' and `mysql_errno()' if it
succeeds.
`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.
Info Catalog
(mysql.info.gz) mysql_stat
(mysql.info.gz) C API functions
(mysql.info.gz) mysql_thread_id
automatically generated byinfo2html