/ Check-in [82e5a6e0]
Login

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

Overview
Comment:Merge latest trunk changes into this branch.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fts3-matchinfo-y
Files: files | file ages | folders
SHA1:82e5a6e088c58815140ad36715ac11c96527cb25
User & Date: dan 2015-05-11 18:46:42
Context
2015-05-11
19:01
Add new fts3 matchinfo option 'b'. Also optimize existing option 'y'. check-in: 2e7679a1 user: dan tags: trunk
18:46
Merge latest trunk changes into this branch. Closed-Leaf check-in: 82e5a6e0 user: dan tags: fts3-matchinfo-y
17:46
Test cases for sqlite3_analyzer and sqldiff. Fix a problem with sqlite3_analyzer related to the renaming of the initialization routine. check-in: 85a4a46c user: drh tags: trunk
2015-05-06
18:15
Merge latest trunk changes with this branch. check-in: 8a13e1fd user: dan tags: fts3-matchinfo-y
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.in.

   505    505     $(TOP)/ext/fts3/fts3_tokenizer.h
   506    506   EXTHDR += \
   507    507     $(TOP)/ext/rtree/rtree.h
   508    508   EXTHDR += \
   509    509     $(TOP)/ext/icu/sqliteicu.h
   510    510   EXTHDR += \
   511    511     $(TOP)/ext/rtree/sqlite3rtree.h
          512  +
          513  +# executables needed for testing
          514  +#
          515  +TESTPROGS = \
          516  +  testfixture$(TEXE) \
          517  +  sqlite3$(TEXE) \
          518  +  sqlite3_analyzer$(TEXE) \
          519  +  sqldiff$(TEXE)
          520  +
   512    521   
   513    522   # This is the default Makefile target.  The objects listed here
   514    523   # are what get build when you type just "make" with no arguments.
   515    524   #
   516    525   all:	sqlite3.h libsqlite3.la sqlite3$(TEXE) $(HAVE_TCL:1=libtclsqlite3.la)
   517    526   
   518    527   Makefile: $(TOP)/Makefile.in
................................................................................
   951    960   TESTFIXTURE_SRC += $(TESTFIXTURE_SRC$(USE_AMALGAMATION))
   952    961   
   953    962   testfixture$(TEXE):	$(TESTFIXTURE_SRC)
   954    963   	$(LTLINK) -DSQLITE_NO_SYNC=1 $(TEMP_STORE) $(TESTFIXTURE_FLAGS) \
   955    964   		-o $@ $(TESTFIXTURE_SRC) $(LIBTCL) $(TLIBS)
   956    965   
   957    966   # A very detailed test running most or all test cases
   958         -fulltest:	testfixture$(TEXE) sqlite3$(TEXE) fuzztest
          967  +fulltest:	$(TESTPROGS) fuzztest
   959    968   	./testfixture$(TEXE) $(TOP)/test/all.test
   960    969   
   961    970   # Really really long testing
   962         -soaktest:	testfixture$(TEXE) sqlite3$(TEXE) fuzzoomtest
          971  +soaktest:	$(TESTPROGS) fuzzoomtest
   963    972   	./testfixture$(TEXE) $(TOP)/test/all.test -soak=1
   964    973   
   965         -# Do extra testing but not aeverything.
   966         -fulltestonly:	testfixture$(TEXE) sqlite3$(TEXE)
          974  +# Do extra testing but not everything.
          975  +fulltestonly:	$(TESTPROGS)
   967    976   	./testfixture$(TEXE) $(TOP)/test/full.test
   968    977   
   969    978   # Fuzz testing
   970    979   fuzztest:	fuzzershell$(TEXE)
   971    980   	./fuzzershell$(TEXE) $(TOP)/test/fuzzdata1.txt $(TOP)/test/fuzzdata2.txt
   972    981   
   973    982   fuzzoomtest:	fuzzershell$(TEXE)
   974    983   	./fuzzershell$(TEXE) -f $(TOP)/test/fuzzdata1.txt --oom
   975    984   
   976    985   # This is the common case.  Run many tests but not those that take
   977    986   # a really long time.
   978    987   #
   979         -test:	testfixture$(TEXE) sqlite3$(TEXE) fuzztest
          988  +test:	$(TESTPROGS) fuzztest
   980    989   	./testfixture$(TEXE) $(TOP)/test/veryquick.test
   981    990   
   982    991   # Run a test using valgrind.  This can take a really long time
   983    992   # because valgrind is so much slower than a native machine.
   984    993   #
   985         -valgrindtest:	testfixture$(TEXE) sqlite3$(TEXE) fuzzershell$(TEXE)
          994  +valgrindtest:	$(TESTPROGS) fuzzershell$(TEXE)
   986    995   	valgrind -v ./fuzzershell$(TEXE) -f $(TOP)/test/fuzzdata1.txt
   987    996   	OMIT_MISUSE=1 valgrind -v ./testfixture$(TEXE) $(TOP)/test/permutations.test valgrind
   988    997   
   989    998   # A very fast test that checks basic sanity.  The name comes from
   990    999   # the 60s-era electronics testing:  "Turn it on and see if smoke
   991   1000   # comes out."
   992   1001   #
   993         -smoketest:	testfixture$(TEXE) fuzzershell$(TEXE)
         1002  +smoketest:	$(TESTPROGS) fuzzershell$(TEXE)
   994   1003   	./testfixture$(TEXE) $(TOP)/test/main.test
   995   1004   
   996   1005   sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl
   997   1006   	echo "#define TCLSH 2" > $@
   998         -	echo "#define SQLITE_ENABLE_DBSTAT_VTAB" >> $@
         1007  +	echo "#define SQLITE_ENABLE_DBSTAT_VTAB 1" >> $@
   999   1008   	cat sqlite3.c $(TOP)/src/tclsqlite.c >> $@
  1000   1009   	echo "static const char *tclsh_main_loop(void){" >> $@
  1001   1010   	echo "static const char *zMainloop = " >> $@
  1002   1011   	$(NAWK) -f $(TOP)/tool/tostr.awk $(TOP)/tool/spaceanal.tcl >> $@
  1003   1012   	echo "; return zMainloop; }" >> $@
  1004   1013   
  1005   1014   sqlite3_analyzer$(TEXE): sqlite3_analyzer.c
................................................................................
  1102   1111   	rm -f sqlite3.dll sqlite3.lib sqlite3.exp sqlite3.def
  1103   1112   	rm -f sqlite3.c
  1104   1113   	rm -f sqlite3rc.h
  1105   1114   	rm -f shell.c sqlite3ext.h
  1106   1115   	rm -f sqlite3_analyzer$(TEXE) sqlite3_analyzer.c
  1107   1116   	rm -f sqlite-*-output.vsix
  1108   1117   	rm -f mptester mptester.exe
         1118  +	rm -f fuzzershell fuzzershell.exe
         1119  +	rm -f sqldiff sqldiff.exe
  1109   1120   
  1110   1121   distclean:	clean
  1111   1122   	rm -f config.log config.status libtool Makefile sqlite3.pc
  1112   1123   
  1113   1124   #
  1114   1125   # Windows section
  1115   1126   #

Changes to Makefile.msc.

  1167   1167     $(TOP)\ext\fts3\fts3_tokenizer.h
  1168   1168   EXTHDR = $(EXTHDR) \
  1169   1169     $(TOP)\ext\rtree\rtree.h
  1170   1170   EXTHDR = $(EXTHDR) \
  1171   1171     $(TOP)\ext\icu\sqliteicu.h
  1172   1172   EXTHDR = $(EXTHDR) \
  1173   1173     $(TOP)\ext\rtree\sqlite3rtree.h
         1174  +
         1175  +# executables needed for testing
         1176  +#
         1177  +TESTPROGS = \
         1178  +  testfixture.exe \
         1179  +  sqlite3.exe \
         1180  +  sqlite3_analyzer.exe \
         1181  +  sqldiff.exe
         1182  +
  1174   1183   
  1175   1184   # This is the default Makefile target.  The objects listed here
  1176   1185   # are what get build when you type just "make" with no arguments.
  1177   1186   #
  1178   1187   all:	dll libsqlite3.lib sqlite3.exe libtclsqlite3.lib
  1179   1188   
  1180   1189   libsqlite3.lib:	$(LIBOBJ)
................................................................................
  1631   1640   		-DBUILD_sqlite -I$(TCLINCDIR) \
  1632   1641   		$(TESTFIXTURE_SRC) \
  1633   1642   		/link $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
  1634   1643   
  1635   1644   extensiontest: testfixture.exe testloadext.dll
  1636   1645   	.\testfixture.exe $(TOP)\test\loadext.test
  1637   1646   
  1638         -fulltest:	testfixture.exe sqlite3.exe fuzztest
         1647  +fulltest:	$(TESTPROGS) fuzztest
  1639   1648   	.\testfixture.exe $(TOP)\test\all.test
  1640   1649   
  1641         -soaktest:	testfixture.exe sqlite3.exe fuzzoomtest
         1650  +soaktest:	$(TESTPROGS) fuzzoomtest
  1642   1651   	.\testfixture.exe $(TOP)\test\all.test -soak=1
  1643   1652   
  1644         -fulltestonly:	testfixture.exe sqlite3.exe fuzztest
         1653  +fulltestonly:	$(TESTPROGS) fuzztest
  1645   1654   	.\testfixture.exe $(TOP)\test\full.test
  1646   1655   
  1647   1656   queryplantest:	testfixture.exe sqlite3.exe
  1648   1657   	.\testfixture.exe $(TOP)\test\permutations.test queryplanner
  1649   1658   
  1650   1659   fuzztest:	fuzzershell.exe
  1651   1660   	.\fuzzershell.exe $(TOP)\test\fuzzdata1.txt $(TOP)\test\fuzzdata2.txt
  1652   1661   
  1653   1662   fuzzoomtest:	fuzzershell.exe
  1654   1663   	.\fuzzershell.exe -f $(TOP)\test\fuzzdata1.txt --oom
  1655   1664   
  1656         -test:	testfixture.exe sqlite3.exe fuzztest
         1665  +test:	$(TESTPROGS) fuzztest
  1657   1666   	.\testfixture.exe $(TOP)\test\veryquick.test
  1658   1667   
  1659         -smoketest:	testfixture.exe
         1668  +smoketest:	$(TESTPROGS) fuzzershell.exe
  1660   1669   	.\testfixture.exe $(TOP)\test\main.test
  1661   1670   
  1662   1671   sqlite3_analyzer.c: $(SQLITE3C) $(TOP)\src\tclsqlite.c $(TOP)\tool\spaceanal.tcl
  1663         -	copy $(SQLITE3C) + $(TOP)\src\tclsqlite.c $@
         1672  +	echo #define TCLSH 2 > $@
         1673  +	echo #define SQLITE_ENABLE_DBSTAT_VTAB 1 >> $@
         1674  +	copy $@ + $(SQLITE3C) + $(TOP)\src\tclsqlite.c $@
  1664   1675   	echo static const char *tclsh_main_loop(void){ >> $@
  1665   1676   	echo static const char *zMainloop = >> $@
  1666   1677   	$(NAWK) -f $(TOP)\tool\tostr.awk $(TOP)\tool\spaceanal.tcl >> $@
  1667   1678   	echo ; return zMainloop; } >> $@
  1668   1679   
  1669   1680   sqlite3_analyzer.exe:	sqlite3_analyzer.c $(LIBRESOBJS)
  1670         -	$(LTLINK) $(NO_WARN) -DBUILD_sqlite -DSQLITE_ENABLE_DBSTAT_VTAB -DTCLSH=2 -I$(TCLINCDIR) sqlite3_analyzer.c \
         1681  +	$(LTLINK) $(NO_WARN) -DBUILD_sqlite -I$(TCLINCDIR) sqlite3_analyzer.c \
  1671   1682   		/link $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
  1672   1683   
  1673   1684   testloadext.lo:	$(TOP)\src\test_loadext.c
  1674   1685   	$(LTCOMPILE) $(NO_WARN) -c $(TOP)\src\test_loadext.c
  1675   1686   
  1676   1687   testloadext.dll: testloadext.lo
  1677   1688   	$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /OUT:$@ testloadext.lo
................................................................................
  1733   1744   	del /Q mptester.exe wordcount.exe 2>NUL
  1734   1745   	del /Q sqlite3.exe sqlite3.dll sqlite3.def 2>NUL
  1735   1746   	del /Q sqlite3.c sqlite3-*.c 2>NUL
  1736   1747   	del /Q sqlite3rc.h 2>NUL
  1737   1748   	del /Q shell.c sqlite3ext.h 2>NUL
  1738   1749   	del /Q sqlite3_analyzer.exe sqlite3_analyzer.c 2>NUL
  1739   1750   	del /Q sqlite-*-output.vsix 2>NUL
         1751  +	del /Q fuzzershell.exe sqldiff.exe 2>NUL
  1740   1752   
  1741   1753   # Dynamic link library section.
  1742   1754   #
  1743   1755   dll: sqlite3.dll
  1744   1756   
  1745   1757   sqlite3.def: libsqlite3.lib
  1746   1758   	echo EXPORTS > sqlite3.def
  1747   1759   	dumpbin /all libsqlite3.lib \
  1748   1760   		| $(NAWK) "/ 1 _?sqlite3_/ { sub(/^.* _?/,\"\");print }" \
  1749   1761   		| sort >> sqlite3.def
  1750   1762   
  1751   1763   sqlite3.dll: $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
  1752   1764   	$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)

Changes to VERSION.

     1         -3.8.10
            1  +3.8.10.1

Changes to autoconf/Makefile.am.

     2      2   AM_CFLAGS = @THREADSAFE_FLAGS@ @DYNAMIC_EXTENSION_FLAGS@ -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE
     3      3   
     4      4   lib_LTLIBRARIES = libsqlite3.la
     5      5   libsqlite3_la_SOURCES = sqlite3.c
     6      6   libsqlite3_la_LDFLAGS = -no-undefined -version-info 8:6:8
     7      7   
     8      8   bin_PROGRAMS = sqlite3
     9         -sqlite3_SOURCES = shell.c sqlite3.h
    10         -sqlite3_LDADD = sqlite3.$(OBJEXT) @READLINE_LIBS@
            9  +sqlite3_SOURCES = shell.c sqlite3.c sqlite3.h
           10  +sqlite3_LDADD = @READLINE_LIBS@
           11  +sqlite3_CFLAGS = $(AM_CFLAGS)
    11     12   
    12     13   include_HEADERS = sqlite3.h sqlite3ext.h
    13     14   
    14     15   EXTRA_DIST = sqlite3.1 tea
    15     16   pkgconfigdir = ${libdir}/pkgconfig
    16     17   pkgconfig_DATA = sqlite3.pc
    17     18   
    18     19   man_MANS = sqlite3.1

Changes to configure.

     1      1   #! /bin/sh
     2      2   # Guess values for system-dependent variables and create Makefiles.
     3         -# Generated by GNU Autoconf 2.62 for sqlite 3.8.10.
            3  +# Generated by GNU Autoconf 2.62 for sqlite 3.8.10.1.
     4      4   #
     5      5   # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
     6      6   # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
     7      7   # This configure script is free software; the Free Software Foundation
     8      8   # gives unlimited permission to copy, distribute and modify it.
     9      9   ## --------------------- ##
    10     10   ## M4sh Initialization.  ##
................................................................................
   739    739   MFLAGS=
   740    740   MAKEFLAGS=
   741    741   SHELL=${CONFIG_SHELL-/bin/sh}
   742    742   
   743    743   # Identity of this package.
   744    744   PACKAGE_NAME='sqlite'
   745    745   PACKAGE_TARNAME='sqlite'
   746         -PACKAGE_VERSION='3.8.10'
   747         -PACKAGE_STRING='sqlite 3.8.10'
          746  +PACKAGE_VERSION='3.8.10.1'
          747  +PACKAGE_STRING='sqlite 3.8.10.1'
   748    748   PACKAGE_BUGREPORT=''
   749    749   
   750    750   # Factoring default headers for most tests.
   751    751   ac_includes_default="\
   752    752   #include <stdio.h>
   753    753   #ifdef HAVE_SYS_TYPES_H
   754    754   # include <sys/types.h>
................................................................................
  1477   1477   #
  1478   1478   # Report the --help message.
  1479   1479   #
  1480   1480   if test "$ac_init_help" = "long"; then
  1481   1481     # Omit some internal or obsolete options to make the list less imposing.
  1482   1482     # This message is too long to be a string in the A/UX 3.1 sh.
  1483   1483     cat <<_ACEOF
  1484         -\`configure' configures sqlite 3.8.10 to adapt to many kinds of systems.
         1484  +\`configure' configures sqlite 3.8.10.1 to adapt to many kinds of systems.
  1485   1485   
  1486   1486   Usage: $0 [OPTION]... [VAR=VALUE]...
  1487   1487   
  1488   1488   To assign environment variables (e.g., CC, CFLAGS...), specify them as
  1489   1489   VAR=VALUE.  See below for descriptions of some of the useful variables.
  1490   1490   
  1491   1491   Defaults for the options are specified in brackets.
................................................................................
  1542   1542     --build=BUILD     configure for building on BUILD [guessed]
  1543   1543     --host=HOST       cross-compile to build programs to run on HOST [BUILD]
  1544   1544   _ACEOF
  1545   1545   fi
  1546   1546   
  1547   1547   if test -n "$ac_init_help"; then
  1548   1548     case $ac_init_help in
  1549         -     short | recursive ) echo "Configuration of sqlite 3.8.10:";;
         1549  +     short | recursive ) echo "Configuration of sqlite 3.8.10.1:";;
  1550   1550      esac
  1551   1551     cat <<\_ACEOF
  1552   1552   
  1553   1553   Optional Features:
  1554   1554     --disable-option-checking  ignore unrecognized --enable/--with options
  1555   1555     --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  1556   1556     --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
................................................................................
  1656   1656       cd "$ac_pwd" || { ac_status=$?; break; }
  1657   1657     done
  1658   1658   fi
  1659   1659   
  1660   1660   test -n "$ac_init_help" && exit $ac_status
  1661   1661   if $ac_init_version; then
  1662   1662     cat <<\_ACEOF
  1663         -sqlite configure 3.8.10
         1663  +sqlite configure 3.8.10.1
  1664   1664   generated by GNU Autoconf 2.62
  1665   1665   
  1666   1666   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
  1667   1667   2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
  1668   1668   This configure script is free software; the Free Software Foundation
  1669   1669   gives unlimited permission to copy, distribute and modify it.
  1670   1670   _ACEOF
  1671   1671     exit
  1672   1672   fi
  1673   1673   cat >config.log <<_ACEOF
  1674   1674   This file contains any messages produced by compilers while
  1675   1675   running configure, to aid debugging if configure makes a mistake.
  1676   1676   
  1677         -It was created by sqlite $as_me 3.8.10, which was
         1677  +It was created by sqlite $as_me 3.8.10.1, which was
  1678   1678   generated by GNU Autoconf 2.62.  Invocation command line was
  1679   1679   
  1680   1680     $ $0 $@
  1681   1681   
  1682   1682   _ACEOF
  1683   1683   exec 5>>config.log
  1684   1684   {
................................................................................
 13949  13949   
 13950  13950   exec 6>&1
 13951  13951   
 13952  13952   # Save the log message, to keep $[0] and so on meaningful, and to
 13953  13953   # report actual input values of CONFIG_FILES etc. instead of their
 13954  13954   # values after options handling.
 13955  13955   ac_log="
 13956         -This file was extended by sqlite $as_me 3.8.10, which was
        13956  +This file was extended by sqlite $as_me 3.8.10.1, which was
 13957  13957   generated by GNU Autoconf 2.62.  Invocation command line was
 13958  13958   
 13959  13959     CONFIG_FILES    = $CONFIG_FILES
 13960  13960     CONFIG_HEADERS  = $CONFIG_HEADERS
 13961  13961     CONFIG_LINKS    = $CONFIG_LINKS
 13962  13962     CONFIG_COMMANDS = $CONFIG_COMMANDS
 13963  13963     $ $0 $@
................................................................................
 14002  14002   $config_commands
 14003  14003   
 14004  14004   Report bugs to <bug-autoconf@gnu.org>."
 14005  14005   
 14006  14006   _ACEOF
 14007  14007   cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 14008  14008   ac_cs_version="\\
 14009         -sqlite config.status 3.8.10
        14009  +sqlite config.status 3.8.10.1
 14010  14010   configured by $0, generated by GNU Autoconf 2.62,
 14011  14011     with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 14012  14012   
 14013  14013   Copyright (C) 2008 Free Software Foundation, Inc.
 14014  14014   This config.status script is free software; the Free Software Foundation
 14015  14015   gives unlimited permission to copy, distribute and modify it."
 14016  14016   

Changes to ext/rtree/rtree9.test.

    83     83   
    84     84   
    85     85   #-------------------------------------------------------------------------
    86     86   # Test the example 2d "circle" geometry callback.
    87     87   #
    88     88   register_circle_geom db
    89     89   
    90         -breakpoint
    91     90   do_execsql_test rtree9-5.1 {
    92     91     CREATE VIRTUAL TABLE rt2 USING rtree(id, xmin, xmax, ymin, ymax);
    93     92   
    94     93     INSERT INTO rt2 VALUES(1,    1,   2,  1,  2);
    95     94     INSERT INTO rt2 VALUES(2,    1,   2, -2, -1);
    96     95     INSERT INTO rt2 VALUES(3,    -2, -1, -2, -1);
    97     96     INSERT INTO rt2 VALUES(4,    -2, -1,  1,  2);

Changes to main.mk.

   386    386     $(TOP)/ext/fts3/fts3_tokenizer.h
   387    387   EXTHDR += \
   388    388     $(TOP)/ext/rtree/rtree.h
   389    389   EXTHDR += \
   390    390     $(TOP)/ext/icu/sqliteicu.h
   391    391   EXTHDR += \
   392    392     $(TOP)/ext/userauth/sqlite3userauth.h
          393  +
          394  +# executables needed for testing
          395  +#
          396  +TESTPROGS = \
          397  +  testfixture$(EXE) \
          398  +  sqlite3$(EXE) \
          399  +  sqlite3_analyzer$(EXE) \
          400  +  sqldiff$(EXE)
   393    401   
   394    402   # This is the default Makefile target.  The objects listed here
   395    403   # are what get build when you type just "make" with no arguments.
   396    404   #
   397    405   all:	sqlite3.h libsqlite3.a sqlite3$(EXE)
   398    406   
   399    407   libsqlite3.a:	$(LIBOBJ)
................................................................................
   631    639   
   632    640   fts3-testfixture$(EXE): sqlite3.c fts3amal.c $(TESTSRC) $(TOP)/src/tclsqlite.c
   633    641   	$(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS)                  \
   634    642   	-DSQLITE_ENABLE_FTS3=1                                               \
   635    643   		$(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c fts3amal.c       \
   636    644   		-o testfixture$(EXE) $(LIBTCL) $(THREADLIB)
   637    645   
   638         -fulltest:	testfixture$(EXE) sqlite3$(EXE) fuzztest
          646  +fulltest:	$(TESTPROGS) fuzztest
   639    647   	./testfixture$(EXE) $(TOP)/test/all.test
   640    648   
   641         -soaktest:	testfixture$(EXE) sqlite3$(EXE) fuzzoomtest
          649  +soaktest:	$(TESTPROGS) fuzzoomtest
   642    650   	./testfixture$(EXE) $(TOP)/test/all.test -soak=1
   643    651   
   644         -fulltestonly:	testfixture$(EXE) sqlite3$(EXE) fuzztest
          652  +fulltestonly:	$(TESTPROGS) fuzztest
   645    653   	./testfixture$(EXE) $(TOP)/test/full.test
   646    654   
   647    655   queryplantest:	testfixture$(EXE) sqlite3$(EXE)
   648    656   	./testfixture$(EXE) $(TOP)/test/permutations.test queryplanner
   649    657   
   650    658   fuzztest:	fuzzershell$(EXE)
   651    659   	./fuzzershell$(EXE) $(TOP)/test/fuzzdata1.txt $(TOP)/test/fuzzdata2.txt
   652    660   
   653    661   fuzzoomtest:	fuzzershell$(EXE)
   654    662   	./fuzzershell$(EXE) -f $(TOP)/test/fuzzdata1.txt --oom
   655    663   
   656         -test:	testfixture$(EXE) sqlite3$(EXE) fuzztest
          664  +test:	$(TESTPROGS) fuzztest
   657    665   	./testfixture$(EXE) $(TOP)/test/veryquick.test
   658    666   
   659    667   # Run a test using valgrind.  This can take a really long time
   660    668   # because valgrind is so much slower than a native machine.
   661    669   #
   662         -valgrindtest:	testfixture$(EXE) sqlite3$(EXE) fuzzershell$(EXE)
          670  +valgrindtest:	$(TESTPROGS) fuzzershell$(EXE)
   663    671   	valgrind -v ./fuzzershell$(EXE) -f $(TOP)/test/fuzzdata1.txt
   664    672   	OMIT_MISUSE=1 valgrind -v ./testfixture$(EXE) $(TOP)/test/permutations.test valgrind
          673  +
          674  +# A very fast test that checks basic sanity.  The name comes from
          675  +# the 60s-era electronics testing:  "Turn it on and see if smoke
          676  +# comes out."
          677  +#
          678  +smoketest:	$(TESTPROGS) fuzzershell$(EXE)
          679  +	./testfixture$(EXE) $(TOP)/test/main.test
   665    680   
   666    681   # The next two rules are used to support the "threadtest" target. Building
   667    682   # threadtest runs a few thread-safety tests that are implemented in C. This
   668    683   # target is invoked by the releasetest.tcl script.
   669    684   # 
   670    685   THREADTEST3_SRC = $(TOP)/test/threadtest3.c    \
   671    686                     $(TOP)/test/tt3_checkpoint.c \
................................................................................
   765    780   	rm -f wordcount wordcount.exe
   766    781   	rm -f sqlite3.c sqlite3-*.c fts?amal.c tclsqlite3.c
   767    782   	rm -f sqlite3rc.h
   768    783   	rm -f shell.c sqlite3ext.h
   769    784   	rm -f sqlite3_analyzer sqlite3_analyzer.exe sqlite3_analyzer.c
   770    785   	rm -f sqlite-*-output.vsix
   771    786   	rm -f mptester mptester.exe
          787  +	rm -f fuzzershell fuzzershell.exe
          788  +	rm -f sqldiff sqldiff.exe

Changes to src/ctime.c.

    70     70     "ENABLE_ATOMIC_WRITE",
    71     71   #endif
    72     72   #if SQLITE_ENABLE_CEROD
    73     73     "ENABLE_CEROD",
    74     74   #endif
    75     75   #if SQLITE_ENABLE_COLUMN_METADATA
    76     76     "ENABLE_COLUMN_METADATA",
           77  +#endif
           78  +#if SQLITE_ENABLE_DBSTAT_VTAB
           79  +  "ENABLE_DBSTAT_VTAB",
    77     80   #endif
    78     81   #if SQLITE_ENABLE_EXPENSIVE_ASSERT
    79     82     "ENABLE_EXPENSIVE_ASSERT",
    80     83   #endif
    81     84   #if SQLITE_ENABLE_FTS1
    82     85     "ENABLE_FTS1",
    83     86   #endif

Changes to src/dbstat.c.

   118    118     i64 iOffset;                    /* Value of 'pgOffset' column */
   119    119     int szPage;                     /* Value of 'pgSize' column */
   120    120   };
   121    121   
   122    122   struct StatTable {
   123    123     sqlite3_vtab base;
   124    124     sqlite3 *db;
          125  +  int iDb;                        /* Index of database to analyze */
   125    126   };
   126    127   
   127    128   #ifndef get2byte
   128    129   # define get2byte(x)   ((x)[0]<<8 | (x)[1])
   129    130   #endif
   130    131   
   131    132   /*
................................................................................
   136    137     void *pAux,
   137    138     int argc, const char *const*argv,
   138    139     sqlite3_vtab **ppVtab,
   139    140     char **pzErr
   140    141   ){
   141    142     StatTable *pTab = 0;
   142    143     int rc = SQLITE_OK;
          144  +  int iDb;
   143    145   
          146  +  if( argc>=4 ){
          147  +    iDb = sqlite3FindDbName(db, argv[3]);
          148  +    if( iDb<0 ){
          149  +      *pzErr = sqlite3_mprintf("no such database: %s", argv[3]);
          150  +      return SQLITE_ERROR;
          151  +    }
          152  +  }else{
          153  +    iDb = 0;
          154  +  }
   144    155     rc = sqlite3_declare_vtab(db, VTAB_SCHEMA);
   145    156     if( rc==SQLITE_OK ){
   146    157       pTab = (StatTable *)sqlite3_malloc64(sizeof(StatTable));
   147    158       if( pTab==0 ) rc = SQLITE_NOMEM;
   148    159     }
   149    160   
   150    161     assert( rc==SQLITE_OK || pTab==0 );
   151    162     if( rc==SQLITE_OK ){
   152    163       memset(pTab, 0, sizeof(StatTable));
   153    164       pTab->db = db;
          165  +    pTab->iDb = iDb;
   154    166     }
   155    167   
   156    168     *ppVtab = (sqlite3_vtab*)pTab;
   157    169     return rc;
   158    170   }
   159    171   
   160    172   /*
................................................................................
   201    213     StatCursor *pCsr;
   202    214     int rc;
   203    215   
   204    216     pCsr = (StatCursor *)sqlite3_malloc64(sizeof(StatCursor));
   205    217     if( pCsr==0 ){
   206    218       rc = SQLITE_NOMEM;
   207    219     }else{
          220  +    char *zSql;
   208    221       memset(pCsr, 0, sizeof(StatCursor));
   209    222       pCsr->base.pVtab = pVTab;
   210    223   
   211         -    rc = sqlite3_prepare_v2(pTab->db, 
          224  +    zSql = sqlite3_mprintf(
   212    225           "SELECT 'sqlite_master' AS name, 1 AS rootpage, 'table' AS type"
   213    226           "  UNION ALL  "
   214         -        "SELECT name, rootpage, type FROM sqlite_master WHERE rootpage!=0"
   215         -        "  ORDER BY name", -1,
   216         -        &pCsr->pStmt, 0
   217         -        );
          227  +        "SELECT name, rootpage, type"
          228  +        "  FROM \"%w\".sqlite_master WHERE rootpage!=0"
          229  +        "  ORDER BY name", pTab->db->aDb[pTab->iDb].zName);
          230  +    if( zSql==0 ){
          231  +      rc = SQLITE_NOMEM;
          232  +    }else{
          233  +      rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pStmt, 0);
          234  +      sqlite3_free(zSql);
          235  +    }
   218    236       if( rc!=SQLITE_OK ){
   219    237         sqlite3_free(pCsr);
   220    238         pCsr = 0;
   221    239       }
   222    240     }
   223    241   
   224    242     *ppCursor = (sqlite3_vtab_cursor *)pCsr;
................................................................................
   376    394   
   377    395   /*
   378    396   ** Populate the pCsr->iOffset and pCsr->szPage member variables. Based on
   379    397   ** the current value of pCsr->iPageno.
   380    398   */
   381    399   static void statSizeAndOffset(StatCursor *pCsr){
   382    400     StatTable *pTab = (StatTable *)((sqlite3_vtab_cursor *)pCsr)->pVtab;
   383         -  Btree *pBt = pTab->db->aDb[0].pBt;
          401  +  Btree *pBt = pTab->db->aDb[pTab->iDb].pBt;
   384    402     Pager *pPager = sqlite3BtreePager(pBt);
   385    403     sqlite3_file *fd;
   386    404     sqlite3_int64 x[2];
   387    405   
   388    406     /* The default page size and offset */
   389    407     pCsr->szPage = sqlite3BtreeGetPageSize(pBt);
   390    408     pCsr->iOffset = (i64)pCsr->szPage * (pCsr->iPageno - 1);
   391    409   
   392    410     /* If connected to a ZIPVFS backend, override the page size and
   393    411     ** offset with actual values obtained from ZIPVFS.
   394    412     */
   395    413     fd = sqlite3PagerFile(pPager);
   396    414     x[0] = pCsr->iPageno;
   397         -  if( sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){
          415  +  if( fd->pMethods!=0 && sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){
   398    416       pCsr->iOffset = x[0];
   399    417       pCsr->szPage = (int)x[1];
   400    418     }
   401    419   }
   402    420   
   403    421   /*
   404    422   ** Move a statvfs cursor to the next entry in the file.
   405    423   */
   406    424   static int statNext(sqlite3_vtab_cursor *pCursor){
   407    425     int rc;
   408    426     int nPayload;
          427  +  char *z;
   409    428     StatCursor *pCsr = (StatCursor *)pCursor;
   410    429     StatTable *pTab = (StatTable *)pCursor->pVtab;
   411         -  Btree *pBt = pTab->db->aDb[0].pBt;
          430  +  Btree *pBt = pTab->db->aDb[pTab->iDb].pBt;
   412    431     Pager *pPager = sqlite3BtreePager(pBt);
   413    432   
   414    433     sqlite3_free(pCsr->zPath);
   415    434     pCsr->zPath = 0;
   416    435   
   417    436   statNextRestart:
   418    437     if( pCsr->aPage[0].pPg==0 ){
................................................................................
   424    443         if( nPage==0 ){
   425    444           pCsr->isEof = 1;
   426    445           return sqlite3_reset(pCsr->pStmt);
   427    446         }
   428    447         rc = sqlite3PagerGet(pPager, iRoot, &pCsr->aPage[0].pPg);
   429    448         pCsr->aPage[0].iPgno = iRoot;
   430    449         pCsr->aPage[0].iCell = 0;
   431         -      pCsr->aPage[0].zPath = sqlite3_mprintf("/");
          450  +      pCsr->aPage[0].zPath = z = sqlite3_mprintf("/");
   432    451         pCsr->iPage = 0;
          452  +      if( z==0 ) rc = SQLITE_NOMEM;
   433    453       }else{
   434    454         pCsr->isEof = 1;
   435    455         return sqlite3_reset(pCsr->pStmt);
   436    456       }
   437    457     }else{
   438    458   
   439    459       /* Page p itself has already been visited. */
................................................................................
   448    468                           sqlite3BtreeGetReserveNoMutex(pBt);
   449    469           sqlite3BtreeLeave(pBt);
   450    470           pCsr->zName = (char *)sqlite3_column_text(pCsr->pStmt, 0);
   451    471           pCsr->iPageno = pCell->aOvfl[pCell->iOvfl];
   452    472           pCsr->zPagetype = "overflow";
   453    473           pCsr->nCell = 0;
   454    474           pCsr->nMxPayload = 0;
   455         -        pCsr->zPath = sqlite3_mprintf(
          475  +        pCsr->zPath = z = sqlite3_mprintf(
   456    476               "%s%.3x+%.6x", p->zPath, p->iCell, pCell->iOvfl
   457    477           );
   458    478           if( pCell->iOvfl<pCell->nOvfl-1 ){
   459    479             pCsr->nUnused = 0;
   460    480             pCsr->nPayload = nUsable - 4;
   461    481           }else{
   462    482             pCsr->nPayload = pCell->nLastOvfl;
   463    483             pCsr->nUnused = nUsable - 4 - pCsr->nPayload;
   464    484           }
   465    485           pCell->iOvfl++;
   466    486           statSizeAndOffset(pCsr);
   467         -        return SQLITE_OK;
          487  +        return z==0 ? SQLITE_NOMEM : SQLITE_OK;
   468    488         }
   469    489         if( p->iRightChildPg ) break;
   470    490         p->iCell++;
   471    491       }
   472    492   
   473    493       if( !p->iRightChildPg || p->iCell>p->nCell ){
   474    494         statClearPage(p);
................................................................................
   482    502       if( p->iCell==p->nCell ){
   483    503         p[1].iPgno = p->iRightChildPg;
   484    504       }else{
   485    505         p[1].iPgno = p->aCell[p->iCell].iChildPg;
   486    506       }
   487    507       rc = sqlite3PagerGet(pPager, p[1].iPgno, &p[1].pPg);
   488    508       p[1].iCell = 0;
   489         -    p[1].zPath = sqlite3_mprintf("%s%.3x/", p->zPath, p->iCell);
          509  +    p[1].zPath = z = sqlite3_mprintf("%s%.3x/", p->zPath, p->iCell);
   490    510       p->iCell++;
          511  +    if( z==0 ) rc = SQLITE_NOMEM;
   491    512     }
   492    513   
   493    514   
   494    515     /* Populate the StatCursor fields with the values to be returned
   495    516     ** by the xColumn() and xRowid() methods.
   496    517     */
   497    518     if( rc==SQLITE_OK ){
................................................................................
   516    537           default:
   517    538             pCsr->zPagetype = "corrupted";
   518    539             break;
   519    540         }
   520    541         pCsr->nCell = p->nCell;
   521    542         pCsr->nUnused = p->nUnused;
   522    543         pCsr->nMxPayload = p->nMxPayload;
   523         -      pCsr->zPath = sqlite3_mprintf("%s", p->zPath);
          544  +      pCsr->zPath = z = sqlite3_mprintf("%s", p->zPath);
          545  +      if( z==0 ) rc = SQLITE_NOMEM;
   524    546         nPayload = 0;
   525    547         for(i=0; i<p->nCell; i++){
   526    548           nPayload += p->aCell[i].nLocal;
   527    549         }
   528    550         pCsr->nPayload = nPayload;
   529    551       }
   530    552     }
................................................................................
   552    574     sqlite3_vtab_cursor *pCursor, 
   553    575     sqlite3_context *ctx, 
   554    576     int i
   555    577   ){
   556    578     StatCursor *pCsr = (StatCursor *)pCursor;
   557    579     switch( i ){
   558    580       case 0:            /* name */
   559         -      sqlite3_result_text(ctx, pCsr->zName, -1, SQLITE_STATIC);
          581  +      sqlite3_result_text(ctx, pCsr->zName, -1, SQLITE_TRANSIENT);
   560    582         break;
   561    583       case 1:            /* path */
   562    584         sqlite3_result_text(ctx, pCsr->zPath, -1, SQLITE_TRANSIENT);
   563    585         break;
   564    586       case 2:            /* pageno */
   565    587         sqlite3_result_int64(ctx, pCsr->iPageno);
   566    588         break;
................................................................................
   578    600         break;
   579    601       case 7:            /* mx_payload */
   580    602         sqlite3_result_int(ctx, pCsr->nMxPayload);
   581    603         break;
   582    604       case 8:            /* pgoffset */
   583    605         sqlite3_result_int64(ctx, pCsr->iOffset);
   584    606         break;
   585         -    case 9:            /* pgsize */
          607  +    default:           /* pgsize */
          608  +      assert( i==9 );
   586    609         sqlite3_result_int(ctx, pCsr->szPage);
   587    610         break;
   588    611     }
   589    612     return SQLITE_OK;
   590    613   }
   591    614   
   592    615   static int statRowid(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){
................................................................................
   594    617     *pRowid = pCsr->iPageno;
   595    618     return SQLITE_OK;
   596    619   }
   597    620   
   598    621   /*
   599    622   ** Invoke this routine to register the "dbstat" virtual table module
   600    623   */
   601         -int sqlite3_dbstat_register(sqlite3 *db){
          624  +int sqlite3DbstatRegister(sqlite3 *db){
   602    625     static sqlite3_module dbstat_module = {
   603    626       0,                            /* iVersion */
   604    627       statConnect,                  /* xCreate */
   605    628       statConnect,                  /* xConnect */
   606    629       statBestIndex,                /* xBestIndex */
   607    630       statDisconnect,               /* xDisconnect */
   608    631       statDisconnect,               /* xDestroy */

Changes to src/main.c.

  2874   2874     if( !db->mallocFailed && rc==SQLITE_OK){
  2875   2875       rc = sqlite3RtreeInit(db);
  2876   2876     }
  2877   2877   #endif
  2878   2878   
  2879   2879   #ifdef SQLITE_ENABLE_DBSTAT_VTAB
  2880   2880     if( !db->mallocFailed && rc==SQLITE_OK){
  2881         -    int sqlite3_dbstat_register(sqlite3*);
  2882         -    rc = sqlite3_dbstat_register(db);
         2881  +    rc = sqlite3DbstatRegister(db);
  2883   2882     }
  2884   2883   #endif
  2885   2884   
  2886   2885     /* -DSQLITE_DEFAULT_LOCKING_MODE=1 makes EXCLUSIVE the default locking
  2887   2886     ** mode.  -DSQLITE_DEFAULT_LOCKING_MODE=0 make NORMAL the default locking
  2888   2887     ** mode.  Doing nothing at all also makes NORMAL the default.
  2889   2888     */

Changes to src/malloc.c.

   222    222     memset(&mem0, 0, sizeof(mem0));
   223    223   }
   224    224   
   225    225   /*
   226    226   ** Return the amount of memory currently checked out.
   227    227   */
   228    228   sqlite3_int64 sqlite3_memory_used(void){
   229         -  int n, mx;
   230         -  sqlite3_int64 res;
   231         -  sqlite3_status(SQLITE_STATUS_MEMORY_USED, &n, &mx, 0);
   232         -  res = (sqlite3_int64)n;  /* Work around bug in Borland C. Ticket #3216 */
          229  +  sqlite3_int64 res, mx;
          230  +  sqlite3_status64(SQLITE_STATUS_MEMORY_USED, &res, &mx, 0);
   233    231     return res;
   234    232   }
   235    233   
   236    234   /*
   237    235   ** Return the maximum amount of memory that has ever been
   238    236   ** checked out since either the beginning of this process
   239    237   ** or since the most recent reset.
   240    238   */
   241    239   sqlite3_int64 sqlite3_memory_highwater(int resetFlag){
   242         -  int n, mx;
   243         -  sqlite3_int64 res;
   244         -  sqlite3_status(SQLITE_STATUS_MEMORY_USED, &n, &mx, resetFlag);
   245         -  res = (sqlite3_int64)mx;  /* Work around bug in Borland C. Ticket #3216 */
   246         -  return res;
          240  +  sqlite3_int64 res, mx;
          241  +  sqlite3_status64(SQLITE_STATUS_MEMORY_USED, &res, &mx, resetFlag);
          242  +  return mx;
   247    243   }
   248    244   
   249    245   /*
   250    246   ** Trigger the alarm 
   251    247   */
   252    248   static void sqlite3MallocAlarm(int nByte){
   253    249     void (*xCallback)(void*,sqlite3_int64,int);

Changes to src/resolve.c.

    95     95     Expr *pOrig;           /* The iCol-th column of the result set */
    96     96     Expr *pDup;            /* Copy of pOrig */
    97     97     sqlite3 *db;           /* The database connection */
    98     98   
    99     99     assert( iCol>=0 && iCol<pEList->nExpr );
   100    100     pOrig = pEList->a[iCol].pExpr;
   101    101     assert( pOrig!=0 );
   102         -  assert( (pOrig->flags & EP_Resolved)!=0 || zType[0]==0 );
   103    102     db = pParse->db;
   104    103     pDup = sqlite3ExprDup(db, pOrig, 0);
   105    104     if( pDup==0 ) return;
   106    105     if( pOrig->op!=TK_COLUMN && zType[0]!='G' ){
   107    106       incrAggFunctionDepth(pDup, nSubquery);
   108    107       pDup = sqlite3PExpr(pParse, TK_AS, pDup, 0, 0);
   109    108       if( pDup==0 ) return;

Changes to src/shell.c.

  3254   3254           fprintf(stderr, "unknown limit: \"%s\"\n"
  3255   3255                           "enter \".limits\" with no arguments for a list.\n",
  3256   3256                            azArg[1]);
  3257   3257           rc = 1;
  3258   3258           goto meta_command_exit;
  3259   3259         }
  3260   3260         if( nArg==3 ){
  3261         -        sqlite3_limit(p->db, aLimit[iLimit].limitCode, integerValue(azArg[2]));
         3261  +        sqlite3_limit(p->db, aLimit[iLimit].limitCode,
         3262  +                      (int)integerValue(azArg[2]));
  3262   3263         }
  3263   3264         printf("%20s %d\n", aLimit[iLimit].zLimitName,
  3264   3265                sqlite3_limit(p->db, aLimit[iLimit].limitCode, -1));
  3265   3266       }
  3266   3267     }else
  3267   3268   
  3268   3269   #ifndef SQLITE_OMIT_LOAD_EXTENSION

Changes to src/sqliteInt.h.

  3862   3862   /*
  3863   3863   ** Threading interface
  3864   3864   */
  3865   3865   #if SQLITE_MAX_WORKER_THREADS>0
  3866   3866   int sqlite3ThreadCreate(SQLiteThread**,void*(*)(void*),void*);
  3867   3867   int sqlite3ThreadJoin(SQLiteThread*, void**);
  3868   3868   #endif
         3869  +
         3870  +#if defined(SQLITE_ENABLE_DBSTAT_VTAB) || defined(SQLITE_TEST)
         3871  +int sqlite3DbstatRegister(sqlite3*);
         3872  +#endif
  3869   3873   
  3870   3874   #endif /* _SQLITEINT_H_ */

Changes to src/tclsqlite.c.

  3702   3702     }
  3703   3703     Tcl_SetResult(interp, zBuf, TCL_VOLATILE);
  3704   3704   
  3705   3705     return TCL_OK;
  3706   3706   }
  3707   3707   #endif /* SQLITE_TEST */
  3708   3708   
  3709         -#if defined(SQLITE_TEST) || defined(SQLITE_ENABLE_DBSTAT_VTAB)
  3710         -/*
  3711         -** tclcmd:   register_dbstat_vtab DB
  3712         -**
  3713         -** Cause the dbstat virtual table to be available on the connection DB
  3714         -*/
  3715         -static int sqlite3RegisterDbstatCmd(
  3716         -  void *clientData,
  3717         -  Tcl_Interp *interp,
  3718         -  int objc,
  3719         -  Tcl_Obj *CONST objv[]
  3720         -){
  3721         -#ifdef SQLITE_OMIT_VIRTUALTABLE
  3722         -  Tcl_AppendResult(interp, "dbstat not available because of "
  3723         -                           "SQLITE_OMIT_VIRTUALTABLE", (void*)0);
  3724         -  return TCL_ERROR;
  3725         -#else
  3726         -  struct SqliteDb { sqlite3 *db; };
  3727         -  char *zDb;
  3728         -  Tcl_CmdInfo cmdInfo;
  3729         -
  3730         -  if( objc!=2 ){
  3731         -    Tcl_WrongNumArgs(interp, 1, objv, "DB");
  3732         -    return TCL_ERROR;
  3733         -  }
  3734         -
  3735         -  zDb = Tcl_GetString(objv[1]);
  3736         -  if( Tcl_GetCommandInfo(interp, zDb, &cmdInfo) ){
  3737         -    int sqlite3_dbstat_register(sqlite3*);
  3738         -    sqlite3* db = ((struct SqliteDb*)cmdInfo.objClientData)->db;
  3739         -    sqlite3_dbstat_register(db);
  3740         -  }
  3741         -  return TCL_OK;
  3742         -#endif /* SQLITE_OMIT_VIRTUALTABLE */
  3743         -}
  3744         -#endif /* defined(SQLITE_TEST) || defined(SQLITE_ENABLE_DBSTAT_VTAB) */
  3745         -
  3746   3709   /*
  3747   3710   ** Configure the interpreter passed as the first argument to have access
  3748   3711   ** to the commands and linked variables that make up:
  3749   3712   **
  3750   3713   **   * the [sqlite3] extension itself, 
  3751   3714   **
  3752   3715   **   * If SQLITE_TCLMD5 or SQLITE_TEST is defined, the Md5 commands, and
................................................................................
  3755   3718   **     test suite.
  3756   3719   */
  3757   3720   static void init_all(Tcl_Interp *interp){
  3758   3721     Sqlite3_Init(interp);
  3759   3722   
  3760   3723   #if defined(SQLITE_TEST) || defined(SQLITE_TCLMD5)
  3761   3724     Md5_Init(interp);
  3762         -#endif
  3763         -
  3764         -  /* Install the [register_dbstat_vtab] command to access the implementation
  3765         -  ** of virtual table dbstat (source file test_stat.c). This command is
  3766         -  ** required for testfixture and sqlite3_analyzer, but not by the production
  3767         -  ** Tcl extension.  */
  3768         -#if defined(SQLITE_TEST) || defined(SQLITE_ENABLE_DBSTAT_VTAB)
  3769         -  Tcl_CreateObjCommand(
  3770         -      interp, "register_dbstat_vtab", sqlite3RegisterDbstatCmd, 0, 0
  3771         -  );
  3772   3725   #endif
  3773   3726   
  3774   3727   #ifdef SQLITE_TEST
  3775   3728     {
  3776   3729       extern int Sqliteconfig_Init(Tcl_Interp*);
  3777   3730       extern int Sqlitetest1_Init(Tcl_Interp*);
  3778   3731       extern int Sqlitetest2_Init(Tcl_Interp*);

Changes to src/test1.c.

  6676   6676       case 4: {
  6677   6677         Tcl_Panic("Deliberate panic");
  6678   6678         break;
  6679   6679       }
  6680   6680     }
  6681   6681     return TCL_OK;
  6682   6682   }  
  6683         -  
         6683  +
         6684  +/*
         6685  +** tclcmd:   register_dbstat_vtab DB
         6686  +**
         6687  +** Cause the dbstat virtual table to be available on the connection DB
         6688  +*/
         6689  +static int test_register_dbstat_vtab(
         6690  +  void *clientData,
         6691  +  Tcl_Interp *interp,
         6692  +  int objc,
         6693  +  Tcl_Obj *CONST objv[]
         6694  +){
         6695  +#ifdef SQLITE_OMIT_VIRTUALTABLE
         6696  +  Tcl_AppendResult(interp, "dbstat not available because of "
         6697  +                           "SQLITE_OMIT_VIRTUALTABLE", (void*)0);
         6698  +  return TCL_ERROR;
         6699  +#else
         6700  +  struct SqliteDb { sqlite3 *db; };
         6701  +  char *zDb;
         6702  +  Tcl_CmdInfo cmdInfo;
         6703  +
         6704  +  if( objc!=2 ){
         6705  +    Tcl_WrongNumArgs(interp, 1, objv, "DB");
         6706  +    return TCL_ERROR;
         6707  +  }
         6708  +
         6709  +  zDb = Tcl_GetString(objv[1]);
         6710  +  if( Tcl_GetCommandInfo(interp, zDb, &cmdInfo) ){
         6711  +    sqlite3* db = ((struct SqliteDb*)cmdInfo.objClientData)->db;
         6712  +    sqlite3DbstatRegister(db);
         6713  +  }
         6714  +  return TCL_OK;
         6715  +#endif /* SQLITE_OMIT_VIRTUALTABLE */
         6716  +}
  6684   6717   
  6685   6718   /*
  6686   6719   ** Register commands with the TCL interpreter.
  6687   6720   */
  6688   6721   int Sqlitetest1_Init(Tcl_Interp *interp){
  6689   6722     extern int sqlite3_search_count;
  6690   6723     extern int sqlite3_found_count;
................................................................................
  6748   6781     };
  6749   6782     static struct {
  6750   6783        char *zName;
  6751   6784        Tcl_ObjCmdProc *xProc;
  6752   6785        void *clientData;
  6753   6786     } aObjCmd[] = {
  6754   6787        { "bad_behavior",                  test_bad_behavior,  (void*)&iZero },
         6788  +     { "register_dbstat_vtab",          test_register_dbstat_vtab  },
  6755   6789        { "sqlite3_connection_pointer",    get_sqlite_pointer, 0 },
  6756   6790        { "sqlite3_bind_int",              test_bind_int,      0 },
  6757   6791        { "sqlite3_bind_zeroblob",         test_bind_zeroblob, 0 },
  6758   6792        { "sqlite3_bind_int64",            test_bind_int64,    0 },
  6759   6793        { "sqlite3_bind_double",           test_bind_double,   0 },
  6760   6794        { "sqlite3_bind_null",             test_bind_null     ,0 },
  6761   6795        { "sqlite3_bind_text",             test_bind_text     ,0 },

Added test/analyzer1.test.

            1  +# 2015-05-11
            2  +#
            3  +# The author disclaims copyright to this source code.  In place of
            4  +# a legal notice, here is a blessing:
            5  +#
            6  +#    May you do good and not evil.
            7  +#    May you find forgiveness for yourself and forgive others.
            8  +#    May you share freely, never taking more than you give.
            9  +#
           10  +#***********************************************************************
           11  +#
           12  +# Quick tests for the sqlite3_analyzer tool
           13  +#
           14  +set testdir [file dirname $argv0]
           15  +source $testdir/tester.tcl
           16  +if {$tcl_platform(platform)=="windows"} {
           17  +  set PROG "sqlite3_analyzer.exe"
           18  +} else {
           19  +  set PROG "./sqlite3_analyzer"
           20  +}
           21  +db close
           22  +forcedelete test.db test.db-journal test.db-wal
           23  +sqlite3 db test.db
           24  +
           25  +do_test analyzer1-1.0 {
           26  +  db eval {
           27  +    CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
           28  +    CREATE TABLE t2(a INT PRIMARY KEY, b) WITHOUT ROWID;
           29  +    WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<250)
           30  +    INSERT INTO t1(a,b) SELECT x, randomblob(200) FROM c;
           31  +    INSERT INTO t2(a,b) SELECT a, b FROM t1;
           32  +  }
           33  +  set line "exec $PROG test.db"
           34  +  unset -nocomplain ::MSG
           35  +  catch {eval $line} ::MSG
           36  +} {0}
           37  +do_test analyzer1-1.1 {
           38  +  regexp {^/\*\* Disk-Space Utilization.*COMMIT;\W*$} $::MSG
           39  +} {1}

Changes to test/jrnlmode.test.

   555    555   do_execsql_test jrnlmode-8.29 { COMMIT }                        {}
   556    556   do_execsql_test jrnlmode-8.30 { PRAGMA journal_mode=DELETE }    {delete}
   557    557   
   558    558   # Assertion fault on 2015-05-01
   559    559   do_test jrnlmode-9.1 {
   560    560     forcedelete test2.db
   561    561     sqlite3 db2 test2.db
   562         -  breakpoint
   563    562     db2 eval {CREATE TEMP TABLE t(l); PRAGMA journal_mode=off;}
   564    563     db2 close
   565    564   } {}
   566    565   do_execsql_test jrnlmode-9.2 {
   567    566     PRAGMA locking_mode = exclusive;
   568    567     CREATE TABLE tx(a);
   569    568     PRAGMA journal_mode = off;
   570    569   } {exclusive off}
   571    570   
   572    571   
   573    572   finish_test

Changes to test/select4.test.

   154    154   } {1 {ORDER BY clause should come after UNION not before}}
   155    155   do_test select4-2.4 {
   156    156     set v [catch {execsql {
   157    157       SELECT 0 ORDER BY (SELECT 0) UNION SELECT 0;
   158    158     }} msg]
   159    159     lappend v $msg
   160    160   } {1 {ORDER BY clause should come after UNION not before}}
          161  +do_execsql_test select4-2.5 {
          162  +  SELECT 123 AS x ORDER BY (SELECT x ORDER BY 1);
          163  +} {123}
   161    164   
   162    165   # Except operator
   163    166   #
   164    167   do_test select4-3.1.1 {
   165    168     execsql {
   166    169       SELECT DISTINCT log FROM t1
   167    170       EXCEPT

Added test/sqldiff1.test.

            1  +# 2015-05-11
            2  +#
            3  +# The author disclaims copyright to this source code.  In place of
            4  +# a legal notice, here is a blessing:
            5  +#
            6  +#    May you do good and not evil.
            7  +#    May you find forgiveness for yourself and forgive others.
            8  +#    May you share freely, never taking more than you give.
            9  +#
           10  +#***********************************************************************
           11  +#
           12  +# Quick tests for the sqldiff tool
           13  +#
           14  +set testdir [file dirname $argv0]
           15  +source $testdir/tester.tcl
           16  +if {$tcl_platform(platform)=="windows"} {
           17  +  set PROG "sqldiff.exe"
           18  +} else {
           19  +  set PROG "./sqldiff"
           20  +}
           21  +db close
           22  +forcedelete test.db test2.db
           23  +sqlite3 db test.db
           24  +
           25  +do_test sqldiff-1.0 {
           26  +  db eval {
           27  +    CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
           28  +    CREATE TABLE t2(a INT PRIMARY KEY, b) WITHOUT ROWID;
           29  +    WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100)
           30  +    INSERT INTO t1(a,b) SELECT x, printf('abc-%d-xyz',x) FROM c;
           31  +    INSERT INTO t2(a,b) SELECT a, b FROM t1;
           32  +  }
           33  +  db backup test2.db
           34  +  db eval {
           35  +    ATTACH 'test2.db' AS x2;
           36  +    DELETE FROM x2.t1 WHERE a=49;
           37  +    DELETE FROM x2.t2 WHERE a=48;
           38  +    INSERT INTO x2.t1(a,b) VALUES(1234,'hello');
           39  +    INSERT INTO x2.t2(a,b) VALUES(50.5,'xyzzy');
           40  +    CREATE TABLE x2.t3(a,b,c);
           41  +    INSERT INTO x2.t3 VALUES(111,222,333);
           42  +    CREATE TABLE main.t4(x,y,z);
           43  +    INSERT INTO t4 SELECT * FROM t3;
           44  +  }
           45  +  set line "exec $PROG test.db test2.db"
           46  +  unset -nocomplain ::MSG
           47  +  catch {eval $line} ::MSG
           48  +} {0}
           49  +do_test sqldiff-1.1 {
           50  +  set ::MSG
           51  +} {DELETE FROM t1 WHERE a=49;
           52  +INSERT INTO t1(a,b) VALUES(1234,'hello');
           53  +DELETE FROM t2 WHERE a=48;
           54  +INSERT INTO t2(a,b) VALUES(50.5,'xyzzy');
           55  +CREATE TABLE t3(a,b,c);
           56  +INSERT INTO t3(rowid,a,b,c) VALUES(1,111,222,333);
           57  +DROP TABLE t4;}

Changes to test/stat.test.

   162    162   
   163    163   db close
   164    164   forcedelete test.db
   165    165   sqlite3 db test.db
   166    166   register_dbstat_vtab db
   167    167   do_execsql_test stat-5.1 {
   168    168     PRAGMA auto_vacuum = OFF;
   169         -  CREATE VIRTUAL TABLE temp.stat USING dbstat;
   170         -  CREATE TABLE t1(x);
          169  +  CREATE TABLE tx(y);
          170  +  ATTACH ':memory:' AS aux1;
          171  +  CREATE VIRTUAL TABLE temp.stat USING dbstat(aux1);
          172  +  CREATE TABLE aux1.t1(x);
   171    173     INSERT INTO t1 VALUES(zeroblob(1513));
   172    174     INSERT INTO t1 VALUES(zeroblob(1514));
   173    175     SELECT name, path, pageno, pagetype, ncell, payload, unused, mx_payload
   174    176       FROM stat WHERE name = 't1';
   175    177   } [list \
   176    178     t1 / 2 leaf 2 993 5 1517                \
   177    179     t1 /000+000000 3 overflow 0 1020 0 0    \
   178    180     t1 /001+000000 4 overflow 0 1020 0 0    \
   179    181   ]
   180    182   
          183  +do_catchsql_test stat-6.1 {
          184  +  CREATE VIRTUAL TABLE temp.s2 USING dbstat(mainx);
          185  +} {1 {no such database: mainx}}
          186  +
   181    187   finish_test

Changes to tool/spaceanal.tcl.

    84     84   
    85     85   # Open the database
    86     86   #
    87     87   if {[catch {sqlite3 db $file_to_analyze -uri 1} msg]} {
    88     88     puts stderr "error trying to open $file_to_analyze: $msg"
    89     89     exit 1
    90     90   }
    91         -register_dbstat_vtab db
    92     91   
    93     92   db eval {SELECT count(*) FROM sqlite_master}
    94     93   set pageSize [expr {wide([db one {PRAGMA page_size}])}]
    95     94   
    96     95   if {$flags(-pageinfo)} {
    97     96     db eval {CREATE VIRTUAL TABLE temp.stat USING dbstat}
    98     97     db eval {SELECT name, path, pageno FROM temp.stat ORDER BY pageno} {