List:MySQL++« Previous MessageNext Message »
From:Ankur G35 Saxena Date:September 24 2006 2:16am
Subject:Reading Writting BLOB VARBINARY Q.
View as plain text  
Hi, I wanted to read and write a C++ structure to the DB. I went
through the example given and from this sinppet of code I got from the
user mannual, had a small Q.

I thought that std::string is a /0 delimited string, if so, how does
this work? If the binary data has a /0 inbetween somwhere in there,
wouldnt the string fill be shortened when pushed into the strbuf?

ostringstream strbuf;
char *read_buffer = new char[blen];
In.read(read_buffer, blen);
string fill(read_buffer, blen);
strbuf << "INSERT INTO " << MY_TABLE << " (" << MY_FIELD <<
")
VALUES(\"" << mysqlpp::escape << fill << "\")" << ends;

Thanks
Ankur
Thread
Reading Writting BLOB VARBINARY Q.Ankur G35 Saxena24 Sep
  • Re: Reading Writting BLOB VARBINARY Q.Bill K24 Sep
  • Re: Reading Writting BLOB VARBINARY Q.Warren Young26 Sep
    • Re: Reading Writting BLOB VARBINARY Q.Warren Young26 Sep
    • Re: Reading Writting BLOB VARBINARY Q.Bill K26 Sep