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
Sección 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 Sección 24.2.7.3, “mysql_stmt_attr_set()
”.
This function was added in MySQL 4.1.0.
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.
Ésta es una traducción del manual de referencia de MySQL, que puede encontrarse en dev.mysql.com. El manual de referencia original de MySQL está escrito en inglés, y esta traducción no necesariamente está tan actualizada como la versión original. Para cualquier sugerencia sobre la traducción y para señalar errores de cualquier tipo, no dude en dirigirse a mysql-es@vespito.com.