logo       

download a BLOB with mysql++: msg#00051

db.mysql.c++

Subject: download a BLOB with mysql++

I've got a problem to get a BLOB-Field in a std::string.

I get only the beginning of the data, until a NUL (0x00) comes. I think a
BLOB field may contain NUL.

in the mysql++ manual
http://www.mysql.com/documentation/mysql++/4_Tutorial.html#SECTION0315400000
0000000000
(single line ...)

there is this example
"4.6.1 Displaying images in HTML from BLOB column "

the line:
fwrite(row.raw_data(0),1,*jj,stdout);

should write a field result into stdout.

I looked at the definition of row::raw_data and found:
const char *raw_data(int i) const {return data[i].data();}

which meens for me that raw_data returns a char-array terminated by NUL.

I can save the BLOB in mysql-console whith the command-lines

SELECT Daten FROM `media_binaerdaten` WHERE FKMedia_ID=47 INTO OUTFILE
"C:/tmp/test.zip
-> get data WITH escapes, can be insertet again

SELECT Daten FROM `media_binaerdaten` WHERE FKMedia_ID=47 INTO DUMPFILE
"C:/tmp/test.zip
-> get raw data (WITHout) escapes, can be used as "binary", e.g. *.zip or
*.exe

where the second one is the one I want to do in my C++ Code.
I just can't use this, because I don't want to save my file on the server,
but on my client PC.

--
Franz Alt
"mysql++ newbie"
"C++ wannabe"





<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise