mysql_stmt_attr_set(3)

Sets attribute of a statement #include f[B] f[R] my_bool mysql_stmt_attr_set(MYSQL_STMT * stmt, f[B]

Section 3 libmariadb-dev bookworm source

Description

mysql_stmt_attr_set

Name

mysql_stmt_attr_set - Sets attribute of a statement

Synopsis

#include <mysql.h>

my_bool mysql_stmt_attr_set(MYSQL_STMT * stmt,
enum
enum_stmt_attr_type,
const void * attr);

Description

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.

Parameters

stmt - a statement handle, which was previously allocated by mysql_stmt_init(3).

enum_stmt_attr_type - the attribute that you want to set. See below.

attr - the value to assign to the attribute

Attribute types

The enum_stmt_attr_type attribute can have one of the following values:

Image grohtml-78211-1.png

Notes

If you use the MYSQL_STMT_ATTR_CURSOR_TYPE option with MYSQL_CURSOR_TYPE_READ_ONLY, a cursor is opened for the statement when you invoke mysql_stmt_execute(3). If there is already an open cursor from a previous mysql_stmt_execute(3) call, it closes the cursor before opening a new one. mysql_stmt_reset(3) also closes any open cursor before preparing the statement for re-execution.

If you open a cursor for a prepared statement it is unnecessary to call mysql_stmt_store_result(3).

mysql_stmt_free_result(3) closes any open cursor.

See Also

mariadb_stmt_execute_direct(3)

mysql_stmt_attr_get(3)