.\"t .\" Automatically generated by Pandoc 2.5 .\" .TH "mysql_stmt_attr_set" "3" "" "Version 3.2.2" "MariaDB Connector/C" .hy .SS Name .PP mysql_stmt_attr_set \- Sets attribute of a statement .SS Synopsis .IP .nf \f[C] #include my_bool mysql_stmt_attr_set(MYSQL_STMT * stmt, enum enum_stmt_attr_type, const void * attr); \f[R] .fi .SS Description .PP Used to modify the behavior of a prepared statement. This function may be called multiple times to set several attributes. Returns zero on success, non\-zero on failure. .SS Parameters .IP \[bu] 2 \f[C]stmt\f[R] \- a statement handle, which was previously allocated by \f[B]mysql_stmt_init(3)\f[R]. .IP \[bu] 2 \f[C]enum_stmt_attr_type\f[R] \- the attribute that you want to set. See below. .IP \[bu] 2 \f[C]attr\f[R] \- the value to assign to the attribute .SS Attribute types .PP The \f[C]enum_stmt_attr_type\f[R] attribute can have one of the following values: .PP .TS tab(@); lw(23.3n) lw(23.3n) lw(23.3n). T{ Value T}@T{ Type T}@T{ Description T} _ T{ \f[C]STMT_ATTR_UPDATE_MAX_LENGTH\f[R] T}@T{ \f[C]my_bool *\f[R] T}@T{ If set to 1, \f[B]mysql_stmt_store_result(3)\f[R] will update the max_length value of MYSQL_FIELD structures. T} T{ \f[C]STMT_ATTR_CURSOR_TYPE\f[R] T}@T{ \f[C]unsigned long *\f[R] T}@T{ cursor type when \f[B]mysql_stmt_execute(3)\f[R] is invoked. Possible values are \f[C]CURSOR_TYPE_READ_ONLY\f[R] or default value \f[C]CURSOR_TYPE_NO_CURSOR\f[R]. T} T{ \f[C]STMT_ATTR_PREFETCH_ROWS\f[R] T}@T{ \f[C]unsigned long *\f[R] T}@T{ number of rows which will be prefetched. The default value is 1. T} T{ \f[C]STMT_ATTR_PREBIND_PARAMS\f[R] T}@T{ \f[C]unsigned int *\f[R] T}@T{ number of parameter markers when using \f[B]mariadb_stmt_execute_direct(3)\f[R]. If the statement handle is reused it will be reset automatically to the state after mysql_stmt_init(). This option was added in Connector/C 3.0 T} T{ \f[C]STMT_ATTR_ARRAY_SIZE\f[R] T}@T{ \f[C]unsigned int *\f[R] T}@T{ number of array elements. This option was added in Connector/C 3.0 and requires MariaDB 10.2 or later T} T{ \f[C]STMT_ATTR_ROW_SIZE\f[R] T}@T{ \f[C]size_t *\f[R] T}@T{ specifies size of a structure for row wise binding. This length must include space for all of the bound parameters and any padding of the structure or buffer to ensure that when the address of a bound parameter is incremented with the specified length, the result will point to the beginning of the same parameter in the next set of parameters. When using the sizeof operator in ANSI C, this behavior is guaranteed. If the value is zero column\-wise binding will be used (default). This option was added in Connector/C 3.0 and requires MariaDB 10.2 or later T} .TE .SS Notes .IP \[bu] 2 If you use the \f[C]MYSQL_STMT_ATTR_CURSOR_TYPE\f[R] option with \f[C]MYSQL_CURSOR_TYPE_READ_ONLY\f[R], a cursor is opened for the statement when you invoke \f[B]mysql_stmt_execute(3)\f[R]. If there is already an open cursor from a previous \f[B]mysql_stmt_execute(3)\f[R] call, it closes the cursor before opening a new one. \f[B]mysql_stmt_reset(3)\f[R] also closes any open cursor before preparing the statement for re\-execution. .IP \[bu] 2 If you open a cursor for a prepared statement it is unnecessary to call \f[B]mysql_stmt_store_result(3)\f[R]. .IP \[bu] 2 \f[B]mysql_stmt_free_result(3)\f[R] closes any open cursor. .SS See Also .IP \[bu] 2 \f[B]mariadb_stmt_execute_direct(3)\f[R] .IP \[bu] 2 \f[B]mysql_stmt_attr_get(3)\f[R]