C API Function Descriptions
2189
mysql_store_result()
returns a null pointer if the statement didn't return a result set (for example,
if it was 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 whether
mysql_error()
returns a nonempty string,
mysql_errno()
returns nonzero, or
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.)
After you have called
mysql_store_result()
and gotten back a result that isn't a null pointer, you
can 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.
See
Section 20.6.13.1, “Why
mysql_store_result()
Sometimes Returns
NULL
After
mysql_query()
Returns Success”
.
Return Values
A
MYSQL_RES
result structure with the results.
NULL
(0) if an error occurred.
Errors
mysql_store_result()
resets
mysql_error()
and
mysql_errno()
if it succeeds.
•
CR_COMMANDS_OUT_OF_SYNC
[2942]
Commands were executed in an improper order.
•
CR_OUT_OF_MEMORY
[2942]
Out of memory.
•
CR_SERVER_GONE_ERROR
[2942]
The MySQL server has gone away.
•
CR_SERVER_LOST
[2942]
The connection to the server was lost during the query.
•
CR_UNKNOWN_ERROR
[2941]
An unknown error occurred.
20.6.6.70.
mysql_thread_id()
unsigned long mysql_thread_id(MYSQL *mysql)
Description
Returns the thread ID of the current connection. This value can be used as an argument to
mysql_kill()
to kill the thread.
If the connection is lost and you reconnect with
mysql_ping()
, the thread ID changes. This means
you should not get the thread ID and store it for later. You should get it when you need it.
Note
This function does not work correctly if thread IDs become larger than
32 bits, which can occur on some systems. To avoid problems with
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...