Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to retrival BLOB field data in C API?

0 views
Skip to first unread message

Amani Young

unread,
Mar 31, 2000, 3:00:00 AM3/31/00
to
hi,all:
Is there anybody familiar with processing BLOB type data in C programming?
I know I should use mysql_escape_string() to convert BLOB data before
I insert it into database.But how can I retrival it from DB?
I cannot find it in manual:-(.

Thanks in advance.

Regards,
Amani


--
---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail mysql-th...@lists.mysql.com

To unsubscribe, send a message to:
<mysql-unsubscribe-myodbc=freebsd.csie...@lists.mysql.com>


Tonu Samuel

unread,
Mar 31, 2000, 3:00:00 AM3/31/00
to
Amani Young wrote:

> Is there anybody familiar with processing BLOB type data in C programming?
> I know I should use mysql_escape_string() to convert BLOB data before
> I insert it into database.But how can I retrival it from DB?
> I cannot find it in manual:-(.


Should be as usual.
http://web.mysql.com/php/manual.php3?section=node_462
maybe helps you.


BTW, we have new official consultant for Hong Kong -
http://www.innovator.com.hk

--
+----------------------------------------------------------------+
| TcX ____ __ _____ _____ ___ |
| /*/\*\/\*\ /*/ \*\ /*/ \*\ |*| Tõnu Samuel |
| /*/ /*/ /*/ \*\_ |*| |*||*| to...@mysql.com |
| /*/ /*/ /*/\*\/*/ \*\|*| |*||*| Tallinn, Estonia |
| /*/ /*/ /*/\*\_/*/ \*\_/*/ |*|____ |
| ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^ |
| /*/ \*\ Developers Team |
+----------------------------------------------------------------+

sin...@mysql.com

unread,
Mar 31, 2000, 3:00:00 AM3/31/00
to
On Thu, 30 Mar 2000, Amani Young wrote:
>hi,all:

>Is there anybody familiar with processing BLOB type data in C programming?
>I know I should use mysql_escape_string() to convert BLOB data before
>I insert it into database.But how can I retrival it from DB?
>I cannot find it in manual:-(.
>
>Thanks in advance.
>
>Regards,
>Amani

HI!

Although you save binary data in BLOB by escaping it's contents, binary data is
saved on disk and retreived thereof in it's original, binary, non-escaped
format.

So you retreive it in C as a simple char array, but you also should fetch it's
length from the result set, as it's length is not a '\0' delimited length of
the string, but it's original length, which should be fetched with
mysql_fetched_lenghts from the result set.

If you wish to use C++, you can look at the example cgi_image.cc in MySQL++.

Regards,

Sinisa

+----------------------------------------------------------------------+
| TcX ____ __ _____ _____ ___ == my...@tcx.se |
| /*/\*\/\*\ /*/ \*\ /*/ \*\ |*| Sinisa Milivojevic |
| /*/ /*/ /*/ \*\_ |*| |*||*| mailto:sin...@mysql.com |
| /*/ /*/ /*/\*\/*/ \*\|*| |*||*| Larnaka, Cyprus |


| /*/ /*/ /*/\*\_/*/ \*\_/*/ |*|____ |
| ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^ |
| /*/ \*\ Developers Team |

+----------------------------------------------------------------------+

sin...@mysql.com

unread,
Mar 31, 2000, 3:00:00 AM3/31/00
to
Amani Young writes:
> hi,all:
> Is there anybody familiar with processing BLOB type data in C programming?
> I know I should use mysql_escape_string() to convert BLOB data before
> I insert it into database.But how can I retrival it from DB?
> I cannot find it in manual:-(.
>
> Thanks in advance.
>
> Regards,
> Amani


Hi!

Although binary data are escaped prior to insertion, they are stored
and retrieved in their unescaped, binary format. All you have to do is
to fetch it's length from result set.

0 new messages