SQLite Archiver (Windows)
Check-in [d8653ef491]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
SHA1:d8653ef49178c25174e5b705ef0bd1a9e3505bf9
Date: 2014-05-22 11:54:53
User: drh
Comment:Change the name from "SFA" to "SQLAR" since it turns out that SFA is also the name of a French sewage treatment appliance.
Tags And Properties
Context
2014-06-02 15:50
[ff0460752a] Update the built-in SQLite to the latest 3.8.5 beta from upstream. (user: drh, tags: trunk)
2014-05-22 11:54
[d8653ef491] Change the name from "SFA" to "SQLAR" since it turns out that SFA is also the name of a French sewage treatment appliance. (user: drh, tags: trunk)
2014-05-15 11:55
[3d0e7db437] Change the title on the README.md page. (user: drh, tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Makefile.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/make

CC = gcc -g -I.
ZLIB = -lz
SQLITE_OPT = -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION

all: sfa
	

sfa:	sfa.c sqlite3.o
	$(CC) -o sfa sfa.c sqlite3.o $(ZLIB)

sqlite3.o:	sqlite3.c sqlite3.h
	$(CC) -c sqlite3.c $(SQLITE_OPT) sqlite3.c






|


|
|



1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/make

CC = gcc -g -I.
ZLIB = -lz
SQLITE_OPT = -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION

all: sqlar
	

sqlar:	sqlar.c sqlite3.o
	$(CC) -o sqlar sqlar.c sqlite3.o $(ZLIB)

sqlite3.o:	sqlite3.c sqlite3.h
	$(CC) -c sqlite3.c $(SQLITE_OPT) sqlite3.c

Changes to README.md.

1
2
3
4
5
6
7
8
9
10
11
..
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<h1 align="center">SFA - SQLite File Archiver</h1>

This repository contains sources for a proof-of-concept "SQLite File Archiver"
program.  This program (named "sfa") operates much like "zip", except that
the compressed archive it builds is stored in an SQLite database instead
of a ZIP archive.

The motivation for this is to see how much larger an SQLite database file
is compared to a ZIP archive containing the same content.  The answer depends
on the filenames, but 2% seems to be a reasonable guess.  In other words,
storing files as compressed blobs in an SQLite database file results in a 
................................................................................
On unix, just type "make".  The SQLite sources are included.  The zlib
compression library is needed to build.

## Usage

To create an archive:

        sfa ARCHIVE FILES...

All files named in FILES... will be added to the archive.  If another file
with the same name already exists in the archive, it is replaced.  If any
of the named FILES is a directory, that directory is scanned recursively.

To see the contents of an archive:

        sfa -l ARCHIVE

To extract the contents of an archive:

        sfa -x ARCHIVE [FILES...]

If a FILES argument is provided, then only the named files are extracted.
Without a FILES argument, all files are extracted.

All commands can be supplemented with -v for verbose output. For example:

        sfa -v ARCHIVE FILES..
        sfa -lv ARCHIVE
        sfa -xv ARCHIVE

File are normally compressed using zlib prior to being stored as BLOBs in
the database.  However, if the file is incompressible or if the -n option
is used on the command-line, then the file is stored in the database exactly
as it appears on disk, without compression.
    
## Storage

The database schema looks like this:

        CREATE TABLE sfa(
          name TEXT PRIMARY KEY,  -- name of the file
          mode INT,               -- access permissions
          mtime INT,              -- last modification time
          sz INT,                 -- original file size
          data BLOB               -- compressed content
        );
        
Both directories and empty files have sfa.sz==0.  Directories can be
distinguished from empty files because directories have sfa.data IS NULL.
The file is compressed if length(sfa.blob)<sfa.sz and is stored
as plaintext if length(sfa.blob)==sfa.sz.
|

|
|







 







|







|



|






|
|
|










|







|
|
|
|
1
2
3
4
5
6
7
8
9
10
11
..
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<h1 align="center">SQLAR - SQLite Archiver</h1>

This repository contains sources for a proof-of-concept "SQLite Archiver"
program.  This program (named "sqlar") operates much like "zip", except that
the compressed archive it builds is stored in an SQLite database instead
of a ZIP archive.

The motivation for this is to see how much larger an SQLite database file
is compared to a ZIP archive containing the same content.  The answer depends
on the filenames, but 2% seems to be a reasonable guess.  In other words,
storing files as compressed blobs in an SQLite database file results in a 
................................................................................
On unix, just type "make".  The SQLite sources are included.  The zlib
compression library is needed to build.

## Usage

To create an archive:

        sqlar ARCHIVE FILES...

All files named in FILES... will be added to the archive.  If another file
with the same name already exists in the archive, it is replaced.  If any
of the named FILES is a directory, that directory is scanned recursively.

To see the contents of an archive:

        sqlar -l ARCHIVE

To extract the contents of an archive:

        sqlar -x ARCHIVE [FILES...]

If a FILES argument is provided, then only the named files are extracted.
Without a FILES argument, all files are extracted.

All commands can be supplemented with -v for verbose output. For example:

        sqlar -v ARCHIVE FILES..
        sqlar -lv ARCHIVE
        sqlar -xv ARCHIVE

File are normally compressed using zlib prior to being stored as BLOBs in
the database.  However, if the file is incompressible or if the -n option
is used on the command-line, then the file is stored in the database exactly
as it appears on disk, without compression.
    
## Storage

The database schema looks like this:

        CREATE TABLE sqlar(
          name TEXT PRIMARY KEY,  -- name of the file
          mode INT,               -- access permissions
          mtime INT,              -- last modification time
          sz INT,                 -- original file size
          data BLOB               -- compressed content
        );
        
Both directories and empty files have sqlar.sz==0.  Directories can be
distinguished from empty files because directories have sqlar.data IS NULL.
The file is compressed if length(sqlar.blob)<sqlar.sz and is stored
as plaintext if length(sqlar.blob)==sqlar.sz.

Name change from sfa.c to sqlar.c.