Index: Makefile.in ================================================================== --- Makefile.in +++ Makefile.in @@ -992,10 +992,11 @@ ./mkkeywordhash$(BEXE) >keywordhash.h # Source files that go into making shell.c SHELL_SRC = \ $(TOP)/src/shell.c.in \ + $(TOP)/ext/misc/appendvfs.c \ $(TOP)/ext/misc/shathree.c \ $(TOP)/ext/misc/fileio.c \ $(TOP)/ext/misc/completion.c \ $(TOP)/ext/misc/sqlar.c \ $(TOP)/ext/expert/sqlite3expert.c \ Index: Makefile.msc ================================================================== --- Makefile.msc +++ Makefile.msc @@ -2081,10 +2081,11 @@ .\mkkeywordhash.exe > keywordhash.h # Source files that go into making shell.c SHELL_SRC = \ $(TOP)\src\shell.c.in \ + $(TOP)\ext\misc\appendvfs.c \ $(TOP)\ext\misc\shathree.c \ $(TOP)\ext\misc\fileio.c \ $(TOP)\ext\misc\completion.c \ $(TOP)\ext\expert\sqlite3expert.c \ $(TOP)\ext\expert\sqlite3expert.h \ Index: ext/misc/appendvfs.c ================================================================== --- ext/misc/appendvfs.c +++ ext/misc/appendvfs.c @@ -45,13 +45,11 @@ ** database in a separate file. ** ** If the file being opened is not an appended database, then this shim is ** a pass-through into the default underlying VFS. **/ -#if !defined(SQLITEINT_H) -#include -#endif +#include "sqlite3ext.h" SQLITE_EXTENSION_INIT1 #include #include /* The append mark at the end of the database is: Index: main.mk ================================================================== --- main.mk +++ main.mk @@ -692,10 +692,11 @@ ./mkkeywordhash >keywordhash.h # Source files that go into making shell.c SHELL_SRC = \ $(TOP)/src/shell.c.in \ + $(TOP)/ext/misc/appendvfs.c \ $(TOP)/ext/misc/shathree.c \ $(TOP)/ext/misc/fileio.c \ $(TOP)/ext/misc/completion.c \ $(TOP)/ext/misc/sqlar.c \ $(TOP)/ext/expert/sqlite3expert.c \ Index: src/shell.c.in ================================================================== --- src/shell.c.in +++ src/shell.c.in @@ -892,10 +892,11 @@ #define dirent DIRENT #endif INCLUDE ../ext/misc/shathree.c INCLUDE ../ext/misc/fileio.c INCLUDE ../ext/misc/completion.c +INCLUDE ../ext/misc/appendvfs.c #ifdef SQLITE_HAVE_ZLIB INCLUDE ../ext/misc/zipfile.c INCLUDE ../ext/misc/sqlar.c #endif INCLUDE ../ext/expert/sqlite3expert.h @@ -7950,10 +7951,16 @@ sqlite3_vfs_register(pVfs, 1); }else{ utf8_printf(stderr, "no such VFS: \"%s\"\n", argv[i]); exit(1); } +#ifdef SQLITE_HAVE_ZIP + }else if( strcmp(z,"-zip")==0 ){ + data.openMode = SHELL_OPEN_ZIPFILE; +#endif + }else if( strcmp(z,"-append")==0 ){ + data.openMode = SHELL_OPEN_APPENDVFS; } } if( data.zDbFilename==0 ){ #ifndef SQLITE_OMIT_MEMORYDB data.zDbFilename = ":memory:"; @@ -7962,10 +7969,11 @@ utf8_printf(stderr,"%s: Error: no database filename specified\n", Argv0); return 1; #endif } data.out = stdout; + sqlite3_appendvfs_init(0,0,0); /* Go ahead and open the database file if it already exists. If the ** file does not exist, delay opening it. This prevents empty database ** files from being created if a user mistypes the database name argument ** to the sqlite command-line tool. Index: tool/sqltclsh.c.in ================================================================== --- tool/sqltclsh.c.in +++ tool/sqltclsh.c.in @@ -27,15 +27,20 @@ #define SQLITE_OMIT_SHARED_CACHE 1 #define SQLITE_DEFAULT_MEMSTATUS 0 #define SQLITE_MAX_EXPR_DEPTH 0 INCLUDE sqlite3.c INCLUDE $ROOT/ext/misc/appendvfs.c +INCLUDE $ROOT/ext/misc/zipfile.c +INCLUDE $ROOT/ext/misc/sqlar.c INCLUDE $ROOT/src/tclsqlite.c const char *sqlite3_tclapp_init_proc(Tcl_Interp *interp){ (void)interp; sqlite3_appendvfs_init(0,0,0); + sqlite3_auto_extension((void(*)(void))sqlite3_sqlar_init); + sqlite3_auto_extension((void(*)(void))sqlite3_zipfile_init); + return BEGIN_STRING INCLUDE $ROOT/tool/sqltclsh.tcl END_STRING ; Index: tool/sqltclsh.tcl ================================================================== --- tool/sqltclsh.tcl +++ tool/sqltclsh.tcl @@ -4,11 +4,13 @@ catch { if {![file exists $argv0] && [file exists $argv0.exe]} { append argv0 .exe } sqlite3 db $argv0 -vfs apndvfs -create 0 - set mainscript [db one {SELECT data FROM scripts WHERE name='main.tcl'}] + set mainscript [db one { + SELECT sqlar_uncompress(data,sz) FROM sqlar WHERE name='main.tcl' + }] } if {[info exists mainscript]} { eval $mainscript return } else {