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) from queue;
Which would have showed you 10 so you should know you were doing something 
wrong.

Hopefully you understand the diff between binary and text now.

Michael D. Black
Senior Scientist
NG Information Systems
Advanced Analytics Directorate



________________________________________
From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Lynton Grice [lynton.gr...@logosworld.com]
Sent: Sunday, April 03, 2011 7:05 AM
To: General Discussion of SQLite Database
Subject: EXT :Re: [sqlite] sqlite3_bind_blob CHOPS off at first NULL char

Hi Michael,

When I mean't the ".output" I was meaning when I am using the SQLite
command line tool, I type in ".output result.txt" and then type "select
raw_stream_in from queue;" to stream that result to file.

The result file only contains character up until the first NUL.

Also, I know it is an image file (binary) I am just in the habit on
having .txt extensions when doing testing as all I care about is the raw
data....in fact I should just leave off the extension entirely.

I have submitted my full code in my previous message, thanks....please
let me know if you see anything?

I ran your test below, on my Linux machine and it still has the same
issue, meaning after the INSERT into SQLite I do a ".output result.txt"
and it still only shows "AB" in your example....

Here is the result of running od -xa result.txt

0000000    4241    000a
           A   B  nl
0000003

I must be doing something fundamentally wrong.....;-(

Thanks for the help so far, I really appreciate it.....

Lynton



On 03/04/2011 13:44, Black, Michael (IS) wrote:
> How are you trying to view the ouitput.result.txt (and I"ll note that it'sNOT 
> a text file...it's an image according to what you said.).  What's the size of 
> the file.
>
> And you should be able to post a COMPLETE example to show your testing.  What 
> you say you want to do has been done by many before so you're doing something 
> wrong but you aren't showing it.
>
> Create a small test file using this:
>
> #include<stdio.h>
> main()
> {
>    FILE *fp=fopen("test.dat","w");
>    char buf[10];
>    int i;
>    for(i=0;i<10;++i) buf[i]=i+'A';
>    buf[2] = 0;
>    fwrite(buf,1,sizeof(buf),fp);
>    fclose(fp);
> }
>
> If you're on Unix (or have Unix utils installed on Windows) you should see 
> this:
> ls -l test.dat
> -rw-r--r-- 1 mblack users 10 Apr  3 07:41 test.dat
> od -xa test.dat
> 0000000 4241 4400 4645 4847 4a49
>            A   B nul   D   E   F   G   H   I   J
> 0000012
> more test.dat
> AB
>
> Note the "more" stop at the first NUL character like it should.
>
> Then...use this file to test your stream, show us the resulting file with "od 
> -xa" and show us your code.
>
>
> Michael D. Black
> Senior Scientist
> NG Information Systems
> Advanced Analytics Directorate
>
>
>
> ________________________________________
> From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
> behalf of Lynton Grice [lynton.gr...@logosworld.com]
> Sent: Sunday, April 03, 2011 6:24 AM
> To: General Discussion of SQLite Database
> Subject: EXT :Re: [sqlite] sqlite3_bind_blob CHOPS off at first NULL char
>
>    Hi Paul,
>
> Yes, I am using fsize as the msg.num_bytes_in......
>
> When I run "SELECT Length(raw_stream_in) FROM test " I get the FULL
> 13035138 bytes....
>
> But it I read the "raw_stream_in" and sent it to a file (using ".output
> result.txt") I only see chars up until the FIRST NUL.....
>
> Any ideas?
>
> Thanks
>
> Lynton
>
>
>
> On 03/04/2011 12:52, Paul van Helden wrote:
>> Hi Lynton,
>>
>> What is the value of msg.num_bytes_in? Is it fsize?
>>
>> And what do you get when you SELECT Length(raw_stream_in) FROM test ?
>>
>> Regards,
>>
>> Paul.
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to