-   Programming (
-   -   how can I access blob in mysql by C ? (

twwwater 09-17-2009 08:23 AM

how can I access blob in mysql by C ?
Hi, all

well, I was working on a problem, and I googled for almost 2 or 3 days so far, but got nothing. en........., I want to stored the pictures into mysql, and I just do not know how to access this bother me so much's "blob". and I wonder anyone if could be kind enough to help me !

anyone could tell me how can I access the blob by pure C code or it would be much better if anyone could show me the source code or example ?

thanks in advanced !!!

twwwater (

Guttorm 09-17-2009 09:34 AM


The easiest way is to treat them as regular strings. Just use mysql_real_escape_string to escape the characters like '\0' and you'll be fine.

But if the images are very big, the queries can be too long. I think the only way is to use prepared statements and mysql_stmt_send_long_data. This page has an example:

twwwater 09-17-2009 08:17 PM

hehe!!! Thank you so much !!! it works ! at first something went wrong, and I got some errors, but finally, it worked !!! thank you once again!

All times are GMT -5. The time now is 12:46 AM.