From: drh Date: Mon, 4 May 2015 17:06:39 +0000 (+0000) Subject: Include the "dbstat" virtual table in the amalgamation. X-Git-Tag: version-3.8.10~12^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=84ab95395ed6fbed8f8bd331a2a517b65524cae6;p=thirdparty%2Fsqlite.git Include the "dbstat" virtual table in the amalgamation. FossilOrigin-Name: fc6504aa8ca19b3737f72c1e20db8df6b7608dd2 --- diff --git a/Makefile.in b/Makefile.in index fbf67bdf6d..c8e5a61914 100644 --- a/Makefile.in +++ b/Makefile.in @@ -575,8 +575,8 @@ mptest: mptester$(EXE) mv vdbe.new tsrc/vdbe.c touch .target_source -sqlite3.c: .target_source $(TOP)/tool/mksqlite3c.tcl - $(TCLSH_CMD) $(TOP)/tool/mksqlite3c.tcl +sqlite3.c: .target_source $(TOP)/src/test_stat.c $(TOP)/tool/mksqlite3c.tcl + $(TCLSH_CMD) $(TOP)/tool/mksqlite3c.tcl --srcdir $(TOP)/src cp tsrc/shell.c tsrc/sqlite3ext.h . tclsqlite3.c: sqlite3.c @@ -991,7 +991,8 @@ smoketest: testfixture$(TEXE) fuzzershell$(TEXE) sqlite3_analyzer.c: sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl echo "#define TCLSH 2" > $@ - cat sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c >> $@ + echo "#define SQLITE_ENABLE_DBSTAT_VTAB" >> $@ + cat sqlite3.c $(TOP)/src/tclsqlite.c >> $@ echo "static const char *tclsh_main_loop(void){" >> $@ echo "static const char *zMainloop = " >> $@ $(NAWK) -f $(TOP)/tool/tostr.awk $(TOP)/tool/spaceanal.tcl >> $@ diff --git a/Makefile.msc b/Makefile.msc index 9ccc7ea5fc..dec71d0e63 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1229,8 +1229,8 @@ mptest: mptester.exe move vdbe.new tsrc\vdbe.c echo > .target_source -sqlite3.c: .target_source $(TOP)\tool\mksqlite3c.tcl - $(TCLSH_CMD) $(TOP)\tool\mksqlite3c.tcl $(MKSQLITE3C_ARGS) +sqlite3.c: .target_source $(TOP)\tool\mksqlite3c.tcl $(TOP)\src\test_stat.c + $(TCLSH_CMD) $(TOP)\tool\mksqlite3c.tcl $(MKSQLITE3C_ARGS) --srcdir $(TOP)/src copy tsrc\shell.c . copy tsrc\sqlite3ext.h . @@ -1656,14 +1656,14 @@ smoketest: testfixture.exe .\testfixture.exe $(TOP)\test\main.test sqlite3_analyzer.c: $(SQLITE3C) $(TOP)\src\test_stat.c $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl - copy $(SQLITE3C) + $(TOP)\src\test_stat.c + $(TOP)\src\tclsqlite.c $@ + copy $(SQLITE3C) + $(TOP)\src\tclsqlite.c $@ echo static const char *tclsh_main_loop(void){ >> $@ echo static const char *zMainloop = >> $@ $(NAWK) -f $(TOP)\tool\tostr.awk $(TOP)\tool\spaceanal.tcl >> $@ echo ; return zMainloop; } >> $@ sqlite3_analyzer.exe: sqlite3_analyzer.c $(LIBRESOBJS) - $(LTLINK) $(NO_WARN) -DBUILD_sqlite -DTCLSH=2 -I$(TCLINCDIR) sqlite3_analyzer.c \ + $(LTLINK) $(NO_WARN) -DBUILD_sqlite -DSQLITE_ENABLE_DBSTAT_VTAB -DTCLSH=2 -I$(TCLINCDIR) sqlite3_analyzer.c \ /link $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS) testloadext.lo: $(TOP)\src\test_loadext.c diff --git a/main.mk b/main.mk index 53eff03012..20dbc71cb7 100644 --- a/main.mk +++ b/main.mk @@ -447,8 +447,8 @@ target_source: $(SRC) $(TOP)/tool/vdbe-compress.tcl mv vdbe.new tsrc/vdbe.c touch target_source -sqlite3.c: target_source $(TOP)/tool/mksqlite3c.tcl - tclsh $(TOP)/tool/mksqlite3c.tcl +sqlite3.c: target_source $(TOP)/src/test_stat.c $(TOP)/tool/mksqlite3c.tcl + tclsh $(TOP)/tool/mksqlite3c.tcl --srcdir $(TOP)/src cp tsrc/shell.c tsrc/sqlite3ext.h . echo '#ifndef USE_SYSTEM_SQLITE' >tclsqlite3.c cat sqlite3.c >>tclsqlite3.c @@ -603,7 +603,8 @@ tclsqlite3: $(TOP)/src/tclsqlite.c libsqlite3.a sqlite3_analyzer.c: sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl echo "#define TCLSH 2" > $@ - cat sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c >> $@ + echo "#define SQLITE_ENABLE_DBSTAT_VTAB 1" >> $@ + cat sqlite3.c $(TOP)/src/tclsqlite.c >> $@ echo "static const char *tclsh_main_loop(void){" >> $@ echo "static const char *zMainloop = " >> $@ $(NAWK) -f $(TOP)/tool/tostr.awk $(TOP)/tool/spaceanal.tcl >> $@ diff --git a/manifest b/manifest index dc77d0f3b5..ec4c417ebb 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Fix\sa\sfaulty\sassert()\sin\sthe\sSELECT\scode\sgenerator\sand\sadd\sa\stest\scase\nto\sprevent\sregression. -D 2015-05-04T16:09:34.295 +C Include\sthe\s"dbstat"\svirtual\stable\sin\sthe\samalgamation. +D 2015-05-04T17:06:39.476 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in e628c50e237251fc7e768bef14ee7e822ad69e69 +F Makefile.in 765cd5203f272e10eee92566dd0fd160d5b63623 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc 4c7e6fc40c5b65134b789b18b83743abac907504 +F Makefile.msc a635cba1c339e9ecb250fa26ecc4a55437aee127 F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858 F README.md d58e3bebc0a4145e0f2a87994015fdb575a8e866 F VERSION 2e244662b71e6e68a5c29b014ebc5b7564f4cc5a @@ -152,7 +152,7 @@ F ext/userauth/userauth.c 5fa3bdb492f481bbc1709fc83c91ebd13460c69e F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60 -F main.mk 1225d45e1883000a3ed6f028893a11c04522ea6a +F main.mk 909fc13d3f538f2c9be17527145f00f3e09d5e12 F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea F mkopcodeh.awk d5e22023b5238985bb54a72d33e0ac71fe4f8a32 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 @@ -231,7 +231,7 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c 13109bc3b5ab404446296efa17039640de5bc35d F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c 1b0bfc7d59e48c26b895a6b719157111a617d9e3 -F src/shell.c b1e17be8565b5ce4138707d2808df077bf9750d9 +F src/shell.c 4ef9436ea7d1016584421067b16ba8a41c506dc4 F src/sqlite.h.in ca27603a36fcacdaac5a19d8ee35aaff8ce8516f F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d @@ -278,7 +278,7 @@ F src/test_rtree.c bfe6f4386517f70054311109f3528adffec34485 F src/test_schema.c 2bdba21b82f601da69793e1f1d11bf481a79b091 F src/test_server.c a2615049954cbb9cfb4a62e18e2f0616e4dc38fe F src/test_sqllog.c b690c12933f50ff46491e0d56a251f84ae16e914 -F src/test_stat.c e6583a44b0a23207ba2a9d69be16a338a8b70aa2 +F src/test_stat.c 0906b134cb6fbceaef99c9f35b03594191128176 F src/test_superlock.c 06797157176eb7085027d9dd278c0d7a105e3ec9 F src/test_syscall.c 2e21ca7f7dc54a028f1967b63f1e76155c356f9b F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa @@ -1221,7 +1221,7 @@ F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e F tool/mkpragmatab.tcl 94f196c9961e0ca3513e29f57125a3197808be2d F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 F tool/mksqlite3c-noext.tcl 69bae8ce4aa52d2ff82d4a8a856bf283ec035b2e -F tool/mksqlite3c.tcl 52a3352f7aa15f1db851e45ac3a5e2173d6fe93c +F tool/mksqlite3c.tcl 49da6d5d50580fa1c00bb24d2e310590bf579318 F tool/mksqlite3h.tcl 44730d586c9031638cdd2eb443b801c0d2dbd9f8 F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b F tool/mkvsix.tcl 3b58b9398f91c7dbf18d49eb87cefeee9efdbce1 @@ -1256,7 +1256,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9f428530f9a6cb54f0a2fc3e666c38c7c093558a -R 48808945fe5696b2fff2e789a5a0575d +P 1421c8ffba179d6aafa2643012f80a2738779117 +R 5221fe8f417bbca3fd24bdac9e11179c +T *branch * dbstat-in-amalgamation +T *sym-dbstat-in-amalgamation * +T -sym-trunk * U drh -Z f2542b1fa566b40c4e2710f436b29d54 +Z 95c360ac7eadea1b6b901d97b908041e diff --git a/manifest.uuid b/manifest.uuid index 029a7a80f2..9a743eef2d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1421c8ffba179d6aafa2643012f80a2738779117 \ No newline at end of file +fc6504aa8ca19b3737f72c1e20db8df6b7608dd2 \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 8b5695ac18..0eab88e6cc 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1910,7 +1910,7 @@ static void open_db(ShellState *p, int keepAlive){ if( p->db==0 ){ sqlite3_initialize(); sqlite3_open(p->zDbFilename, &p->db); -#ifdef SQLITE_ENABLE_STAT_VTAB +#ifdef SQLITE_ENABLE_DBSTAT_VTAB if( p->db ){ int sqlite3_dbstat_register(sqlite3*); sqlite3_dbstat_register(p->db); diff --git a/src/test_stat.c b/src/test_stat.c index 17091c0d2d..35304b3fd6 100644 --- a/src/test_stat.c +++ b/src/test_stat.c @@ -18,8 +18,18 @@ ** for an example implementation. */ +/* Only compile this module if there is evidence that the programmer +** deliberately wants to include it. Evidence can be: +** (1) Tt is compiled and linked separately from the amalgamation. +** (2) The SQLITE_ENABLE_DBSTAT_VTAB compile-time option is used +** (3) The SQLITE_TEST compile-time option is used +*/ +#if !defined(SQLITE_AMALGAMATION) \ + || defined(SQLITE_ENABLE_DBSTAT_VTAB) \ + || defined(SQLITE_TEST) + #ifndef SQLITE_AMALGAMATION -# include "sqliteInt.h" +# include "sqliteInt.h" /* Requires access to internal data structures */ #endif #ifndef SQLITE_OMIT_VIRTUALTABLE @@ -625,9 +635,17 @@ int sqlite3_dbstat_register(sqlite3 *db){ #endif +/* +** This is the TCL interface +*/ #if defined(SQLITE_TEST) || TCLSH==2 -#include +#include /* amalgamator: keep */ +/* +** tclcmd: register_dbstat_vtab DB +** +** Cause the dbstat virtual table to be available on the connection DB +*/ static int test_dbstat( void *clientData, Tcl_Interp *interp, @@ -656,9 +674,10 @@ static int test_dbstat( return TCL_OK; #endif } - int SqlitetestStat_Init(Tcl_Interp *interp){ Tcl_CreateObjCommand(interp, "register_dbstat_vtab", test_dbstat, 0, 0); return TCL_OK; } #endif /* if defined(SQLITE_TEST) || TCLSH==2 */ + +#endif /* !SQLITE_AMALGAMATION || SQLITE_ENABLE_DBSTAT_VTAB || SQLITE_TEST */ diff --git a/tool/mksqlite3c.tcl b/tool/mksqlite3c.tcl index 136155089c..a07d22709a 100644 --- a/tool/mksqlite3c.tcl +++ b/tool/mksqlite3c.tcl @@ -17,7 +17,7 @@ # After the "tsrc" directory has been created and populated, run # this script: # -# tclsh mksqlite3c.tcl +# tclsh mksqlite3c.tcl --srcdir $SRC # # The amalgamated SQLite code will be written into sqlite3.c # @@ -26,15 +26,21 @@ # from in this file. The version number is needed to generate the header # comment of the amalgamation. # -if {[lsearch $argv --nostatic]>=0} { - set addstatic 0 -} else { - set addstatic 1 -} -if {[lsearch $argv --linemacros]>=0} { - set linemacros 1 -} else { - set linemacros 0 +set addstatic 1 +set linemacros 0 +set srcdir {} +for {set i 0} {$i<[llength $argv]} {incr i} { + set x [lindex $argv $i] + if {[regexp {^-+nostatic$} $x]} { + set addstatic 0 + } elseif {[regexp {^-+linemacros} $x]} { + set linemacros 1 + } elseif {[regexp {^-+srcdir} $x]} { + incr i + set srcdir [lindex $argv $i] + } else { + error "unknown command-line option: $x" + } } set in [open tsrc/sqlite3.h] set cnt 0 @@ -369,5 +375,8 @@ foreach file { } { copy_file tsrc/$file } +if {$srcdir!=""} { + copy_file $srcdir/test_stat.c +} close $out