---
name: "mysql_real_query"
section: "3"
platform: "linux"
package: "mariadb"
version: "13.0.2-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/mysql_real_query"
---

# mysql\_real\_query(3)

### Name

mysql\_real\_query - execute a statement (binary safe)

### Synopsis

-

  ```
  #include <mysql.h>
  int mysql_real_query(MYSQL * mysql,
                       const char * query,
                       unsigned long length);
  ```

### Description

mysql\_real\_query() is the binary safe function for performing a statement on the database server.

### Parameter

- •

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

- •

  `query` - a string containing the statement to be performed.

- •

  `length` - length of the string.

### Notes

- •

  Contrary to the **[mysql\_query(3)](/mysql_query/3.md)** function, mysql\_real\_query is binary safe.

- •

  To determine if mysql\_real\_query returns a result set use the **[mysql\_num\_fields(3)](/mysql_num_fields/3.md)** function.

### Return value

Returns zero on success, otherwise non zero.

### See also

- •

  **[mysql\_query(3)](/mysql_query/3.md)**

- •

  **[mysql\_num\_fields(3)](/mysql_num_fields/3.md)**

- •

  **[mysql\_use\_result(3)](/mysql_use_result/3.md)**

- •

  **[mysql\_store\_result(3)](/mysql_store_result/3.md)**
