23.8.7.34 mysql_hex_string()

Description

The string in the from argument is encoded in
hexadecimal format, with each character encoded as two
hexadecimal digits. The result is placed in the
to argument, followed by a terminating null
byte.

The string pointed to by from must be
length bytes long. You must allocate the
to buffer to be at least
length*2+1 bytes long. When
mysql_hex_string() returns, the
contents of to is a null-terminated string.
The return value is the length of the encoded string, not
including the terminating null byte.

The return value can be placed into an SQL statement using
either 0xvalue or
X'value' format.
However, the return value does not include the
0x or X'...'. The caller
must supply whichever of those is desired.

Errors

User Comments

Inside your description:The return value is the length of the encoded string, not including the terminating null character.<--This says the return value of the function is the "length of the encoded string"

Inside the next paragraph:The return value can be placed into an SQL statement using either 0xvalue or X'value' format.<--Is this return value the same one as which mention in the preceding paragraph? I am being confused. If it is the same, that means my SQL statment will be something like "insert blahblahblah value (0xlengthbeingreturn). Is this what you mean? Or what you really saying is 0xToString?