SQLite Archiver

Check-in [72ca977d53]
Login

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
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 72ca977d5319b748bc846133db3f339b8ddca7f5
User & Date: drh 2016-09-19 12:39:59.248
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
Unified Diff Ignore Whitespace Patch
Changes to Makefile.
1
2




3
4
5
6
7
8
9
10
11
12


13
14
15
16
17
18
19
20
21
#!/bin/make





CC = gcc -g -I. -D_FILE_OFFSET_BITS=64 -Wall -Werror
ZLIB = -lz
FUSELIB = -lfuse
SQLITE_OPT = $(OPT) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION

all: sqlar
	

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



sqlarfs:	sqlarfs.c sqlite3.o
	$(CC) -o sqlarfs $(OPT) sqlarfs.c sqlite3.o $(ZLIB) $(FUSELIB)

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

clean:	
	rm -f sqlar sqlarfs sqlite3.o

|
>
>
>
>
|

|

<
<
<



>
>





|



1
2
3
4
5
6
7
8
9
10



11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/make
#
# Example usage:
#
#     CFLAGS=-static make all

CC = gcc -g -I. -D_FILE_OFFSET_BITS=64 -Wall -Werror $(CFLAGS)
ZLIB = -lz
FUSELIB = -lfuse -lpthread -ldl
SQLITE_OPT = $(OPT) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION




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

all: sqlar sqlarfs

sqlarfs:	sqlarfs.c sqlite3.o
	$(CC) -o sqlarfs $(OPT) sqlarfs.c sqlite3.o $(ZLIB) $(FUSELIB)

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

clean:	
	rm -f sqlar sqlarfs sqlite3.o
Added codec.mk.




























































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

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

all: sqlar sqlarfs

sqlarfs:	sqlarfs.c sqlite3.o
	$(CC) -o sqlarfs $(OPT) sqlarfs.c sqlite3.o $(ZLIB) $(FUSELIB)

see-sqlite3.c: sqlite3.c $(CODEC)
	cat sqlite3.c $(CODEC) >see-sqlite3.c

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

clean:	
	rm -f sqlar sqlarfs sqlite3.o see-sqlite3.c
Changes to sqlar.c.
282
283
284
285
286
287
288





289
290
291
292
293
294
295
    prompt_for_passphrase("passphrase: ", seeFlag>1, zPassPhrase);
#ifdef SQLITE_HAS_CODEC
    sqlite3_key_v2(db, "main", zPassPhrase, -1);
#endif
  }
  sqlite3_exec(db, "BEGIN", 0, 0, 0);
  sqlite3_exec(db, zSchema, 0, 0, 0);





}

/*
** Prepare the pStmt statement.
*/
static void db_prepare(const char *zSql){
  int rc;







>
>
>
>
>







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

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







|







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