I had a similat problem in a past.
See if it helps:
2009/11/26 Sebastián Salazar Molina <ssalazar@stripped>:
> I need to store binary data in mysql with mysql++, I tried going to
> hex and escaped in a string, and then make a cast( string AS
> BINARY), but It isn't the result that I want.
> How do I store an unsigned char * array, with mysql++
> PD: Sorry for my bad english.
> MySQL++ Mailing List
> For list archives: http://lists.mysql.com/plusplus
> To unsubscribe: http://lists.mysql.com/plusplus?unsub=1