LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 09-17-2009, 09:23 AM   #1
twwwater
Member
 
Registered: Nov 2008
Posts: 113
Blog Entries: 1

Rep: Reputation: 15
Unhappy 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 (taowuwen@gmail.com)

Last edited by twwwater; 09-17-2009 at 08:44 PM.
 
Old 09-17-2009, 10:34 AM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,159

Rep: Reputation: 258Reputation: 258Reputation: 258
Hi

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.

http://dev.mysql.com/doc/refman/5.0/...pe-string.html

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:

http://dev.mysql.com/doc/refman/5.0/...long-data.html
 
Old 09-17-2009, 09:17 PM   #3
twwwater
Member
 
Registered: Nov 2008
Posts: 113
Blog Entries: 1

Original Poster
Rep: Reputation: 15
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!
 
  


Reply

Tags
mysql


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Stop the blob LXer Syndicated Linux News 3 06-26-2008 06:50 AM
OpenGL compatable non-blob vid cards dgandhi Linux - Hardware 8 08-27-2007 07:25 PM
LXer: This week at LWN: Resisting the binary blob LXer Syndicated Linux News 0 11-19-2006 08:54 PM
Can not insert word file into mysql table (in blob field) prabhatsoni Linux - Software 2 07-21-2006 06:01 AM
PHP+SQL : formatting text for presentation in a blob caged Programming 2 11-24-2004 06:48 PM


All times are GMT -5. The time now is 01:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration