mysql\_stmt\_attr\_get(3) MariaDB Connector/C mysql\_stmt\_attr\_get(3)

## [Name](#Name)

mysql\_stmt\_attr\_get - Gets the current value of a statement attribute

## [Synopsis](#Synopsis)

```
#include <mysql.h>
my_bool mysql_stmt_attr_get(MYSQL_STMT * stmt,


                            enum enum_stmt_attr_type,


                            void * attr);
    
```

## [Description](#Description)

Gets the current value of a statement attribute. Returns zero on success, non zero on failure.

## [Parameter](#Parameter)

•

stmt - a statement handle, which was previously allocated by [**mysql\_stmt\_init(3)**](/man/os/mariadb-11.8/mysql_stmt_init.3).

•

enum\_stmt\_attr\_type - attribute. See below.

•

attr - pointer to a variable, which will contain the attribute value.

## [Attribute types](#Attribute_types)

The enum\_stmt\_attr\_type parameter has the following possible values:

Value Type Description STMT\_ATTR\_UPDATE\_MAX\_LENGTH my\_bool * Indicates if [**mysql\_stmt\_store\_result(3)**](/man/os/mariadb-11.8/mysql_stmt_store_result.3) will update the max\_length value of MYSQL\_FIELD structures. STMT\_ATTR\_CURSOR\_TYPE unsigned long * Possible values are CURSOR\_TYPE\_READ\_ONLY or default value CURSOR\_TYPE\_NO\_CURSOR. STMT\_ATTR\_PREFETCH\_ROWS unsigned long * Number of rows which will be prefetched. The default value is 1. STMT\_ATTR\_PREBIND\_PARAMS unsigned int * Number of parameters used for [**mariadb\_stmt\_execute\_direct(3)**](/man/os/mariadb-11.8/mariadb_stmt_execute_direct.3) STMT\_ATTR\_STATE enum mysql\_stmt\_state * Status of prepared statement. Possible values are defined in enum mysql\_stmt\_state. This option was added in MariaDB Connector/C 3.1.0

## [Notes](#Notes)

•

Setting the number of prefetched rows will work only for read only cursors.

## [See Also](#See_Also)

•

[**mysql\_stmt\_attr\_set(3)**](/man/os/mariadb-11.8/mysql_stmt_attr_set.3)

Version 3.4

---

Document: mysql_stmt_attr_get(3) from mariadb-11.8 11.8.3-r0 (Chainguard OS)
Source: https://github.com/MariaDB/server.git
