mysql_hex_string — Converts a string into hexadecimal format

unsigned long mysql_hex_string(char * to,
                               const char * from,
                               unsigned long len);

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')

Parameters

to

Result buffer

from

The string which will be encodeded

long

Length of the string (from)

Return value

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

[Note]

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

The encoded string does not contain a leading X'.

See also

mysql_real_escape_string()