int mysql_stmt_attr_set(MYSQL_STMT *stmt, enum
enum_stmt_attr_type option, const void *arg)
Description
Can be used to set affect behavior for a statement. This function may be called multiple times to set several options.
The option
argument is the option that you
want to set; the arg
argument is the value
for the option. If the option is an integer, then
arg
should point to the value of the
integer.
Possible option
values:
Option | Argument Type | Function |
STMT_ATTR_UPDATE_MAX_LENGTH |
my_bool * |
If set to 1: Update metadata
MYSQL_FIELD->max_length in
mysql_stmt_store_result() . |
STMT_ATTR_CURSOR_TYPE |
unsigned long * |
Type of cursor to open for statement when
mysql_stmt_execute() is invoked.
*arg can be
CURSOR_TYPE_NO_CURSOR (the default)
or CURSOR_TYPE_READ_ONLY . |
STMT_ATTR_PREFETCH_ROWS |
unsigned long * |
Number of rows to fetch from server at a time when using a cursor.
*arg can be in the range from 1 to
the maximum value of unsigned long .
The default is 1. |
If you use the STMT_ATTR_CURSOR_TYPE
option
with CURSOR_TYPE_READ_ONLY
, a cursor is
opened for the statement when you invoke
mysql_stmt_execute()
. If there is already
an open cursor from a previous
mysql_stmt_execute()
call, it closes the
cursor before opening a new one.
mysql_stmt_reset()
also closes any open
cursor before preparing the statement for re-execution.
mysql_stmt_free_result()
closes any open
cursor.
This function was added in MySQL 4.1.2. The
STMT_ATTR_CURSOR_TYPE
option was added in
MySQL 5.0.2. The STMT_ATTR_PREFETCH_ROWS
option was added in MySQL 5.0.6.
Return Values
0
if okay. Non-zero if
option
is unknown.
Errors
None.
É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.