Re: [sqlite] :Re: sqlite3_bind_blob CHOPS off at first NULL char

2011-04-03 Thread Lynton Grice
Great, thanksI have made the change as you suggested;-) memcpy(msg->raw_stream_in, sqlite3_column_blob(stmt, 2), len); Lynton On 03/04/2011 15:25, Paul van Helden wrote: > On Sun, Apr 3, 2011 at 3:15 PM, Lynton > Gricewrote: > >> Thanks, issue solved with the following: >> >> len =

Re: [sqlite] :Re: sqlite3_bind_blob CHOPS off at first NULL char

2011-04-03 Thread Paul van Helden
On Sun, Apr 3, 2011 at 3:15 PM, Lynton Grice wrote: > Thanks, issue solved with the following: > > len = sqlite3_column_bytes(stmt,2); > memcpy(msg->raw_stream_in, sqlite3_column_text(stmt, 2), len); > > sqlite3_column_blob is a better function to use. sqlite3_column_text will add a zero characte

Re: [sqlite] :Re: sqlite3_bind_blob CHOPS off at first NULL char

2011-04-03 Thread Igor Tandetnik
Lynton Grice wrote: > Thanks, issue solved with the following: > > len = sqlite3_column_bytes(stmt,2); > memcpy(msg->raw_stream_in, sqlite3_column_text(stmt, 2), len); Actually, you are supposed to use sqlite3_column_blob for binary data. -- Igor Tandetnik

Re: [sqlite] :Re: sqlite3_bind_blob CHOPS off at first NULL char

2011-04-03 Thread Lynton Grice
Thanks, issue solved with the following: len = sqlite3_column_bytes(stmt,2); memcpy(msg->raw_stream_in, sqlite3_column_text(stmt, 2), len); Thanks to everyone for your help ;-) Lynton On 03/04/2011 14:52, Paul van Helden wrote: > On Sun, Apr 3, 2011 at 2:46 PM, Lynton > Gricewrote: > >> cha

Re: [sqlite] :Re: sqlite3_bind_blob CHOPS off at first NULL char

2011-04-03 Thread Paul van Helden
On Sun, Apr 3, 2011 at 2:46 PM, Lynton Grice wrote: > char* from SQLite? You say that SELECT treats message as TEXT which is > fine, but then how can I get the FULL payload back into a char* so that > I can write it to a file? > > SELECT doesn't treat the BLOB as text, the command line client (and

Re: [sqlite] :Re: sqlite3_bind_blob CHOPS off at first NULL char

2011-04-03 Thread Lynton Grice
Hi Michael, Thanks for you feedback, I must say I have learnt something for sure.BUT I still face the problem on how to I READ the BLOB into a char* from SQLite? You say that SELECT treats message as TEXT which is fine, but then how can I get the FULL payload back into a char* so that I

[sqlite] :Re: sqlite3_bind_blob CHOPS off at first NULL char

2011-04-03 Thread Black, Michael (IS)
That she blows!!! (to quote Popeye). Your select treats the message as text..and properly truncates at the first nul character. Since it's actuallly binary and NOT text use this: select hex(raw_stream_in) from queue; 4142004445464748494A You also forgot to do select length(raw_stream_in) fro