Dan: zipfile.c FYI data column quirk

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Dan: zipfile.c FYI data column quirk

petern
sqlite> load zipfile.so

sqlite> SELECT * FROM zipfile('rows.zip');
name,mode,mtime,sz,data,method
row1.txt,33204,1514396814,22,"text of file row1.txt
",0
row2.txt,33204,1514396416,22,"text of file row2.txt
",0

--Extra newline is introduced for some reason.
--Added explicit newline to end of row1.txt, then got this:

sqlite> SELECT * FROM zipfile('rows.zip');
name,mode,mtime,sz,data,method
row1.txt,33204,1514397988,23,"text of file row1.txt

",0
row2.txt,33204,1514396416,22,"text of file row2.txt
",0

#testfile
$ zip -0 rows.zip row1.txt row2.txt

$ zipinfo rows.zip
Archive:  rows.zip
Zip file size: 355 bytes, number of entries: 2
-rw-rw-r--  3.0 unx       23 bx stor 17-Dec-27 11:55 row1.txt
-rw-rw-r--  3.0 unx       22 bx stor 17-Dec-27 09:40 row2.txt
2 files, 45 bytes uncompressed, 45 bytes compressed:  0.0%

Perhaps newline is a quirk of zip itself.  String "text of file row1.txt"
is 21 characters.

Peter
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Dan: zipfile.c FYI data column quirk

Simon Slavin-3
On 27 Dec 2017, at 8:20pm, petern <[hidden email]> wrote:

> --Added explicit newline to end of row1.txt

How.  What did you do ?  Was it a NL or a CR ?  Or done as Unicode ?

Simon.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Dan: zipfile.c FYI data column quirk

Dan Kennedy-4
In reply to this post by petern
On 12/28/2017 03:20 AM, petern wrote:

> sqlite> load zipfile.so
>
> sqlite> SELECT * FROM zipfile('rows.zip');
> name,mode,mtime,sz,data,method
> row1.txt,33204,1514396814,22,"text of file row1.txt
> ",0
> row2.txt,33204,1514396416,22,"text of file row2.txt
> ",0
>
> --Extra newline is introduced for some reason.
> --Added explicit newline to end of row1.txt, then got this:
>
> sqlite> SELECT * FROM zipfile('rows.zip');
> name,mode,mtime,sz,data,method
> row1.txt,33204,1514397988,23,"text of file row1.txt
>
> ",0
> row2.txt,33204,1514396416,22,"text of file row2.txt
> ",0
>
> #testfile
> $ zip -0 rows.zip row1.txt row2.txt
>
> $ zipinfo rows.zip
> Archive:  rows.zip
> Zip file size: 355 bytes, number of entries: 2
> -rw-rw-r--  3.0 unx       23 bx stor 17-Dec-27 11:55 row1.txt
> -rw-rw-r--  3.0 unx       22 bx stor 17-Dec-27 09:40 row2.txt
> 2 files, 45 bytes uncompressed, 45 bytes compressed:  0.0%

What does this command return?

   xxd row2.txt

Thanks,
Dan.


_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Dan: zipfile.c FYI data column quirk

Peter da Silva
In reply to this post by petern
I don’t see what the problem is, do you not expect a newline at the end of the line in a file?

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Dan: zipfile.c FYI data column quirk

petern
In reply to this post by Dan Kennedy-4
Hi Dan. $ xxd row2.txt
0000000: 7465 7874 206f 6620 6669 6c65 2072 6f77  text of file row
0000010: 322e 7478 740a                           2.txt.

0a.  Normally dependable Gedit, used for such tinkering, is putting in that
linefeed.  From my regular IDE I also see it.
Sorry for the possible false alarm.  Good news is the new extension
compiles easy and works well.
Thanks for everything.
Peter







On Wed, Dec 27, 2017 at 12:40 PM, Dan Kennedy <[hidden email]> wrote:

> On 12/28/2017 03:20 AM, petern wrote:
>
>> sqlite> load zipfile.so
>>
>> sqlite> SELECT * FROM zipfile('rows.zip');
>> name,mode,mtime,sz,data,method
>> row1.txt,33204,1514396814,22,"text of file row1.txt
>> ",0
>> row2.txt,33204,1514396416,22,"text of file row2.txt
>> ",0
>>
>> --Extra newline is introduced for some reason.
>> --Added explicit newline to end of row1.txt, then got this:
>>
>> sqlite> SELECT * FROM zipfile('rows.zip');
>> name,mode,mtime,sz,data,method
>> row1.txt,33204,1514397988,23,"text of file row1.txt
>>
>> ",0
>> row2.txt,33204,1514396416,22,"text of file row2.txt
>> ",0
>>
>> #testfile
>> $ zip -0 rows.zip row1.txt row2.txt
>>
>> $ zipinfo rows.zip
>> Archive:  rows.zip
>> Zip file size: 355 bytes, number of entries: 2
>> -rw-rw-r--  3.0 unx       23 bx stor 17-Dec-27 11:55 row1.txt
>> -rw-rw-r--  3.0 unx       22 bx stor 17-Dec-27 09:40 row2.txt
>> 2 files, 45 bytes uncompressed, 45 bytes compressed:  0.0%
>>
>
> What does this command return?
>
>   xxd row2.txt
>
> Thanks,
> Dan.
>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users