mysql\_hex\_string(3) MariaDB Connector/C mysql\_hex\_string(3)

## [Name](#Name)

mysql\_hex\_string - create a hexadecimal string

## [Synopsis](#Synopsis)

```
#include <mysql.h>
unsigned long mysql_hex_string(char * to,


                               const char * from,


                               unsigned long len);
    
```

## [Description](#Description)

This function is used to create a hexadecimal string which can be used in SQL statements. e.g. INSERT INTO my\_blob VALUES(X'A0E1CD').

## [Parameter](#Parameter)

•

to - result buffer

•

from - the string which will be encoded

•

len - length of the string (from)

## [Notes](#Notes)

•

The size of the buffer for the encoded string must be 2 * length + 1.

•

The encoded string does not contain a leading X’.

## [Return value](#Return_value)

Returns the length of the encoded string without the trailing null character.

## [See also](#See_also)

•

[**mysql\_real\_escape\_string(3)**](/man/enterprise-packages/mariadb-10.11/mysql_real_escape_string.3)

Version 3.3

---

Document: mysql_hex_string(3) from mariadb-10.11 10.11.19-r5 (Chainguard OS)
Source: https://github.com/MariaDB/server.git
