int mysql_stmt_store_result(MYSQL_STMT *stmt)
Description
You must call mysql_stmt_store_result() for
every statement that successfully produces a result set
(SELECT, SHOW,
DESCRIBE, EXPLAIN), and
only if you want to buffer the complete result set by the
client, so that the subsequent
mysql_stmt_fetch() call returns buffered
data.
It is unnecessary to call
mysql_stmt_store_result() for other
statements, but if you do, it does not harm or cause any notable
performance problem. You can detect whether the statement
produced a result set by checking if
mysql_stmt_result_metadata() returns
NULL. For more information, refer to
Section 24.2.7.22, “mysql_stmt_result_metadata()”.
Note: MySQL doesn't by default
calculate MYSQL_FIELD->max_length for all
columns in mysql_stmt_store_result() because
calculating this would slow down
mysql_stmt_store_result() considerably and
most applications doesn't need max_length. If
you want max_length to be updated, you can
call mysql_stmt_attr_set(MYSQL_STMT,
STMT_ATTR_UPDATE_MAX_LENGTH, &flag) to enable
this. See Section 24.2.7.3, “mysql_stmt_attr_set()”.
Return Values
Zero if the results are buffered successfully. Non-zero if an error occurred.
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.

User Comments
Add your own comment.