SQLite Archiver
Check-in [72ca977d53]
Not logged in

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

Overview
Comment:Update to the latest 3.15.0 prerelease code. Improved SEE support, including a new SEE makefile. Other makefile improvements.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:72ca977d5319b748bc846133db3f339b8ddca7f5
User & Date: drh 2016-09-19 12:39:59
Context
2016-10-19
17:07
Fix a typo on the extract SQL statement. check-in: eb7a492f16 user: drh tags: trunk
2016-09-19
12:39
Update to the latest 3.15.0 prerelease code. Improved SEE support, including a new SEE makefile. Other makefile improvements. check-in: 72ca977d53 user: drh tags: trunk
12:10
Update the built-in SQLite to the latest 3.15.0 alpha version. check-in: 72b6147da3 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.

     1      1   #!/bin/make
     2         -
     3         -CC = gcc -g -I. -D_FILE_OFFSET_BITS=64 -Wall -Werror
     4         -ZLIB = -lz
     5         -FUSELIB = -lfuse
     6         -SQLITE_OPT = $(OPT) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION
            2  +#
            3  +# Example usage:
            4  +#
            5  +#     CFLAGS=-static make all
     7      6   
     8         -all: sqlar
     9         -	
            7  +CC = gcc -g -I. -D_FILE_OFFSET_BITS=64 -Wall -Werror $(CFLAGS)
            8  +ZLIB = -lz
            9  +FUSELIB = -lfuse -lpthread -ldl
           10  +SQLITE_OPT = $(OPT) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION
    10     11   
    11     12   sqlar:	sqlar.c sqlite3.o
    12     13   	$(CC) -o sqlar $(OPT) sqlar.c sqlite3.o $(ZLIB)
           14  +
           15  +all: sqlar sqlarfs
    13     16   
    14     17   sqlarfs:	sqlarfs.c sqlite3.o
    15     18   	$(CC) -o sqlarfs $(OPT) sqlarfs.c sqlite3.o $(ZLIB) $(FUSELIB)
    16     19   
    17     20   sqlite3.o:	sqlite3.c sqlite3.h
    18         -	$(CC) -c sqlite3.c $(SQLITE_OPT) sqlite3.c
           21  +	$(CC) $(SQLITE_OPT) -c sqlite3.c
    19     22   
    20     23   clean:	
    21     24   	rm -f sqlar sqlarfs sqlite3.o

Added codec.mk.

            1  +#!/bin/make
            2  +#
            3  +# Use this alternative makefile to build an encrypted version of sqlar
            4  +# using the SQLite Encryption Extension (SEE).
            5  +#
            6  +#     CODEC=../path/to/codec.c make -f codec.mk sqlar sqlarfs
            7  +#
            8  +CC = gcc -g -I. -D_FILE_OFFSET_BITS=64 -Wall -Werror -static -Os
            9  +ZLIB = -lz
           10  +FUSELIB = -lfuse -lpthread -ldl
           11  +SQLITE_OPT = $(OPT) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION
           12  +SQLITE_OPT += -DSQLITE_OMIT_SHAREDCACHE
           13  +CC += -DSQLITE_HAS_CODEC
           14  +
           15  +sqlar:	sqlar.c sqlite3.o
           16  +	$(CC) -o sqlar $(OPT) sqlar.c sqlite3.o $(ZLIB)
           17  +
           18  +all: sqlar sqlarfs
           19  +
           20  +sqlarfs:	sqlarfs.c sqlite3.o
           21  +	$(CC) -o sqlarfs $(OPT) sqlarfs.c sqlite3.o $(ZLIB) $(FUSELIB)
           22  +
           23  +see-sqlite3.c: sqlite3.c $(CODEC)
           24  +	cat sqlite3.c $(CODEC) >see-sqlite3.c
           25  +
           26  +sqlite3.o:	see-sqlite3.c sqlite3.h
           27  +	$(CC) $(SQLITE_OPT) -c see-sqlite3.c -o sqlite3.o
           28  +
           29  +clean:	
           30  +	rm -f sqlar sqlarfs sqlite3.o see-sqlite3.c

Changes to sqlar.c.

   282    282       prompt_for_passphrase("passphrase: ", seeFlag>1, zPassPhrase);
   283    283   #ifdef SQLITE_HAS_CODEC
   284    284       sqlite3_key_v2(db, "main", zPassPhrase, -1);
   285    285   #endif
   286    286     }
   287    287     sqlite3_exec(db, "BEGIN", 0, 0, 0);
   288    288     sqlite3_exec(db, zSchema, 0, 0, 0);
          289  +  rc = sqlite3_exec(db, "SELECT 1 FROM sqlar LIMIT 1", 0, 0, 0);
          290  +  if( rc!=SQLITE_OK ){
          291  +    fprintf(stderr, "File [%s] is not an SQLite archive\n", zArchive);
          292  +    exit(1);
          293  +  }
   289    294   }
   290    295   
   291    296   /*
   292    297   ** Prepare the pStmt statement.
   293    298   */
   294    299   static void db_prepare(const char *zSql){
   295    300     int rc;

Changes to sqlarfs.c.

   369    369   #ifndef SQLITE_HAS_CODEC
   370    370       printf("WARNING:  The passphrase is a no-op because this build of\n"
   371    371              "sqlar is compiled without encryption capabilities.\n");
   372    372   #endif
   373    373       memset(zPassPhrase, 0, sizeof(zPassPhrase));
   374    374       prompt_for_passphrase("passphrase: ", seeFlag>1, zPassPhrase);
   375    375   #ifdef SQLITE_HAS_CODEC
   376         -    sqlite3_key_v2(db, "main", zPassPhrase, -1);
          376  +    sqlite3_key_v2(g.db, "main", zPassPhrase, -1);
   377    377   #endif
   378    378     }
   379    379     rc = sqlite3_exec(g.db, "SELECT 1 FROM sqlar LIMIT 1", 0, 0, 0);
   380    380     if( rc!=SQLITE_OK ){
   381    381       fprintf(stderr, "File [%s] is not an SQLite archive\n", argv[1]);
   382    382       exit(1);
   383    383     }