What is the zlib compression level used by sqlar?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

What is the zlib compression level used by sqlar?

Peng Yu
It is not clear what level of zlib compression is used in sqlar. Does
anybody know?

https://sqlite.org/sqlar/doc/trunk/README.md

Is the following python code guarantee to generate a file that conform
to the sqlar format standard? (Note that I deliberately set the
timestamp and permission to zero as I don't care about them.)

```
import sqlite3
conn=sqlite3.connect(sys.argv[1])
c=conn.cursor()
import zlib
data = sys.stdin.read()
c.execute('REPLACE INTO sqlar VALUES(?, ?, ?, ?, ?)', [sys.argv[2], 0,
0, len(data), buffer(zlib.compress(data))])
conn.commit()
```

The content is taken from stdin and the sqlar file is in argv[1] and
the path in the archive is in argv[2].

--
Regards,
Peng
_______________________________________________
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: What is the zlib compression level used by sqlar?

Richard Hipp-3
On 8/29/19, Peng Yu <[hidden email]> wrote:
> It is not clear what level of zlib compression is used in sqlar. Does
> anybody know?
>
> https://sqlite.org/sqlar/doc/trunk/README.md
>
> Is the following python code guarantee to generate a file that conform
> to the sqlar format standard? (Note that I deliberately set the
> timestamp and permission to zero as I don't care about them.)

I don't think the compression level matters as far as the file format
is concerned.  A higher compression level simply means that the
compressor tries harder to find repeated patterns.  The same decoder
works regardless of the compression level.
--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users