diff options
author | dan <dan@noemail.net> | 2015-05-11 18:46:42 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2015-05-11 18:46:42 +0000 |
commit | 1c1cea8baec472eb39ae92d92e2b9b1321334f9c (patch) | |
tree | ec6e360f30971e2dcb08e73ebde9a8e1c94f1e4d | |
parent | 828cdb3473fadfcd8b78251e747ab3b9df1eda4a (diff) | |
parent | d13b2319234ddb4857b7b793ec3b26b76251a6ca (diff) | |
download | sqlite-1c1cea8baec472eb39ae92d92e2b9b1321334f9c.tar.gz sqlite-1c1cea8baec472eb39ae92d92e2b9b1321334f9c.zip |
Merge latest trunk changes into this branch.
FossilOrigin-Name: 82e5a6e088c58815140ad36715ac11c96527cb25
-rw-r--r-- | Makefile.in | 27 | ||||
-rw-r--r-- | Makefile.msc | 26 | ||||
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | autoconf/Makefile.am | 5 | ||||
-rwxr-xr-x | configure | 18 | ||||
-rw-r--r-- | ext/rtree/rtree9.test | 1 | ||||
-rw-r--r-- | main.mk | 27 | ||||
-rw-r--r-- | manifest | 52 | ||||
-rw-r--r-- | manifest.uuid | 2 | ||||
-rw-r--r-- | src/ctime.c | 3 | ||||
-rw-r--r-- | src/dbstat.c | 55 | ||||
-rw-r--r-- | src/main.c | 3 | ||||
-rw-r--r-- | src/malloc.c | 14 | ||||
-rw-r--r-- | src/resolve.c | 1 | ||||
-rw-r--r-- | src/shell.c | 3 | ||||
-rw-r--r-- | src/sqliteInt.h | 4 | ||||
-rw-r--r-- | src/tclsqlite.c | 47 | ||||
-rw-r--r-- | src/test1.c | 36 | ||||
-rw-r--r-- | test/analyzer1.test | 39 | ||||
-rw-r--r-- | test/jrnlmode.test | 1 | ||||
-rw-r--r-- | test/select4.test | 3 | ||||
-rw-r--r-- | test/sqldiff1.test | 57 | ||||
-rw-r--r-- | test/stat.test | 10 | ||||
-rw-r--r-- | tool/spaceanal.tcl | 1 |
24 files changed, 297 insertions, 140 deletions
diff --git a/Makefile.in b/Makefile.in index 059115014..a6984b2fd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -510,6 +510,15 @@ EXTHDR += \ EXTHDR += \ $(TOP)/ext/rtree/sqlite3rtree.h +# executables needed for testing +# +TESTPROGS = \ + testfixture$(TEXE) \ + sqlite3$(TEXE) \ + sqlite3_analyzer$(TEXE) \ + sqldiff$(TEXE) + + # This is the default Makefile target. The objects listed here # are what get build when you type just "make" with no arguments. # @@ -955,15 +964,15 @@ testfixture$(TEXE): $(TESTFIXTURE_SRC) -o $@ $(TESTFIXTURE_SRC) $(LIBTCL) $(TLIBS) # A very detailed test running most or all test cases -fulltest: testfixture$(TEXE) sqlite3$(TEXE) fuzztest +fulltest: $(TESTPROGS) fuzztest ./testfixture$(TEXE) $(TOP)/test/all.test # Really really long testing -soaktest: testfixture$(TEXE) sqlite3$(TEXE) fuzzoomtest +soaktest: $(TESTPROGS) fuzzoomtest ./testfixture$(TEXE) $(TOP)/test/all.test -soak=1 -# Do extra testing but not aeverything. -fulltestonly: testfixture$(TEXE) sqlite3$(TEXE) +# Do extra testing but not everything. +fulltestonly: $(TESTPROGS) ./testfixture$(TEXE) $(TOP)/test/full.test # Fuzz testing @@ -976,13 +985,13 @@ fuzzoomtest: fuzzershell$(TEXE) # This is the common case. Run many tests but not those that take # a really long time. # -test: testfixture$(TEXE) sqlite3$(TEXE) fuzztest +test: $(TESTPROGS) fuzztest ./testfixture$(TEXE) $(TOP)/test/veryquick.test # Run a test using valgrind. This can take a really long time # because valgrind is so much slower than a native machine. # -valgrindtest: testfixture$(TEXE) sqlite3$(TEXE) fuzzershell$(TEXE) +valgrindtest: $(TESTPROGS) fuzzershell$(TEXE) valgrind -v ./fuzzershell$(TEXE) -f $(TOP)/test/fuzzdata1.txt OMIT_MISUSE=1 valgrind -v ./testfixture$(TEXE) $(TOP)/test/permutations.test valgrind @@ -990,12 +999,12 @@ valgrindtest: testfixture$(TEXE) sqlite3$(TEXE) fuzzershell$(TEXE) # the 60s-era electronics testing: "Turn it on and see if smoke # comes out." # -smoketest: testfixture$(TEXE) fuzzershell$(TEXE) +smoketest: $(TESTPROGS) fuzzershell$(TEXE) ./testfixture$(TEXE) $(TOP)/test/main.test sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl echo "#define TCLSH 2" > $@ - echo "#define SQLITE_ENABLE_DBSTAT_VTAB" >> $@ + 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 = " >> $@ @@ -1106,6 +1115,8 @@ clean: rm -f sqlite3_analyzer$(TEXE) sqlite3_analyzer.c rm -f sqlite-*-output.vsix rm -f mptester mptester.exe + rm -f fuzzershell fuzzershell.exe + rm -f sqldiff sqldiff.exe distclean: clean rm -f config.log config.status libtool Makefile sqlite3.pc diff --git a/Makefile.msc b/Makefile.msc index df3985162..487d85bfc 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1172,6 +1172,15 @@ EXTHDR = $(EXTHDR) \ EXTHDR = $(EXTHDR) \ $(TOP)\ext\rtree\sqlite3rtree.h +# executables needed for testing +# +TESTPROGS = \ + testfixture.exe \ + sqlite3.exe \ + sqlite3_analyzer.exe \ + sqldiff.exe + + # This is the default Makefile target. The objects listed here # are what get build when you type just "make" with no arguments. # @@ -1635,13 +1644,13 @@ testfixture.exe: $(TESTFIXTURE_SRC) $(LIBRESOBJS) $(HDR) extensiontest: testfixture.exe testloadext.dll .\testfixture.exe $(TOP)\test\loadext.test -fulltest: testfixture.exe sqlite3.exe fuzztest +fulltest: $(TESTPROGS) fuzztest .\testfixture.exe $(TOP)\test\all.test -soaktest: testfixture.exe sqlite3.exe fuzzoomtest +soaktest: $(TESTPROGS) fuzzoomtest .\testfixture.exe $(TOP)\test\all.test -soak=1 -fulltestonly: testfixture.exe sqlite3.exe fuzztest +fulltestonly: $(TESTPROGS) fuzztest .\testfixture.exe $(TOP)\test\full.test queryplantest: testfixture.exe sqlite3.exe @@ -1653,21 +1662,23 @@ fuzztest: fuzzershell.exe fuzzoomtest: fuzzershell.exe .\fuzzershell.exe -f $(TOP)\test\fuzzdata1.txt --oom -test: testfixture.exe sqlite3.exe fuzztest +test: $(TESTPROGS) fuzztest .\testfixture.exe $(TOP)\test\veryquick.test -smoketest: testfixture.exe +smoketest: $(TESTPROGS) fuzzershell.exe .\testfixture.exe $(TOP)\test\main.test sqlite3_analyzer.c: $(SQLITE3C) $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl - copy $(SQLITE3C) + $(TOP)\src\tclsqlite.c $@ + echo #define TCLSH 2 > $@ + echo #define SQLITE_ENABLE_DBSTAT_VTAB 1 >> $@ + 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 -DSQLITE_ENABLE_DBSTAT_VTAB -DTCLSH=2 -I$(TCLINCDIR) sqlite3_analyzer.c \ + $(LTLINK) $(NO_WARN) -DBUILD_sqlite -I$(TCLINCDIR) sqlite3_analyzer.c \ /link $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS) testloadext.lo: $(TOP)\src\test_loadext.c @@ -1737,6 +1748,7 @@ clean: del /Q shell.c sqlite3ext.h 2>NUL del /Q sqlite3_analyzer.exe sqlite3_analyzer.c 2>NUL del /Q sqlite-*-output.vsix 2>NUL + del /Q fuzzershell.exe sqldiff.exe 2>NUL # Dynamic link library section. # @@ -1 +1 @@ -3.8.10 +3.8.10.1 diff --git a/autoconf/Makefile.am b/autoconf/Makefile.am index 88bc23df4..60d2ba267 100644 --- a/autoconf/Makefile.am +++ b/autoconf/Makefile.am @@ -6,8 +6,9 @@ libsqlite3_la_SOURCES = sqlite3.c libsqlite3_la_LDFLAGS = -no-undefined -version-info 8:6:8 bin_PROGRAMS = sqlite3 -sqlite3_SOURCES = shell.c sqlite3.h -sqlite3_LDADD = sqlite3.$(OBJEXT) @READLINE_LIBS@ +sqlite3_SOURCES = shell.c sqlite3.c sqlite3.h +sqlite3_LDADD = @READLINE_LIBS@ +sqlite3_CFLAGS = $(AM_CFLAGS) include_HEADERS = sqlite3.h sqlite3ext.h @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.62 for sqlite 3.8.10. +# Generated by GNU Autoconf 2.62 for sqlite 3.8.10.1. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. @@ -743,8 +743,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.8.10' -PACKAGE_STRING='sqlite 3.8.10' +PACKAGE_VERSION='3.8.10.1' +PACKAGE_STRING='sqlite 3.8.10.1' PACKAGE_BUGREPORT='' # Factoring default headers for most tests. @@ -1481,7 +1481,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.8.10 to adapt to many kinds of systems. +\`configure' configures sqlite 3.8.10.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1546,7 +1546,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.8.10:";; + short | recursive ) echo "Configuration of sqlite 3.8.10.1:";; esac cat <<\_ACEOF @@ -1660,7 +1660,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.8.10 +sqlite configure 3.8.10.1 generated by GNU Autoconf 2.62 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1674,7 +1674,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.8.10, which was +It was created by sqlite $as_me 3.8.10.1, which was generated by GNU Autoconf 2.62. Invocation command line was $ $0 $@ @@ -13953,7 +13953,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.8.10, which was +This file was extended by sqlite $as_me 3.8.10.1, which was generated by GNU Autoconf 2.62. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14006,7 +14006,7 @@ Report bugs to <bug-autoconf@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -sqlite config.status 3.8.10 +sqlite config.status 3.8.10.1 configured by $0, generated by GNU Autoconf 2.62, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/ext/rtree/rtree9.test b/ext/rtree/rtree9.test index 6479516be..571341b2a 100644 --- a/ext/rtree/rtree9.test +++ b/ext/rtree/rtree9.test @@ -87,7 +87,6 @@ do_catchsql_test rtree9-4.3 { # register_circle_geom db -breakpoint do_execsql_test rtree9-5.1 { CREATE VIRTUAL TABLE rt2 USING rtree(id, xmin, xmax, ymin, ymax); @@ -391,6 +391,14 @@ EXTHDR += \ EXTHDR += \ $(TOP)/ext/userauth/sqlite3userauth.h +# executables needed for testing +# +TESTPROGS = \ + testfixture$(EXE) \ + sqlite3$(EXE) \ + sqlite3_analyzer$(EXE) \ + sqldiff$(EXE) + # This is the default Makefile target. The objects listed here # are what get build when you type just "make" with no arguments. # @@ -635,13 +643,13 @@ fts3-testfixture$(EXE): sqlite3.c fts3amal.c $(TESTSRC) $(TOP)/src/tclsqlite.c $(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c fts3amal.c \ -o testfixture$(EXE) $(LIBTCL) $(THREADLIB) -fulltest: testfixture$(EXE) sqlite3$(EXE) fuzztest +fulltest: $(TESTPROGS) fuzztest ./testfixture$(EXE) $(TOP)/test/all.test -soaktest: testfixture$(EXE) sqlite3$(EXE) fuzzoomtest +soaktest: $(TESTPROGS) fuzzoomtest ./testfixture$(EXE) $(TOP)/test/all.test -soak=1 -fulltestonly: testfixture$(EXE) sqlite3$(EXE) fuzztest +fulltestonly: $(TESTPROGS) fuzztest ./testfixture$(EXE) $(TOP)/test/full.test queryplantest: testfixture$(EXE) sqlite3$(EXE) @@ -653,16 +661,23 @@ fuzztest: fuzzershell$(EXE) fuzzoomtest: fuzzershell$(EXE) ./fuzzershell$(EXE) -f $(TOP)/test/fuzzdata1.txt --oom -test: testfixture$(EXE) sqlite3$(EXE) fuzztest +test: $(TESTPROGS) fuzztest ./testfixture$(EXE) $(TOP)/test/veryquick.test # Run a test using valgrind. This can take a really long time # because valgrind is so much slower than a native machine. # -valgrindtest: testfixture$(EXE) sqlite3$(EXE) fuzzershell$(EXE) +valgrindtest: $(TESTPROGS) fuzzershell$(EXE) valgrind -v ./fuzzershell$(EXE) -f $(TOP)/test/fuzzdata1.txt OMIT_MISUSE=1 valgrind -v ./testfixture$(EXE) $(TOP)/test/permutations.test valgrind +# A very fast test that checks basic sanity. The name comes from +# the 60s-era electronics testing: "Turn it on and see if smoke +# comes out." +# +smoketest: $(TESTPROGS) fuzzershell$(EXE) + ./testfixture$(EXE) $(TOP)/test/main.test + # The next two rules are used to support the "threadtest" target. Building # threadtest runs a few thread-safety tests that are implemented in C. This # target is invoked by the releasetest.tcl script. @@ -769,3 +784,5 @@ clean: rm -f sqlite3_analyzer sqlite3_analyzer.exe sqlite3_analyzer.c rm -f sqlite-*-output.vsix rm -f mptester mptester.exe + rm -f fuzzershell fuzzershell.exe + rm -f sqldiff sqldiff.exe @@ -1,19 +1,19 @@ -C Merge\slatest\strunk\schanges\swith\sthis\sbranch. -D 2015-05-06T18:15:28.184 +C Merge\slatest\strunk\schanges\sinto\sthis\sbranch. +D 2015-05-11T18:46:42.330 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in 08728ecbeddca339c77bfd564d3484b523dffdb1 +F Makefile.in edfc69769e613a6359c42c06ea1d42c3bece1736 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc c6241f7fa2912427410ef15429c8ab5601e19a71 +F Makefile.msc c65882433fde5f35ff66e759938eaf2dde9f360d F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858 F README.md d58e3bebc0a4145e0f2a87994015fdb575a8e866 -F VERSION 2e244662b71e6e68a5c29b014ebc5b7564f4cc5a +F VERSION 8af05c43e00f7de32be74ff9984d792c96cdb0de F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 F addopcodes.awk 9eb448a552d5c0185cf62c463f9c173cedae3811 F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 -F autoconf/Makefile.am 4012e106208c7b86ba54d06e9ed400b59a4dee6b +F autoconf/Makefile.am 27de1af382c82e81f1fe36a7f38528fba004eb1a F autoconf/README 14458f1046c118efa721aadec5f227e876d3cd38 F autoconf/README.first 6c4f34fe115ff55d4e8dbfa3cecf04a0188292f7 F autoconf/config.guess 94cc57e2a3fdb9c235b362ace86d77e89d188cad x @@ -38,7 +38,7 @@ F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63 F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977 F config.h.in 42b71ad3fe21c9e88fa59e8458ca1a6bc72eb0c0 F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55 -F configure 2ea5f5b58dd106da449ab598ab6e515339d7fa2a x +F configure dae9f0ec4df32a9e300befbcdbc4ff8874731357 x F configure.ac 0b775d383c536bbaafc1e46dd3cbb81a7ea11aeb F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F doc/lemon.html 334dbf6621b8fb8790297ec1abf3cfa4621709d1 @@ -134,7 +134,7 @@ F ext/rtree/rtree5.test 6a510494f12454bf57ef28f45bc7764ea279431e F ext/rtree/rtree6.test 773a90db2dce6a8353dd0d5b64bca69b29761196 F ext/rtree/rtree7.test 1fa710b9e6bf997a0c1a537b81be7bb6fded1971 F ext/rtree/rtree8.test db79c812f9e4a11f9b1f3f9934007884610a713a -F ext/rtree/rtree9.test d86ebf08ff6328895613ed577dd8a2a37c472c34 +F ext/rtree/rtree9.test b5eb13849545dfd271a54ff16784cb00d8792aea F ext/rtree/rtreeA.test ace05e729a36e342d40cf94e9efc7b4723d9dcdf F ext/rtree/rtreeB.test c85f9ce78766c4e68b8b89fbf2979ee9cfa82b4e F ext/rtree/rtreeC.test df158dcc81f1a43ce7eef361af03c48ec91f1e06 @@ -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 f012feb95fc4acfb583f89b6f9d1dc6253a8f08d +F main.mk d49723483ee9e4fb71dc2bd0e6be58705a481e73 F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea F mkopcodeh.awk d5e22023b5238985bb54a72d33e0ac71fe4f8a32 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 @@ -179,9 +179,9 @@ F src/btreeInt.h 973a22a6fd61350b454ad614832b1f0a5e25a1e4 F src/build.c 61b47073f79f31e80a05db9ce13c5ca81bf8f74e F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0 F src/complete.c a5cf5b4b56390cfb7b8636e8f7ddef90258dd575 -F src/ctime.c 98f89724adc891a1a4c655bee04e33e716e05887 +F src/ctime.c 5a0b735dc95604766f5dac73973658eef782ee8b F src/date.c e4d50b3283696836ec1036b695ead9a19e37a5ac -F src/dbstat.c 1eacd310212b5ae59b7be645a06de8f8bbe0b5d6 +F src/dbstat.c fa5b981f37c2b4f7797b4496f1c10254e11a2f4a F src/delete.c 37964e6c1d73ff49cbea9ff690c9605fb15f600e F src/expr.c 3fb2ab3ab69d15b4b75ae53fceb4e317f64cb306 F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb @@ -196,8 +196,8 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770 F src/loadext.c 29255bbe1cfb2ce9bbff2526a5ecfddcb49b9271 -F src/main.c 331fda6b255ae6a08e6ade89f0ac1d158691f3c6 -F src/malloc.c 6a370b83d54e4bbf6f94021221c2a311cff26a18 +F src/main.c bf14bc6a321965e528d8ab30087e9440335f2e4b +F src/malloc.c 5bc15d525811d387b37c29f2e368143460e41e96 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c abe6ee469b6c5a35c7f22bfeb9c9bac664a1c987 F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3 @@ -229,19 +229,19 @@ F src/pragma.h 09c89bca58e9a44de2116cc8272b8d454657129f F src/prepare.c 1fffbdcd6f8a0173a8f70d71f22528f4c0e1e3d3 F src/printf.c 54dd6dce95454fadffa3ebf7717c5f6c06250d1d F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 -F src/resolve.c 13109bc3b5ab404446296efa17039640de5bc35d +F src/resolve.c 99eabf7eff0bfa65b75939b46caa82e2b2133f28 F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c 1b0bfc7d59e48c26b895a6b719157111a617d9e3 -F src/shell.c 1b6fc902d4455b7a4d6d9cc9a23d3f6af7089302 +F src/shell.c 07dda7cd692911d2f22269953418d049f2e2c0ee F src/sqlite.h.in ca27603a36fcacdaac5a19d8ee35aaff8ce8516f F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d -F src/sqliteInt.h 20d9c59fd82774503b8953acfbcc6ecbdd9ee6aa +F src/sqliteInt.h c9f77bd02f419dcc8c644c5032c42eb29069a545 F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46 F src/status.c f266ad8a2892d659b74f0f50cb6a88b6e7c12179 F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e -F src/tclsqlite.c d4fa052d3fbb655150d4ca8eedc70384b98bfef3 -F src/test1.c 90fbedce75330d48d99eadb7d5f4223e86969585 +F src/tclsqlite.c 9111a95999edac92229c972e2c34fbc171bbb6c5 +F src/test1.c a8e09b811f70184ce65012f27f30cfee7e54f268 F src/test2.c 577961fe48961b2f2e5c8b56ee50c3f459d3359d F src/test3.c 64d2afdd68feac1bb5e2ffb8226c8c639f798622 F src/test4.c d168f83cc78d02e8d35567bb5630e40dcd85ac1e @@ -334,6 +334,7 @@ F test/analyzeC.test 555a6cc388b9818b6eda6df816f01ce0a75d3a93 F test/analyzeD.test 08f9d0bee4e118a66fff3a32d02dbe0ee0a2b594 F test/analyzeE.test 8684e8ac5722fb97c251887ad97e5d496a98af1d F test/analyzeF.test 7ccd7a04f7d3061bde1a8a4dacc4792edccf6bf2 +F test/analyzer1.test 0f803d7d466d7c3e027dfe18bc412b634999995b F test/async.test 1d0e056ba1bb9729283a0f22718d3a25e82c277b F test/async2.test c0a9bd20816d7d6a2ceca7b8c03d3d69c28ffb8b F test/async3.test d73a062002376d7edc1fe3edff493edbec1fc2f7 @@ -691,7 +692,7 @@ F test/join6.test cfe6503791ceb0cbb509966740286ec423cbf10b F test/journal1.test 69abc726c51b4a0409189f9a85191205297c0577 F test/journal2.test ae06f566c28552c313ded3fee79a6c69e6d049b1 F test/journal3.test ff8af941f9e06161d3db1b46bb9f965ff0e7f307 -F test/jrnlmode.test 6014ba5c11d66ff8bc7d87a7a2abc5c54be73b2e +F test/jrnlmode.test 7864d59cf7f6e552b9b99ba0f38acd167edc10fa F test/jrnlmode2.test 81610545a4e6ed239ea8fa661891893385e23a1d F test/jrnlmode3.test 556b447a05be0e0963f4311e95ab1632b11c9eaa F test/keyword1.test 37ef6bba5d2ed5b07ecdd6810571de2956599dff @@ -843,7 +844,7 @@ F test/securedel2.test 2d54c28e46eb1fd6902089958b20b1b056c6f1c5 F test/select1.test be62204d2bd9a5a8a149e9974cfddce893d8f686 F test/select2.test 352480e0e9c66eda9c3044e412abdf5be0215b56 F test/select3.test 2ce595f8fb8e2ac10071d3b4e424cadd4634a054 -F test/select4.test ac1cd55264a43872b49efac3a4f01a95ab6c6d50 +F test/select4.test 824342f382f16b4afe42d0887ef82b3d6abb6075 F test/select5.test e758b8ef94f69b111df4cb819008856655dcd535 F test/select6.test 39eac4a5c03650b2b473c532882273283ee8b7a0 F test/select7.test 7fd2ef598cfabb6b9ff6ac13973b91d0527df49d @@ -901,8 +902,9 @@ F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa F test/speed4p.test 0e51908951677de5a969b723e03a27a1c45db38b F test/speedtest1.c 2b416dca3a155fcaa849540b2e7fc1df12896c23 F test/spellfix.test 24f676831acddd2f4056a598fd731a72c6311f49 +F test/sqldiff1.test 4b6a8cb8619b970ac4869d3a9ec221cd314d6cae F test/sqllimits1.test e05786eaed7950ff6a2d00031d001d8a26131e68 -F test/stat.test 76fd746b85459e812a0193410fb599f0531f22de +F test/stat.test 8de91498c99f5298b303f70f1d1f3b9557af91bf F test/statfault.test f525a7bf633e50afd027700e9a486090684b1ac1 F test/stmt.test 25d64e3dbf9a3ce89558667d7f39d966fe2a71b9 F test/subquery.test d7268d193dd33d5505df965399d3a594e76ae13f @@ -1238,7 +1240,7 @@ F tool/showstat4.c 9515faa8ec176599d4a8288293ba8ec61f7b728a F tool/showwal.c 85cb36d4fe3e93e2fbd63e786e0d1ce42d0c4fad F tool/soak1.tcl 8d407956e1a45b485a8e072470a3e629a27037fe F tool/space_used.tcl f714c41a59e326b8b9042f415b628b561bafa06b -F tool/spaceanal.tcl d5a09620c66a6c144576cb9d2bdfa9a6fbe362a5 +F tool/spaceanal.tcl 713c587a057334de42c41ad9566f10e255d3ad27 F tool/speedtest.tcl 06c76698485ccf597b9e7dbb1ac70706eb873355 F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff @@ -1256,7 +1258,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 46b2d3cef5c22a9e6bd0a4f8411f17b7ec72bd18 31834c3aa7deeafee1163a67caf5f3197f07baf4 -R 930b165f7186607d9f8c07a2f3ae8d3e +P 8a13e1fdbe523f2ace6cbb5bcb22cd4441f3cbf8 85a4a46c3bb9fd8124969c9e975086c795113b7e +R 06f86286adc5e3b19d722d7fe542b28d U dan -Z 1e3e34749eeae85df109f46fe0a4844e +Z 10fff7a0c76d69f1bd9ea7fa3aec1db3 diff --git a/manifest.uuid b/manifest.uuid index 1dd94cd21..b5d5f9578 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8a13e1fdbe523f2ace6cbb5bcb22cd4441f3cbf8
\ No newline at end of file +82e5a6e088c58815140ad36715ac11c96527cb25
\ No newline at end of file diff --git a/src/ctime.c b/src/ctime.c index 4f98ffef6..9503214f5 100644 --- a/src/ctime.c +++ b/src/ctime.c @@ -75,6 +75,9 @@ static const char * const azCompileOpt[] = { #if SQLITE_ENABLE_COLUMN_METADATA "ENABLE_COLUMN_METADATA", #endif +#if SQLITE_ENABLE_DBSTAT_VTAB + "ENABLE_DBSTAT_VTAB", +#endif #if SQLITE_ENABLE_EXPENSIVE_ASSERT "ENABLE_EXPENSIVE_ASSERT", #endif diff --git a/src/dbstat.c b/src/dbstat.c index fb5a52b79..e0ab0cea6 100644 --- a/src/dbstat.c +++ b/src/dbstat.c @@ -122,6 +122,7 @@ struct StatCursor { struct StatTable { sqlite3_vtab base; sqlite3 *db; + int iDb; /* Index of database to analyze */ }; #ifndef get2byte @@ -140,7 +141,17 @@ static int statConnect( ){ StatTable *pTab = 0; int rc = SQLITE_OK; + int iDb; + if( argc>=4 ){ + iDb = sqlite3FindDbName(db, argv[3]); + if( iDb<0 ){ + *pzErr = sqlite3_mprintf("no such database: %s", argv[3]); + return SQLITE_ERROR; + } + }else{ + iDb = 0; + } rc = sqlite3_declare_vtab(db, VTAB_SCHEMA); if( rc==SQLITE_OK ){ pTab = (StatTable *)sqlite3_malloc64(sizeof(StatTable)); @@ -151,6 +162,7 @@ static int statConnect( if( rc==SQLITE_OK ){ memset(pTab, 0, sizeof(StatTable)); pTab->db = db; + pTab->iDb = iDb; } *ppVtab = (sqlite3_vtab*)pTab; @@ -205,16 +217,22 @@ static int statOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){ if( pCsr==0 ){ rc = SQLITE_NOMEM; }else{ + char *zSql; memset(pCsr, 0, sizeof(StatCursor)); pCsr->base.pVtab = pVTab; - rc = sqlite3_prepare_v2(pTab->db, + zSql = sqlite3_mprintf( "SELECT 'sqlite_master' AS name, 1 AS rootpage, 'table' AS type" " UNION ALL " - "SELECT name, rootpage, type FROM sqlite_master WHERE rootpage!=0" - " ORDER BY name", -1, - &pCsr->pStmt, 0 - ); + "SELECT name, rootpage, type" + " FROM \"%w\".sqlite_master WHERE rootpage!=0" + " ORDER BY name", pTab->db->aDb[pTab->iDb].zName); + if( zSql==0 ){ + rc = SQLITE_NOMEM; + }else{ + rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pStmt, 0); + sqlite3_free(zSql); + } if( rc!=SQLITE_OK ){ sqlite3_free(pCsr); pCsr = 0; @@ -380,7 +398,7 @@ static int statDecodePage(Btree *pBt, StatPage *p){ */ static void statSizeAndOffset(StatCursor *pCsr){ StatTable *pTab = (StatTable *)((sqlite3_vtab_cursor *)pCsr)->pVtab; - Btree *pBt = pTab->db->aDb[0].pBt; + Btree *pBt = pTab->db->aDb[pTab->iDb].pBt; Pager *pPager = sqlite3BtreePager(pBt); sqlite3_file *fd; sqlite3_int64 x[2]; @@ -394,7 +412,7 @@ static void statSizeAndOffset(StatCursor *pCsr){ */ fd = sqlite3PagerFile(pPager); x[0] = pCsr->iPageno; - if( sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){ + if( fd->pMethods!=0 && sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){ pCsr->iOffset = x[0]; pCsr->szPage = (int)x[1]; } @@ -406,9 +424,10 @@ static void statSizeAndOffset(StatCursor *pCsr){ static int statNext(sqlite3_vtab_cursor *pCursor){ int rc; int nPayload; + char *z; StatCursor *pCsr = (StatCursor *)pCursor; StatTable *pTab = (StatTable *)pCursor->pVtab; - Btree *pBt = pTab->db->aDb[0].pBt; + Btree *pBt = pTab->db->aDb[pTab->iDb].pBt; Pager *pPager = sqlite3BtreePager(pBt); sqlite3_free(pCsr->zPath); @@ -428,8 +447,9 @@ statNextRestart: rc = sqlite3PagerGet(pPager, iRoot, &pCsr->aPage[0].pPg); pCsr->aPage[0].iPgno = iRoot; pCsr->aPage[0].iCell = 0; - pCsr->aPage[0].zPath = sqlite3_mprintf("/"); + pCsr->aPage[0].zPath = z = sqlite3_mprintf("/"); pCsr->iPage = 0; + if( z==0 ) rc = SQLITE_NOMEM; }else{ pCsr->isEof = 1; return sqlite3_reset(pCsr->pStmt); @@ -452,7 +472,7 @@ statNextRestart: pCsr->zPagetype = "overflow"; pCsr->nCell = 0; pCsr->nMxPayload = 0; - pCsr->zPath = sqlite3_mprintf( + pCsr->zPath = z = sqlite3_mprintf( "%s%.3x+%.6x", p->zPath, p->iCell, pCell->iOvfl ); if( pCell->iOvfl<pCell->nOvfl-1 ){ @@ -464,7 +484,7 @@ statNextRestart: } pCell->iOvfl++; statSizeAndOffset(pCsr); - return SQLITE_OK; + return z==0 ? SQLITE_NOMEM : SQLITE_OK; } if( p->iRightChildPg ) break; p->iCell++; @@ -486,8 +506,9 @@ statNextRestart: } rc = sqlite3PagerGet(pPager, p[1].iPgno, &p[1].pPg); p[1].iCell = 0; - p[1].zPath = sqlite3_mprintf("%s%.3x/", p->zPath, p->iCell); + p[1].zPath = z = sqlite3_mprintf("%s%.3x/", p->zPath, p->iCell); p->iCell++; + if( z==0 ) rc = SQLITE_NOMEM; } @@ -520,7 +541,8 @@ statNextRestart: pCsr->nCell = p->nCell; pCsr->nUnused = p->nUnused; pCsr->nMxPayload = p->nMxPayload; - pCsr->zPath = sqlite3_mprintf("%s", p->zPath); + pCsr->zPath = z = sqlite3_mprintf("%s", p->zPath); + if( z==0 ) rc = SQLITE_NOMEM; nPayload = 0; for(i=0; i<p->nCell; i++){ nPayload += p->aCell[i].nLocal; @@ -556,7 +578,7 @@ static int statColumn( StatCursor *pCsr = (StatCursor *)pCursor; switch( i ){ case 0: /* name */ - sqlite3_result_text(ctx, pCsr->zName, -1, SQLITE_STATIC); + sqlite3_result_text(ctx, pCsr->zName, -1, SQLITE_TRANSIENT); break; case 1: /* path */ sqlite3_result_text(ctx, pCsr->zPath, -1, SQLITE_TRANSIENT); @@ -582,7 +604,8 @@ static int statColumn( case 8: /* pgoffset */ sqlite3_result_int64(ctx, pCsr->iOffset); break; - case 9: /* pgsize */ + default: /* pgsize */ + assert( i==9 ); sqlite3_result_int(ctx, pCsr->szPage); break; } @@ -598,7 +621,7 @@ static int statRowid(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){ /* ** Invoke this routine to register the "dbstat" virtual table module */ -int sqlite3_dbstat_register(sqlite3 *db){ +int sqlite3DbstatRegister(sqlite3 *db){ static sqlite3_module dbstat_module = { 0, /* iVersion */ statConnect, /* xCreate */ diff --git a/src/main.c b/src/main.c index cc819c3fa..83d0b9913 100644 --- a/src/main.c +++ b/src/main.c @@ -2878,8 +2878,7 @@ static int openDatabase( #ifdef SQLITE_ENABLE_DBSTAT_VTAB if( !db->mallocFailed && rc==SQLITE_OK){ - int sqlite3_dbstat_register(sqlite3*); - rc = sqlite3_dbstat_register(db); + rc = sqlite3DbstatRegister(db); } #endif diff --git a/src/malloc.c b/src/malloc.c index f06e27d84..70b834579 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -226,10 +226,8 @@ void sqlite3MallocEnd(void){ ** Return the amount of memory currently checked out. */ sqlite3_int64 sqlite3_memory_used(void){ - int n, mx; - sqlite3_int64 res; - sqlite3_status(SQLITE_STATUS_MEMORY_USED, &n, &mx, 0); - res = (sqlite3_int64)n; /* Work around bug in Borland C. Ticket #3216 */ + sqlite3_int64 res, mx; + sqlite3_status64(SQLITE_STATUS_MEMORY_USED, &res, &mx, 0); return res; } @@ -239,11 +237,9 @@ sqlite3_int64 sqlite3_memory_used(void){ ** or since the most recent reset. */ sqlite3_int64 sqlite3_memory_highwater(int resetFlag){ - int n, mx; - sqlite3_int64 res; - sqlite3_status(SQLITE_STATUS_MEMORY_USED, &n, &mx, resetFlag); - res = (sqlite3_int64)mx; /* Work around bug in Borland C. Ticket #3216 */ - return res; + sqlite3_int64 res, mx; + sqlite3_status64(SQLITE_STATUS_MEMORY_USED, &res, &mx, resetFlag); + return mx; } /* diff --git a/src/resolve.c b/src/resolve.c index b75db42ef..23636eace 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -99,7 +99,6 @@ static void resolveAlias( assert( iCol>=0 && iCol<pEList->nExpr ); pOrig = pEList->a[iCol].pExpr; assert( pOrig!=0 ); - assert( (pOrig->flags & EP_Resolved)!=0 || zType[0]==0 ); db = pParse->db; pDup = sqlite3ExprDup(db, pOrig, 0); if( pDup==0 ) return; diff --git a/src/shell.c b/src/shell.c index 542381a8c..7db8dbda0 100644 --- a/src/shell.c +++ b/src/shell.c @@ -3258,7 +3258,8 @@ static int do_meta_command(char *zLine, ShellState *p){ goto meta_command_exit; } if( nArg==3 ){ - sqlite3_limit(p->db, aLimit[iLimit].limitCode, integerValue(azArg[2])); + sqlite3_limit(p->db, aLimit[iLimit].limitCode, + (int)integerValue(azArg[2])); } printf("%20s %d\n", aLimit[iLimit].zLimitName, sqlite3_limit(p->db, aLimit[iLimit].limitCode, -1)); diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 7b9542a96..d809245a6 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -3867,4 +3867,8 @@ int sqlite3ThreadCreate(SQLiteThread**,void*(*)(void*),void*); int sqlite3ThreadJoin(SQLiteThread*, void**); #endif +#if defined(SQLITE_ENABLE_DBSTAT_VTAB) || defined(SQLITE_TEST) +int sqlite3DbstatRegister(sqlite3*); +#endif + #endif /* _SQLITEINT_H_ */ diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 3e9c98664..b44f5b8fa 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -3706,43 +3706,6 @@ static int db_last_stmt_ptr( } #endif /* SQLITE_TEST */ -#if defined(SQLITE_TEST) || defined(SQLITE_ENABLE_DBSTAT_VTAB) -/* -** tclcmd: register_dbstat_vtab DB -** -** Cause the dbstat virtual table to be available on the connection DB -*/ -static int sqlite3RegisterDbstatCmd( - void *clientData, - Tcl_Interp *interp, - int objc, - Tcl_Obj *CONST objv[] -){ -#ifdef SQLITE_OMIT_VIRTUALTABLE - Tcl_AppendResult(interp, "dbstat not available because of " - "SQLITE_OMIT_VIRTUALTABLE", (void*)0); - return TCL_ERROR; -#else - struct SqliteDb { sqlite3 *db; }; - char *zDb; - Tcl_CmdInfo cmdInfo; - - if( objc!=2 ){ - Tcl_WrongNumArgs(interp, 1, objv, "DB"); - return TCL_ERROR; - } - - zDb = Tcl_GetString(objv[1]); - if( Tcl_GetCommandInfo(interp, zDb, &cmdInfo) ){ - int sqlite3_dbstat_register(sqlite3*); - sqlite3* db = ((struct SqliteDb*)cmdInfo.objClientData)->db; - sqlite3_dbstat_register(db); - } - return TCL_OK; -#endif /* SQLITE_OMIT_VIRTUALTABLE */ -} -#endif /* defined(SQLITE_TEST) || defined(SQLITE_ENABLE_DBSTAT_VTAB) */ - /* ** Configure the interpreter passed as the first argument to have access ** to the commands and linked variables that make up: @@ -3761,16 +3724,6 @@ static void init_all(Tcl_Interp *interp){ Md5_Init(interp); #endif - /* Install the [register_dbstat_vtab] command to access the implementation - ** of virtual table dbstat (source file test_stat.c). This command is - ** required for testfixture and sqlite3_analyzer, but not by the production - ** Tcl extension. */ -#if defined(SQLITE_TEST) || defined(SQLITE_ENABLE_DBSTAT_VTAB) - Tcl_CreateObjCommand( - interp, "register_dbstat_vtab", sqlite3RegisterDbstatCmd, 0, 0 - ); -#endif - #ifdef SQLITE_TEST { extern int Sqliteconfig_Init(Tcl_Interp*); diff --git a/src/test1.c b/src/test1.c index a87fcd859..732ad9e04 100644 --- a/src/test1.c +++ b/src/test1.c @@ -6680,7 +6680,40 @@ static int test_bad_behavior( } return TCL_OK; } - + +/* +** tclcmd: register_dbstat_vtab DB +** +** Cause the dbstat virtual table to be available on the connection DB +*/ +static int test_register_dbstat_vtab( + void *clientData, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[] +){ +#ifdef SQLITE_OMIT_VIRTUALTABLE + Tcl_AppendResult(interp, "dbstat not available because of " + "SQLITE_OMIT_VIRTUALTABLE", (void*)0); + return TCL_ERROR; +#else + struct SqliteDb { sqlite3 *db; }; + char *zDb; + Tcl_CmdInfo cmdInfo; + + if( objc!=2 ){ + Tcl_WrongNumArgs(interp, 1, objv, "DB"); + return TCL_ERROR; + } + + zDb = Tcl_GetString(objv[1]); + if( Tcl_GetCommandInfo(interp, zDb, &cmdInfo) ){ + sqlite3* db = ((struct SqliteDb*)cmdInfo.objClientData)->db; + sqlite3DbstatRegister(db); + } + return TCL_OK; +#endif /* SQLITE_OMIT_VIRTUALTABLE */ +} /* ** Register commands with the TCL interpreter. @@ -6752,6 +6785,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ void *clientData; } aObjCmd[] = { { "bad_behavior", test_bad_behavior, (void*)&iZero }, + { "register_dbstat_vtab", test_register_dbstat_vtab }, { "sqlite3_connection_pointer", get_sqlite_pointer, 0 }, { "sqlite3_bind_int", test_bind_int, 0 }, { "sqlite3_bind_zeroblob", test_bind_zeroblob, 0 }, diff --git a/test/analyzer1.test b/test/analyzer1.test new file mode 100644 index 000000000..9eac241d2 --- /dev/null +++ b/test/analyzer1.test @@ -0,0 +1,39 @@ +# 2015-05-11 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# +# Quick tests for the sqlite3_analyzer tool +# +set testdir [file dirname $argv0] +source $testdir/tester.tcl +if {$tcl_platform(platform)=="windows"} { + set PROG "sqlite3_analyzer.exe" +} else { + set PROG "./sqlite3_analyzer" +} +db close +forcedelete test.db test.db-journal test.db-wal +sqlite3 db test.db + +do_test analyzer1-1.0 { + db eval { + CREATE TABLE t1(a INTEGER PRIMARY KEY, b); + CREATE TABLE t2(a INT PRIMARY KEY, b) WITHOUT ROWID; + WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<250) + INSERT INTO t1(a,b) SELECT x, randomblob(200) FROM c; + INSERT INTO t2(a,b) SELECT a, b FROM t1; + } + set line "exec $PROG test.db" + unset -nocomplain ::MSG + catch {eval $line} ::MSG +} {0} +do_test analyzer1-1.1 { + regexp {^/\*\* Disk-Space Utilization.*COMMIT;\W*$} $::MSG +} {1} diff --git a/test/jrnlmode.test b/test/jrnlmode.test index cebbfe563..2ba56f2b0 100644 --- a/test/jrnlmode.test +++ b/test/jrnlmode.test @@ -559,7 +559,6 @@ do_execsql_test jrnlmode-8.30 { PRAGMA journal_mode=DELETE } {delete} do_test jrnlmode-9.1 { forcedelete test2.db sqlite3 db2 test2.db - breakpoint db2 eval {CREATE TEMP TABLE t(l); PRAGMA journal_mode=off;} db2 close } {} diff --git a/test/select4.test b/test/select4.test index a1619e59c..c0f88a150 100644 --- a/test/select4.test +++ b/test/select4.test @@ -158,6 +158,9 @@ do_test select4-2.4 { }} msg] lappend v $msg } {1 {ORDER BY clause should come after UNION not before}} +do_execsql_test select4-2.5 { + SELECT 123 AS x ORDER BY (SELECT x ORDER BY 1); +} {123} # Except operator # diff --git a/test/sqldiff1.test b/test/sqldiff1.test new file mode 100644 index 000000000..4f4cd7082 --- /dev/null +++ b/test/sqldiff1.test @@ -0,0 +1,57 @@ +# 2015-05-11 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# +# Quick tests for the sqldiff tool +# +set testdir [file dirname $argv0] +source $testdir/tester.tcl +if {$tcl_platform(platform)=="windows"} { + set PROG "sqldiff.exe" +} else { + set PROG "./sqldiff" +} +db close +forcedelete test.db test2.db +sqlite3 db test.db + +do_test sqldiff-1.0 { + db eval { + CREATE TABLE t1(a INTEGER PRIMARY KEY, b); + CREATE TABLE t2(a INT PRIMARY KEY, b) WITHOUT ROWID; + WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100) + INSERT INTO t1(a,b) SELECT x, printf('abc-%d-xyz',x) FROM c; + INSERT INTO t2(a,b) SELECT a, b FROM t1; + } + db backup test2.db + db eval { + ATTACH 'test2.db' AS x2; + DELETE FROM x2.t1 WHERE a=49; + DELETE FROM x2.t2 WHERE a=48; + INSERT INTO x2.t1(a,b) VALUES(1234,'hello'); + INSERT INTO x2.t2(a,b) VALUES(50.5,'xyzzy'); + CREATE TABLE x2.t3(a,b,c); + INSERT INTO x2.t3 VALUES(111,222,333); + CREATE TABLE main.t4(x,y,z); + INSERT INTO t4 SELECT * FROM t3; + } + set line "exec $PROG test.db test2.db" + unset -nocomplain ::MSG + catch {eval $line} ::MSG +} {0} +do_test sqldiff-1.1 { + set ::MSG +} {DELETE FROM t1 WHERE a=49; +INSERT INTO t1(a,b) VALUES(1234,'hello'); +DELETE FROM t2 WHERE a=48; +INSERT INTO t2(a,b) VALUES(50.5,'xyzzy'); +CREATE TABLE t3(a,b,c); +INSERT INTO t3(rowid,a,b,c) VALUES(1,111,222,333); +DROP TABLE t4;} diff --git a/test/stat.test b/test/stat.test index f0447e450..57c1b9eae 100644 --- a/test/stat.test +++ b/test/stat.test @@ -166,8 +166,10 @@ sqlite3 db test.db register_dbstat_vtab db do_execsql_test stat-5.1 { PRAGMA auto_vacuum = OFF; - CREATE VIRTUAL TABLE temp.stat USING dbstat; - CREATE TABLE t1(x); + CREATE TABLE tx(y); + ATTACH ':memory:' AS aux1; + CREATE VIRTUAL TABLE temp.stat USING dbstat(aux1); + CREATE TABLE aux1.t1(x); INSERT INTO t1 VALUES(zeroblob(1513)); INSERT INTO t1 VALUES(zeroblob(1514)); SELECT name, path, pageno, pagetype, ncell, payload, unused, mx_payload @@ -178,4 +180,8 @@ do_execsql_test stat-5.1 { t1 /001+000000 4 overflow 0 1020 0 0 \ ] +do_catchsql_test stat-6.1 { + CREATE VIRTUAL TABLE temp.s2 USING dbstat(mainx); +} {1 {no such database: mainx}} + finish_test diff --git a/tool/spaceanal.tcl b/tool/spaceanal.tcl index 516d28244..cd3785bd7 100644 --- a/tool/spaceanal.tcl +++ b/tool/spaceanal.tcl @@ -88,7 +88,6 @@ if {[catch {sqlite3 db $file_to_analyze -uri 1} msg]} { puts stderr "error trying to open $file_to_analyze: $msg" exit 1 } -register_dbstat_vtab db db eval {SELECT count(*) FROM sqlite_master} set pageSize [expr {wide([db one {PRAGMA page_size}])}] |