533
This function is used to create HEX string that you
534
can use in a SQL statement in of the either ways:
535
INSERT INTO blob_column VALUES (0xAABBCC); (any DRIZZLE version)
536
INSERT INTO blob_column VALUES (X'AABBCC');
538
The string in "from" is encoded to a HEX string.
539
The result is placed in "to" and a terminating null byte is appended.
541
The string pointed to by "from" must be "length" bytes long.
542
You must allocate the "to" buffer to be at least length*2+1 bytes long.
543
Each character needs two bytes, and you need room for the terminating
544
null byte. When drizzle_hex_string() returns, the contents of "to" will
545
be a null-terminated string. The return value is the length of the
546
encoded string, not including the terminating null character. The return value does not contain any leading 0x or a leading X' and
547
trailing '. The caller must supply whichever of those is desired.
551
drizzle_hex_string(char *to, const char *from, uint32_t length)
556
for (end= from + length; from < end; from++)
558
*to++= _dig_vec_upper[((unsigned char) *from) >> 4];
559
*to++= _dig_vec_upper[((unsigned char) *from) & 0x0F];
562
return (uint32_t) (to-to0);
566
533
Add escape characters to a string (blob?) to make it suitable for a insert
567
534
to should at least have place for length*2+1 chars
568
535
Returns the length of the to string