mysql\_stmt\_init(3) MariaDB Connector/C mysql\_stmt\_init(3)

## [Name](#Name)

mysql\_stmt\_init - Initializes a prepared statement handle

## [Synopsis](#Synopsis)

```
#include <mysql.h>
MYSQL_STMT * mysql_stmt_init(MYSQL * mysql);
    
```

## [Description](#Description)

Initializes and allocates memory for a prepared statement.

## [Parameter](#Parameter)

•

mysql - a mysql handle, which was previously allocated by [**mysql\_init(3)**](/man/os/mariadb-10.11/mysql_init.3) and connected by [**mysql\_real\_connect(3)**](/man/os/mariadb-10.11/mysql_real_connect.3).

## [Return value](#Return_value)

Returns a pointer to a MYSQL\_STMT structure or NULL if an error occurred.

## [Notes](#Notes)

•

Members of the MYSQL\_STMT structure are not intended for application use.

•

A statement handle which was allocated by mysql\_stmt\_init() needs to be freed with [**mysql\_stmt\_close(3)**](/man/os/mariadb-10.11/mysql_stmt_close.3).

•

Any subsequent calls to any mysql\_stmt function will fail until [**mysql\_stmt\_prepare(3)**](/man/os/mariadb-10.11/mysql_stmt_prepare.3) was called.

## [See Also](#See_Also)

•

[**mysql\_stmt\_close(3)**](/man/os/mariadb-10.11/mysql_stmt_close.3)

•

[**mysql\_stmt\_prepare(3)**](/man/os/mariadb-10.11/mysql_stmt_prepare.3)

Version 3.3.1

---

Document: mysql_stmt_init(3) from mariadb-10.11 10.11.9-r0 (Chainguard OS)
Source: https://github.com/MariaDB/server.git
