On 10/30/18, Stephen Chrzanowski <pontia...@gmail.com> wrote:
>
> Second, shouldn't SQLite only consider reading a file if the file size is
> zero or if the appropriate SQLite header is found, and completely ignore
> the file extension?

The core SQLite library understands SQLite database files only.
Reading and writing of ZIP archives and other formats is handled by
extensions.  Those extensions are built into the CLI.  The following
discussion applies to the CLI, not to the core SQLite library.

The file extension is ignored, except when creating a new file, in
which case the presence of the ".zip" extension will force it to be a
ZIP archive if no other mode is specified.

When opening an existing database file, the followings rules apply in
the order shown:

(1) Honor command-line switches such as --zip or --append.

(2) If the file begins with the SQLite header, then treat it as an
ordinary SQLite database file.

(3) If the file ends with the ZIP EOCD record, treat it as a ZIP archive.

(4) If the file ends with the AppendVFS tail record, treat it as an
AppendVFS file.

(5) Otherwise treat the file as an ordinary SQLite database.

The bug was that step (2) was omitted.  That bug is fixed with
check-in https://www.sqlite.org/src/info/7989bbda70a24611

-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to