/ Check-in [518621f8]
Login

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

Overview
Comment:Merge the 3.8.8 release changes from trunk.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | apple-osx
Files: files | file ages | folders
SHA1:518621f8dcd6c0cc107110991753731a19b263f6
User & Date: drh 2015-01-16 12:24:00
Context
2015-02-06
16:03
Merge all recent trunk enhancements into the apple-osx branch. check-in: 44711921 user: drh tags: apple-osx
2015-01-16
12:24
Merge the 3.8.8 release changes from trunk. check-in: 518621f8 user: drh tags: apple-osx
12:08
Version 3.8.8 check-in: 7d68a42f user: drh tags: trunk, release, version-3.8.8
2015-01-08
19:55
Merge the testing enhancements and the unlimited VALUES enhancement from trunk. check-in: cc780842 user: drh tags: apple-osx
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.in.

    11     11   # be able to get it to work by giving it some hints.  See the comment
    12     12   # at the beginning of configure.in for additional information.
    13     13   #
    14     14   
    15     15   # The toplevel directory of the source tree.  This is the directory
    16     16   # that contains this "Makefile.in" and the "configure.in" script.
    17     17   #
    18         -TOP = @srcdir@
           18  +TOP = @abs_srcdir@
    19     19   
    20     20   # C Compiler and options for use in building executables that
    21     21   # will run on the platform that is doing the build.
    22     22   #
    23     23   BCC = @BUILD_CC@ @BUILD_CFLAGS@
    24     24   
    25     25   # TCC is the C Compile and options for use in building executables that 
................................................................................
    37     37   # 
    38     38   TCC += -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite
    39     39   
    40     40   # Define -DNDEBUG to compile without debugging (i.e., for production usage)
    41     41   # Omitting the define will cause extra debugging code to be inserted and
    42     42   # includes extra comments when "EXPLAIN stmt" is used.
    43     43   #
    44         -TCC += @TARGET_DEBUG@ @XTHREADCONNECT@
           44  +TCC += @TARGET_DEBUG@
    45     45   
    46     46   # Compiler options needed for programs that use the TCL library.
    47     47   #
    48     48   TCC += @TCL_INCLUDE_SPEC@
    49     49   
    50     50   # The library that programs using TCL must link against.
    51     51   #
................................................................................
   230    230     $(TOP)/src/malloc.c \
   231    231     $(TOP)/src/mem0.c \
   232    232     $(TOP)/src/mem1.c \
   233    233     $(TOP)/src/mem2.c \
   234    234     $(TOP)/src/mem3.c \
   235    235     $(TOP)/src/mem5.c \
   236    236     $(TOP)/src/memjournal.c \
          237  +  $(TOP)/src/msvc.h \
   237    238     $(TOP)/src/mutex.c \
   238    239     $(TOP)/src/mutex.h \
   239    240     $(TOP)/src/mutex_noop.c \
   240    241     $(TOP)/src/mutex_unix.c \
   241    242     $(TOP)/src/mutex_w32.c \
   242    243     $(TOP)/src/notify.c \
   243    244     $(TOP)/src/os.c \
................................................................................
   462    463   #
   463    464   HDR = \
   464    465      $(TOP)/src/btree.h \
   465    466      $(TOP)/src/btreeInt.h \
   466    467      $(TOP)/src/hash.h \
   467    468      $(TOP)/src/hwtime.h \
   468    469      keywordhash.h \
          470  +   $(TOP)/src/msvc.h \
   469    471      $(TOP)/src/mutex.h \
   470    472      opcodes.h \
   471    473      $(TOP)/src/os.h \
   472    474      $(TOP)/src/os_common.h \
   473    475      $(TOP)/src/os_setup.h \
   474    476      $(TOP)/src/os_win.h \
   475    477      $(TOP)/src/pager.h \
................................................................................
  1013   1015   # symbols that do not begin with "sqlite3_". It is run as part of the
  1014   1016   # releasetest.tcl script.
  1015   1017   #
  1016   1018   checksymbols: sqlite3.lo
  1017   1019   	nm -g --defined-only sqlite3.o | grep -v " sqlite3_" ; test $$? -ne 0
  1018   1020   	echo '0 errors out of 1 tests'
  1019   1021   
         1022  +# Build the amalgamation-autoconf package.
         1023  +#
         1024  +amalgamation-tarball: sqlite3.c
         1025  +	TOP=$(TOP) sh $(TOP)/tool/mkautoconfamal.sh
         1026  +
  1020   1027   # The next two rules are used to support the "threadtest" target. Building
  1021   1028   # threadtest runs a few thread-safety tests that are implemented in C. This
  1022   1029   # target is invoked by the releasetest.tcl script.
  1023   1030   # 
  1024   1031   THREADTEST3_SRC = $(TOP)/test/threadtest3.c    \
  1025   1032                     $(TOP)/test/tt3_checkpoint.c \
  1026   1033                     $(TOP)/test/tt3_index.c      \

Changes to Makefile.msc.

    11     11   TOP = .
    12     12   
    13     13   # Set this non-0 to create and use the SQLite amalgamation file.
    14     14   #
    15     15   !IFNDEF USE_AMALGAMATION
    16     16   USE_AMALGAMATION = 1
    17     17   !ENDIF
           18  +
           19  +# Set this non-0 to enable full warnings (-W4, etc) when compiling.
           20  +#
           21  +!IFNDEF USE_FULLWARN
           22  +USE_FULLWARN = 0
           23  +!ENDIF
           24  +
           25  +# If necessary, create a list of harmless compiler warnings to disable when
           26  +# compiling the build tools.  For the SQLite source code itself, warnings,
           27  +# if any, will be disabled from within it.
           28  +#
           29  +!IFNDEF NO_WARN
           30  +!IF $(USE_FULLWARN)!=0
           31  +NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4152 -wd4189 -wd4206 -wd4210
           32  +NO_WARN = $(NO_WARN) -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706
           33  +!ENDIF
           34  +!ENDIF
    18     35   
    19     36   # Set this non-0 to use the library paths and other options necessary for
    20     37   # Windows Phone 8.1.
    21     38   #
    22     39   !IFNDEF USE_WP81_OPTS
    23     40   USE_WP81_OPTS = 0
    24     41   !ENDIF
................................................................................
   228    245   !ENDIF
   229    246   
   230    247   NSDKLIBPATH = $(NSDKLIBPATH:\\=\)
   231    248   
   232    249   # C compiler and options for use in building executables that
   233    250   # will run on the platform that is doing the build.
   234    251   #
          252  +!IF $(USE_FULLWARN)!=0
          253  +BCC = $(NCC) -W4
          254  +!ELSE
   235    255   BCC = $(NCC) -W3
          256  +!ENDIF
   236    257   
   237    258   # Check if assembly code listings should be generated for the source
   238    259   # code files to be compiled.
   239    260   #
   240    261   !IF $(USE_LISTINGS)!=0
   241    262   BCC = $(BCC) -FAcs
   242    263   !ENDIF
................................................................................
   249    270   NLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)"
   250    271   !ENDIF
   251    272   
   252    273   # C compiler and options for use in building executables that
   253    274   # will run on the target platform.  (BCC and TCC are usually the
   254    275   # same unless your are cross-compiling.)
   255    276   #
   256         -TCC = $(CC) -W3 -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src -fp:precise
          277  +!IF $(USE_FULLWARN)!=0
          278  +TCC = $(CC) -W4 -DINCLUDE_MSVC_H=1
          279  +!ELSE
          280  +TCC = $(CC) -W3
          281  +!ENDIF
          282  +
          283  +TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src -fp:precise
   257    284   RCC = $(RC) -DSQLITE_OS_WIN=1 -I$(TOP) -I$(TOP)\src
   258    285   
   259    286   # Check if assembly code listings should be generated for the source
   260    287   # code files to be compiled.
   261    288   #
   262    289   !IF $(USE_LISTINGS)!=0
   263    290   TCC = $(TCC) -FAcs
................................................................................
   702    729     $(TOP)\src\malloc.c \
   703    730     $(TOP)\src\mem0.c \
   704    731     $(TOP)\src\mem1.c \
   705    732     $(TOP)\src\mem2.c \
   706    733     $(TOP)\src\mem3.c \
   707    734     $(TOP)\src\mem5.c \
   708    735     $(TOP)\src\memjournal.c \
          736  +  $(TOP)\src\msvc.h \
   709    737     $(TOP)\src\mutex.c \
   710    738     $(TOP)\src\mutex.h \
   711    739     $(TOP)\src\mutex_noop.c \
   712    740     $(TOP)\src\mutex_unix.c \
   713    741     $(TOP)\src\mutex_w32.c \
   714    742     $(TOP)\src\notify.c \
   715    743     $(TOP)\src\os.c \
................................................................................
   934    962   #
   935    963   HDR = \
   936    964      $(TOP)\src\btree.h \
   937    965      $(TOP)\src\btreeInt.h \
   938    966      $(TOP)\src\hash.h \
   939    967      $(TOP)\src\hwtime.h \
   940    968      keywordhash.h \
          969  +   $(TOP)\src\msvc.h \
   941    970      $(TOP)\src\mutex.h \
   942    971      opcodes.h \
   943    972      $(TOP)\src\os.h \
   944    973      $(TOP)\src\os_common.h \
   945    974      $(TOP)\src\os_setup.h \
   946    975      $(TOP)\src\os_win.h \
   947    976      $(TOP)\src\pager.h \
................................................................................
   985   1014   libsqlite3.lib:	$(LIBOBJ)
   986   1015   	$(LTLIB) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS)
   987   1016   
   988   1017   libtclsqlite3.lib:	tclsqlite.lo libsqlite3.lib
   989   1018   	$(LTLIB) $(LTLIBOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCL:tcl=tclstub) $(TLIBS)
   990   1019   
   991   1020   sqlite3.exe:	$(TOP)\src\shell.c libsqlite3.lib $(LIBRESOBJS) sqlite3.h
   992         -	$(LTLINK) $(READLINE_FLAGS) \
   993         -		$(TOP)\src\shell.c \
         1021  +	$(LTLINK) $(READLINE_FLAGS) $(TOP)\src\shell.c \
   994   1022   		/link $(LTLINKOPTS) $(LTLIBPATHS) libsqlite3.lib $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
   995   1023   
   996   1024   mptester.exe:	$(TOP)\mptest\mptest.c libsqlite3.lib $(LIBRESOBJS) sqlite3.h
   997   1025   	$(LTLINK) $(TOP)\mptest\mptest.c \
   998   1026   		/link $(LTLINKOPTS) $(LTLIBPATHS) libsqlite3.lib $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
   999   1027   
  1000   1028   # This target creates a directory named "tsrc" and fills it with
................................................................................
  1036   1064   
  1037   1065   # Rules to build the LEMON compiler generator
  1038   1066   #
  1039   1067   lempar.c:	$(TOP)\src\lempar.c
  1040   1068   	copy $(TOP)\src\lempar.c .
  1041   1069   
  1042   1070   lemon.exe:	$(TOP)\tool\lemon.c lempar.c
  1043         -	$(BCC) -Daccess=_access -Fe$@ $(TOP)\tool\lemon.c /link $(NLTLINKOPTS) $(NLTLIBPATHS)
         1071  +	$(BCC) $(NO_WARN) -Daccess=_access \
         1072  +		-Fe$@ $(TOP)\tool\lemon.c /link $(NLTLINKOPTS) $(NLTLIBPATHS)
  1044   1073   
  1045   1074   # Rules to build individual *.lo files from generated *.c files. This
  1046   1075   # applies to:
  1047   1076   #
  1048   1077   #     parse.lo
  1049   1078   #     opcodes.lo
  1050   1079   #
................................................................................
  1307   1336   	move parse.h parse.h.temp
  1308   1337   	$(NAWK) -f $(TOP)\addopcodes.awk parse.h.temp > parse.h
  1309   1338   
  1310   1339   sqlite3.h:	$(TOP)\src\sqlite.h.in $(TOP)\manifest.uuid $(TOP)\VERSION
  1311   1340   	$(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP:\=/) > sqlite3.h
  1312   1341   
  1313   1342   mkkeywordhash.exe:	$(TOP)\tool\mkkeywordhash.c
  1314         -	$(BCC) -Fe$@ $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(OPTS) $(TOP)\tool\mkkeywordhash.c /link $(NLTLINKOPTS) $(NLTLIBPATHS)
         1343  +	$(BCC) $(NO_WARN) -Fe$@ $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(OPTS) \
         1344  +		$(TOP)\tool\mkkeywordhash.c /link $(NLTLINKOPTS) $(NLTLIBPATHS)
  1315   1345   
  1316   1346   keywordhash.h:	$(TOP)\tool\mkkeywordhash.c mkkeywordhash.exe
  1317   1347   	.\mkkeywordhash.exe > keywordhash.h
  1318   1348   
  1319   1349   
  1320   1350   
  1321   1351   # Rules to build the extension objects.
................................................................................
  1388   1418   #
  1389   1419   # If using the amalgamation, use sqlite3.c directly to build the test
  1390   1420   # fixture.  Otherwise link against libsqlite3.lib.  (This distinction is
  1391   1421   # necessary because the test fixture requires non-API symbols which are
  1392   1422   # hidden when the library is built via the amalgamation).
  1393   1423   #
  1394   1424   TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
  1395         -TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE
         1425  +TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE=""
         1426  +TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CORE $(NO_WARN)
  1396   1427   
  1397   1428   TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2) libsqlite3.lib
  1398   1429   TESTFIXTURE_SRC1 = $(TESTEXT) $(SQLITE3C)
  1399   1430   !IF $(USE_AMALGAMATION)==0
  1400   1431   TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC0)
  1401   1432   !ELSE
  1402   1433   TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC1)

Changes to Makefile.vxworks.

   249    249     $(TOP)/src/malloc.c \
   250    250     $(TOP)/src/mem0.c \
   251    251     $(TOP)/src/mem1.c \
   252    252     $(TOP)/src/mem2.c \
   253    253     $(TOP)/src/mem3.c \
   254    254     $(TOP)/src/mem5.c \
   255    255     $(TOP)/src/memjournal.c \
          256  +  $(TOP)/src/msvc.h \
   256    257     $(TOP)/src/mutex.c \
   257    258     $(TOP)/src/mutex.h \
   258    259     $(TOP)/src/mutex_noop.c \
   259    260     $(TOP)/src/mutex_unix.c \
   260    261     $(TOP)/src/mutex_w32.c \
   261    262     $(TOP)/src/notify.c \
   262    263     $(TOP)/src/os.c \
................................................................................
   410    411   #
   411    412   HDR = \
   412    413      $(TOP)/src/btree.h \
   413    414      $(TOP)/src/btreeInt.h \
   414    415      $(TOP)/src/hash.h \
   415    416      $(TOP)/src/hwtime.h \
   416    417      keywordhash.h \
          418  +   $(TOP)/src/msvc.h \
   417    419      $(TOP)/src/mutex.h \
   418    420      opcodes.h \
   419    421      $(TOP)/src/os.h \
   420    422      $(TOP)/src/os_common.h \
   421    423      $(TOP)/src/os_setup.h \
   422    424      $(TOP)/src/os_win.h \
   423    425      $(TOP)/src/pager.h \

Changes to autoconf/README.first.

     1         -
     2         -This file describes how to use the files in this directory to create a new
     3         -version of the "autoconf-amalgamation" package.
            1  +This directory contains components use to build an autoconf-ready package
            2  +of the SQLite amalgamation:  sqlite-autoconf-30XXXXXX.tar.gz
     4      3   
     5         -1. The following files should have executable permission:
            4  +To build the autoconf amalgamation, run from the top-level:
     6      5   
     7         -  chmod 755 install-sh 
     8         -  chmod 755 missing 
     9         -  chmod 755 depcomp
    10         -  chmod 755 config.sub
    11         -  chmod 755 config.guess
            6  +   ./configure
            7  +   make amalgamation-tarball
    12      8   
    13         -2. Copy new versions of the following SQLite files into this directory:
    14         -
    15         -  sqlite3.c
    16         -  sqlite3.h
    17         -  sqlite3ext.h
    18         -  sqlite3.1
    19         -  sqlite3.pc.in
    20         -  shell.c
    21         -
    22         -3. Update the SQLite version number in the AC_INIT macro in file 
    23         -   configure.ac:
    24         -
    25         -     AC_INIT(sqlite, 3.6.3, http://www.sqlite.org)
    26         -
    27         -4. Run the following commands to push the version number change through
    28         -   to the generated files.
    29         -
    30         -  aclocal
    31         -  autoconf
    32         -  automake
    33         -
    34         -5. Create the tclsqlite3.c file in the tea/generic directory. As follows:
    35         -
    36         -  mkdir -p tea/generic
    37         -  echo "#ifdef USE_SYSTEM_SQLITE"      > tea/generic/tclsqlite3.c 
    38         -  echo "# include <sqlite3.h>"        >> tea/generic/tclsqlite3.c
    39         -  echo "#else"                        >> tea/generic/tclsqlite3.c
    40         -  echo "#include \"../../sqlite3.c\"" >> tea/generic/tclsqlite3.c
    41         -  echo "#endif"                       >> tea/generic/tclsqlite3.c
    42         -  cat  ../src/tclsqlite.c             >> tea/generic/tclsqlite3.c
    43         -
    44         -6. Update the SQLite version in the AC_INIT macro in file tea/configure.in:
    45         -
    46         -  AC_INIT([sqlite], [3.6.3])
    47         -
    48         -7. From the 'tea' directory, run the following commands:
    49         -
    50         -  autoconf
    51         -  rm -rf autom4te.cache
    52         -
    53         -8. Run "./configure && make dist". This builds a distribution package
    54         -   named something like "sqlite-3.6.3.tar.gz". Rename to 
    55         -   "sqlite-amalgamation-3.6.3.tar.gz" and use.
    56         -
    57         -
            9  +The amalgamation-tarball target (also available in "main.mk") runs the
           10  +script tool/mkautoconfamal.sh which does the work.  Refer to that script
           11  +for details.

Name change from autoconf/tea/configure.in to autoconf/tea/configure.ac.


Changes to config.h.in.

    22     22   #undef HAVE_INT8_T
    23     23   
    24     24   /* Define to 1 if the system has the type `intptr_t'. */
    25     25   #undef HAVE_INTPTR_T
    26     26   
    27     27   /* Define to 1 if you have the <inttypes.h> header file. */
    28     28   #undef HAVE_INTTYPES_H
           29  +
           30  +/* Define to 1 if you have the `isnan' function. */
           31  +#undef HAVE_ISNAN
    29     32   
    30     33   /* Define to 1 if you have the `localtime_r' function. */
    31     34   #undef HAVE_LOCALTIME_R
    32     35   
    33     36   /* Define to 1 if you have the `localtime_s' function. */
    34     37   #undef HAVE_LOCALTIME_S
    35     38   
................................................................................
    43     46   #undef HAVE_MEMORY_H
    44     47   
    45     48   /* Define to 1 if you have the <stdint.h> header file. */
    46     49   #undef HAVE_STDINT_H
    47     50   
    48     51   /* Define to 1 if you have the <stdlib.h> header file. */
    49     52   #undef HAVE_STDLIB_H
           53  +
           54  +/* Define to 1 if you have the strchrnul() function */
           55  +#undef HAVE_STRCHRNUL
    50     56   
    51     57   /* Define to 1 if you have the <strings.h> header file. */
    52     58   #undef HAVE_STRINGS_H
    53     59   
    54     60   /* Define to 1 if you have the <string.h> header file. */
    55     61   #undef HAVE_STRING_H
    56     62   

Changes to configure.

   864    864   TCLLIBDIR
   865    865   program_prefix
   866    866   VERSION
   867    867   RELEASE
   868    868   VERSION_NUMBER
   869    869   BUILD_CC
   870    870   SQLITE_THREADSAFE
   871         -XTHREADCONNECT
   872    871   ALLOWRELEASE
   873    872   TEMP_STORE
   874    873   BUILD_EXEEXT
   875    874   SQLITE_OS_UNIX
   876    875   SQLITE_OS_WIN
   877    876   TARGET_EXEEXT
   878    877   TCL_VERSION
................................................................................
   902    901   enable_shared
   903    902   enable_static
   904    903   with_pic
   905    904   enable_fast_install
   906    905   with_gnu_ld
   907    906   enable_libtool_lock
   908    907   enable_largefile
   909         -with_hints
   910    908   enable_threadsafe
   911         -enable_cross_thread_connections
   912    909   enable_releasemode
   913    910   enable_tempstore
   914    911   enable_tcl
   915    912   with_tcl
   916    913   enable_readline
   917    914   with_readline_lib
   918    915   with_readline_inc
................................................................................
  1558   1555     --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  1559   1556     --enable-shared[=PKGS]  build shared libraries [default=yes]
  1560   1557     --enable-static[=PKGS]  build static libraries [default=yes]
  1561   1558     --enable-fast-install[=PKGS]
  1562   1559                             optimize for fast installation [default=yes]
  1563   1560     --disable-libtool-lock  avoid locking (might break parallel builds)
  1564   1561     --disable-largefile     omit support for large files
  1565         -  --enable-threadsafe     Support threadsafe operation
  1566         -  --enable-cross-thread-connections
  1567         -                          Allow connection sharing across threads
         1562  +  --disable-threadsafe    Disable mutexing
  1568   1563     --enable-releasemode    Support libtool link to release mode
  1569   1564     --enable-tempstore      Use an in-ram database for temporary tables
  1570   1565                             (never,no,yes,always)
  1571   1566     --disable-tcl           do not build TCL extension
  1572   1567     --disable-readline      disable readline support [default=detect]
  1573   1568     --enable-debug          enable debugging & verbose explain
  1574   1569     --disable-amalgamation  Disable the amalgamation and instead build all files
  1575   1570                             separately
  1576         -  --enable-load-extension Enable loading of external extensions
         1571  +  --disable-load-extension
         1572  +                          Disable loading of external extensions
  1577   1573     --enable-gcov           Enable coverage testing using gcov
  1578   1574   
  1579   1575   Optional Packages:
  1580   1576     --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  1581   1577     --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  1582   1578     --with-pic              try to use only PIC/non-PIC objects [default=use
  1583   1579                             both]
  1584   1580     --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
  1585         -  --with-hints=FILE       Read configuration options from FILE
  1586   1581     --with-tcl=DIR          directory containing tcl configuration
  1587   1582                             (tclConfig.sh)
  1588   1583     --with-readline-lib     specify readline library
  1589   1584     --with-readline-inc     specify readline include paths
  1590   1585   
  1591   1586   Some influential environment variables:
  1592   1587     CC          C compiler command
................................................................................
  2054   2049   $as_echo "$as_me: error: configure script is out of date:
  2055   2050    configure \$PACKAGE_VERSION = $PACKAGE_VERSION
  2056   2051    top level VERSION file     = $sqlite_version_sanity_check
  2057   2052   please regen with autoconf" >&2;}
  2058   2053      { (exit 1); exit 1; }; }
  2059   2054   fi
  2060   2055   
  2061         -# The following RCS revision string applies to configure.in
  2062         -# $Revision: 1.56 $
  2063         -
  2064   2056   #########
  2065   2057   # Programs needed
  2066   2058   #
  2067   2059   case `pwd` in
  2068   2060     *\ * | *\	*)
  2069   2061       { $as_echo "$as_me:$LINENO: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
  2070   2062   $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
................................................................................
  3728   3720   { $as_echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5
  3729   3721   $as_echo_n "checking the name lister ($NM) interface... " >&6; }
  3730   3722   if test "${lt_cv_nm_interface+set}" = set; then
  3731   3723     $as_echo_n "(cached) " >&6
  3732   3724   else
  3733   3725     lt_cv_nm_interface="BSD nm"
  3734   3726     echo "int some_variable = 0;" > conftest.$ac_ext
  3735         -  (eval echo "\"\$as_me:3735: $ac_compile\"" >&5)
         3727  +  (eval echo "\"\$as_me:3727: $ac_compile\"" >&5)
  3736   3728     (eval "$ac_compile" 2>conftest.err)
  3737   3729     cat conftest.err >&5
  3738         -  (eval echo "\"\$as_me:3738: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
         3730  +  (eval echo "\"\$as_me:3730: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
  3739   3731     (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
  3740   3732     cat conftest.err >&5
  3741         -  (eval echo "\"\$as_me:3741: output\"" >&5)
         3733  +  (eval echo "\"\$as_me:3733: output\"" >&5)
  3742   3734     cat conftest.out >&5
  3743   3735     if $GREP 'External.*some_variable' conftest.out > /dev/null; then
  3744   3736       lt_cv_nm_interface="MS dumpbin"
  3745   3737     fi
  3746   3738     rm -f conftest*
  3747   3739   fi
  3748   3740   { $as_echo "$as_me:$LINENO: result: $lt_cv_nm_interface" >&5
................................................................................
  4956   4948   	;;
  4957   4949       esac
  4958   4950     fi
  4959   4951     rm -rf conftest*
  4960   4952     ;;
  4961   4953   *-*-irix6*)
  4962   4954     # Find out which ABI we are using.
  4963         -  echo '#line 4963 "configure"' > conftest.$ac_ext
         4955  +  echo '#line 4955 "configure"' > conftest.$ac_ext
  4964   4956     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  4965   4957     (eval $ac_compile) 2>&5
  4966   4958     ac_status=$?
  4967   4959     $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
  4968   4960     (exit $ac_status); }; then
  4969   4961       if test "$lt_cv_prog_gnu_ld" = yes; then
  4970   4962         case `/usr/bin/file conftest.$ac_objext` in
................................................................................
  6825   6817      # Note that $ac_compile itself does not contain backslashes and begins
  6826   6818      # with a dollar sign (not a hyphen), so the echo should work correctly.
  6827   6819      # The option is referenced via a variable to avoid confusing sed.
  6828   6820      lt_compile=`echo "$ac_compile" | $SED \
  6829   6821      -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
  6830   6822      -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
  6831   6823      -e 's:$: $lt_compiler_flag:'`
  6832         -   (eval echo "\"\$as_me:6832: $lt_compile\"" >&5)
         6824  +   (eval echo "\"\$as_me:6824: $lt_compile\"" >&5)
  6833   6825      (eval "$lt_compile" 2>conftest.err)
  6834   6826      ac_status=$?
  6835   6827      cat conftest.err >&5
  6836         -   echo "$as_me:6836: \$? = $ac_status" >&5
         6828  +   echo "$as_me:6828: \$? = $ac_status" >&5
  6837   6829      if (exit $ac_status) && test -s "$ac_outfile"; then
  6838   6830        # The compiler can only warn and ignore the option if not recognized
  6839   6831        # So say no if there are warnings other than the usual output.
  6840   6832        $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
  6841   6833        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
  6842   6834        if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
  6843   6835          lt_cv_prog_compiler_rtti_exceptions=yes
................................................................................
  7164   7156      # Note that $ac_compile itself does not contain backslashes and begins
  7165   7157      # with a dollar sign (not a hyphen), so the echo should work correctly.
  7166   7158      # The option is referenced via a variable to avoid confusing sed.
  7167   7159      lt_compile=`echo "$ac_compile" | $SED \
  7168   7160      -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
  7169   7161      -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
  7170   7162      -e 's:$: $lt_compiler_flag:'`
  7171         -   (eval echo "\"\$as_me:7171: $lt_compile\"" >&5)
         7163  +   (eval echo "\"\$as_me:7163: $lt_compile\"" >&5)
  7172   7164      (eval "$lt_compile" 2>conftest.err)
  7173   7165      ac_status=$?
  7174   7166      cat conftest.err >&5
  7175         -   echo "$as_me:7175: \$? = $ac_status" >&5
         7167  +   echo "$as_me:7167: \$? = $ac_status" >&5
  7176   7168      if (exit $ac_status) && test -s "$ac_outfile"; then
  7177   7169        # The compiler can only warn and ignore the option if not recognized
  7178   7170        # So say no if there are warnings other than the usual output.
  7179   7171        $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
  7180   7172        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
  7181   7173        if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
  7182   7174          lt_cv_prog_compiler_pic_works=yes
................................................................................
  7269   7261      # (2) before a word containing "conftest.", or (3) at the end.
  7270   7262      # Note that $ac_compile itself does not contain backslashes and begins
  7271   7263      # with a dollar sign (not a hyphen), so the echo should work correctly.
  7272   7264      lt_compile=`echo "$ac_compile" | $SED \
  7273   7265      -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
  7274   7266      -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
  7275   7267      -e 's:$: $lt_compiler_flag:'`
  7276         -   (eval echo "\"\$as_me:7276: $lt_compile\"" >&5)
         7268  +   (eval echo "\"\$as_me:7268: $lt_compile\"" >&5)
  7277   7269      (eval "$lt_compile" 2>out/conftest.err)
  7278   7270      ac_status=$?
  7279   7271      cat out/conftest.err >&5
  7280         -   echo "$as_me:7280: \$? = $ac_status" >&5
         7272  +   echo "$as_me:7272: \$? = $ac_status" >&5
  7281   7273      if (exit $ac_status) && test -s out/conftest2.$ac_objext
  7282   7274      then
  7283   7275        # The compiler can only warn and ignore the option if not recognized
  7284   7276        # So say no if there are warnings
  7285   7277        $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
  7286   7278        $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
  7287   7279        if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
................................................................................
  7324   7316      # (2) before a word containing "conftest.", or (3) at the end.
  7325   7317      # Note that $ac_compile itself does not contain backslashes and begins
  7326   7318      # with a dollar sign (not a hyphen), so the echo should work correctly.
  7327   7319      lt_compile=`echo "$ac_compile" | $SED \
  7328   7320      -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
  7329   7321      -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
  7330   7322      -e 's:$: $lt_compiler_flag:'`
  7331         -   (eval echo "\"\$as_me:7331: $lt_compile\"" >&5)
         7323  +   (eval echo "\"\$as_me:7323: $lt_compile\"" >&5)
  7332   7324      (eval "$lt_compile" 2>out/conftest.err)
  7333   7325      ac_status=$?
  7334   7326      cat out/conftest.err >&5
  7335         -   echo "$as_me:7335: \$? = $ac_status" >&5
         7327  +   echo "$as_me:7327: \$? = $ac_status" >&5
  7336   7328      if (exit $ac_status) && test -s out/conftest2.$ac_objext
  7337   7329      then
  7338   7330        # The compiler can only warn and ignore the option if not recognized
  7339   7331        # So say no if there are warnings
  7340   7332        $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
  7341   7333        $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
  7342   7334        if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
................................................................................
 10137  10129   else
 10138  10130     	  if test "$cross_compiling" = yes; then :
 10139  10131     lt_cv_dlopen_self=cross
 10140  10132   else
 10141  10133     lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 10142  10134     lt_status=$lt_dlunknown
 10143  10135     cat > conftest.$ac_ext <<_LT_EOF
 10144         -#line 10144 "configure"
        10136  +#line 10136 "configure"
 10145  10137   #include "confdefs.h"
 10146  10138   
 10147  10139   #if HAVE_DLFCN_H
 10148  10140   #include <dlfcn.h>
 10149  10141   #endif
 10150  10142   
 10151  10143   #include <stdio.h>
................................................................................
 10233  10225   else
 10234  10226     	  if test "$cross_compiling" = yes; then :
 10235  10227     lt_cv_dlopen_self_static=cross
 10236  10228   else
 10237  10229     lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 10238  10230     lt_status=$lt_dlunknown
 10239  10231     cat > conftest.$ac_ext <<_LT_EOF
 10240         -#line 10240 "configure"
        10232  +#line 10232 "configure"
 10241  10233   #include "confdefs.h"
 10242  10234   
 10243  10235   #if HAVE_DLFCN_H
 10244  10236   #include <dlfcn.h>
 10245  10237   #endif
 10246  10238   
 10247  10239   #include <stdio.h>
................................................................................
 12142  12134   
 12143  12135   
 12144  12136   
 12145  12137   
 12146  12138   
 12147  12139   
 12148  12140   
 12149         -for ac_func in usleep fdatasync localtime_r gmtime_r localtime_s utime malloc_usable_size
        12141  +
        12142  +
        12143  +for ac_func in fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime
 12150  12144   do
 12151  12145   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 12152  12146   { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
 12153  12147   $as_echo_n "checking for $ac_func... " >&6; }
 12154  12148   if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
 12155  12149     $as_echo_n "(cached) " >&6
 12156  12150   else
................................................................................
 12338  12332   VERSION_NUMBER=`cat $srcdir/VERSION \
 12339  12333                              | sed 's/[^0-9]/ /g' \
 12340  12334                   | awk '{printf "%d%03d%03d",$1,$2,$3}'`
 12341  12335   { $as_echo "$as_me:$LINENO: Version number set to $VERSION_NUMBER" >&5
 12342  12336   $as_echo "$as_me: Version number set to $VERSION_NUMBER" >&6;}
 12343  12337   
 12344  12338   
 12345         -#########
 12346         -# Check to see if the --with-hints=FILE option is used.  If there is none,
 12347         -# then check for a files named "$host.hints" and ../$hosts.hints where
 12348         -# $host is the hostname of the build system.  If still no hints are
 12349         -# found, try looking in $system.hints and ../$system.hints where
 12350         -# $system is the result of uname -s.
 12351         -#
 12352         -
 12353         -# Check whether --with-hints was given.
 12354         -if test "${with_hints+set}" = set; then
 12355         -  withval=$with_hints; hints=$withval
 12356         -fi
 12357         -
 12358         -if test "$hints" = ""; then
 12359         -  host=`hostname | sed 's/\..*//'`
 12360         -  if test -r $host.hints; then
 12361         -    hints=$host.hints
 12362         -  else
 12363         -     if test -r ../$host.hints; then
 12364         -       hints=../$host.hints
 12365         -     fi
 12366         -  fi
 12367         -fi
 12368         -if test "$hints" = ""; then
 12369         -  sys=`uname -s`
 12370         -  if test -r $sys.hints; then
 12371         -    hints=$sys.hints
 12372         -  else
 12373         -     if test -r ../$sys.hints; then
 12374         -       hints=../$sys.hints
 12375         -     fi
 12376         -  fi
 12377         -fi
 12378         -if test "$hints" != ""; then
 12379         -  { $as_echo "$as_me:$LINENO: result: reading hints from $hints" >&5
 12380         -$as_echo "reading hints from $hints" >&6; }
 12381         -  . $hints
 12382         -fi
 12383         -
 12384  12339   #########
 12385  12340   # Locate a compiler for the build machine.  This compiler should
 12386  12341   # generate command-line programs that run on the build machine.
 12387  12342   #
 12388  12343   if test x"$cross_compiling" = xno; then
 12389  12344   	BUILD_CC=$CC
 12390  12345   	BUILD_CFLAGS=$CFLAGS
................................................................................
 12547  12502   ac_res=$ac_cv_search_pthread_create
 12548  12503   if test "$ac_res" != no; then
 12549  12504     test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 12550  12505   
 12551  12506   fi
 12552  12507   
 12553  12508   fi
 12554         -
 12555         -##########
 12556         -# Do we want to allow a connection created in one thread to be used
 12557         -# in another thread.  This does not work on many Linux systems (ex: RedHat 9)
 12558         -# due to bugs in the threading implementations.  This is thus off by default.
 12559         -#
 12560         -# Check whether --enable-cross-thread-connections was given.
 12561         -if test "${enable_cross_thread_connections+set}" = set; then
 12562         -  enableval=$enable_cross_thread_connections;
 12563         -else
 12564         -  enable_xthreadconnect=no
 12565         -fi
 12566         -
 12567         -{ $as_echo "$as_me:$LINENO: checking whether to allow connections to be shared across threads" >&5
 12568         -$as_echo_n "checking whether to allow connections to be shared across threads... " >&6; }
 12569         -if test "$enable_xthreadconnect" = "no"; then
 12570         -  XTHREADCONNECT=''
 12571         -  { $as_echo "$as_me:$LINENO: result: no" >&5
 12572         -$as_echo "no" >&6; }
 12573         -else
 12574         -  XTHREADCONNECT='-DSQLITE_ALLOW_XTHREAD_CONNECT=1'
 12575         -  { $as_echo "$as_me:$LINENO: result: yes" >&5
 12576         -$as_echo "yes" >&6; }
 12577         -fi
 12578         -
 12579  12509   
 12580  12510   ##########
 12581  12511   # Do we want to support release
 12582  12512   #
 12583  12513   # Check whether --enable-releasemode was given.
 12584  12514   if test "${enable_releasemode+set}" = set; then
 12585  12515     enableval=$enable_releasemode;
................................................................................
 13423  13353   
 13424  13354   #########
 13425  13355   # See whether we should allow loadable extensions
 13426  13356   # Check whether --enable-load-extension was given.
 13427  13357   if test "${enable_load_extension+set}" = set; then
 13428  13358     enableval=$enable_load_extension; use_loadextension=$enableval
 13429  13359   else
 13430         -  use_loadextension=no
        13360  +  use_loadextension=yes
 13431  13361   fi
 13432  13362   
 13433  13363   if test "${use_loadextension}" = "yes" ; then
 13434  13364     OPT_FEATURE_FLAGS=""
 13435  13365     { $as_echo "$as_me:$LINENO: checking for library containing dlopen" >&5
 13436  13366   $as_echo_n "checking for library containing dlopen... " >&6; }
 13437  13367   if test "${ac_cv_search_dlopen+set}" = set; then

Changes to configure.ac.

    65     65   #        to find <readline.h> on its own, then this can be blank.
    66     66   #
    67     67   #    TARGET_EXEEXT
    68     68   #
    69     69   #        The filename extension for executables on the
    70     70   #        target platform.  "" for Unix and ".exe" for windows.
    71     71   #
    72         -# The generated configure script will make an attempt to guess
    73         -# at all of the above parameters.  You can override any of
    74         -# the guesses by setting the environment variable named
    75         -# "config_AAAA" where "AAAA" is the name of the parameter
    76         -# described above.  (Exception: srcdir cannot be set this way.)
    77         -# If you have a file that sets one or more of these environment
    78         -# variables, you can invoke configure as follows:
    79         -#
    80         -#           configure --with-hints=FILE
    81         -#
    82         -# where FILE is the name of the file that sets the environment
    83         -# variables.  FILE should be an absolute pathname.
    84         -#
    85     72   # This configure.in file is easy to reuse on other projects.  Just
    86     73   # change the argument to AC_INIT().  And disable any features that
    87     74   # you don't need (for example BLT) by erasing or commenting out
    88     75   # the corresponding code.
    89     76   #
    90     77   AC_INIT(sqlite, m4_esyscmd([cat VERSION | tr -d '\n']))
    91     78   
................................................................................
    94     81   if test "$PACKAGE_VERSION" != "$sqlite_version_sanity_check" ; then
    95     82   AC_MSG_ERROR([configure script is out of date:
    96     83    configure \$PACKAGE_VERSION = $PACKAGE_VERSION
    97     84    top level VERSION file     = $sqlite_version_sanity_check
    98     85   please regen with autoconf])
    99     86   fi
   100     87   
   101         -dnl Put the RCS revision string after AC_INIT so that it will also
   102         -dnl show in in configure.
   103         -# The following RCS revision string applies to configure.in
   104         -# $Revision: 1.56 $
   105         -
   106     88   #########
   107     89   # Programs needed
   108     90   #
   109     91   AC_PROG_LIBTOOL
   110     92   AC_PROG_INSTALL
   111     93   AC_PROG_AWK
   112     94   
................................................................................
   123    105   #########
   124    106   # Check for needed/wanted headers
   125    107   AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h malloc.h])
   126    108   
   127    109   #########
   128    110   # Figure out whether or not we have these functions
   129    111   #
   130         -AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r localtime_s utime malloc_usable_size])
          112  +AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime])
   131    113   
   132    114   #########
   133    115   # By default, we use the amalgamation (this may be changed below...)
   134    116   #
   135    117   USE_AMALGAMATION=1
   136    118   
   137    119   #########
................................................................................
   176    158   AC_SUBST(RELEASE)
   177    159   VERSION_NUMBER=[`cat $srcdir/VERSION \
   178    160                              | sed 's/[^0-9]/ /g' \
   179    161                   | awk '{printf "%d%03d%03d",$1,$2,$3}'`]
   180    162   AC_MSG_NOTICE(Version number set to $VERSION_NUMBER)
   181    163   AC_SUBST(VERSION_NUMBER)
   182    164   
   183         -#########
   184         -# Check to see if the --with-hints=FILE option is used.  If there is none,
   185         -# then check for a files named "$host.hints" and ../$hosts.hints where
   186         -# $host is the hostname of the build system.  If still no hints are
   187         -# found, try looking in $system.hints and ../$system.hints where
   188         -# $system is the result of uname -s.
   189         -#
   190         -AC_ARG_WITH(hints,
   191         -  AC_HELP_STRING([--with-hints=FILE],[Read configuration options from FILE]),
   192         -  hints=$withval)
   193         -if test "$hints" = ""; then
   194         -  host=`hostname | sed 's/\..*//'`
   195         -  if test -r $host.hints; then
   196         -    hints=$host.hints
   197         -  else
   198         -     if test -r ../$host.hints; then
   199         -       hints=../$host.hints
   200         -     fi
   201         -  fi
   202         -fi
   203         -if test "$hints" = ""; then
   204         -  sys=`uname -s`
   205         -  if test -r $sys.hints; then
   206         -    hints=$sys.hints
   207         -  else
   208         -     if test -r ../$sys.hints; then
   209         -       hints=../$sys.hints
   210         -     fi
   211         -  fi
   212         -fi
   213         -if test "$hints" != ""; then
   214         -  AC_MSG_RESULT(reading hints from $hints)
   215         -  . $hints
   216         -fi
   217         -
   218    165   #########
   219    166   # Locate a compiler for the build machine.  This compiler should
   220    167   # generate command-line programs that run on the build machine.
   221    168   #
   222    169   if test x"$cross_compiling" = xno; then
   223    170   	BUILD_CC=$CC
   224    171   	BUILD_CFLAGS=$CFLAGS
................................................................................
   232    179   fi
   233    180   AC_SUBST(BUILD_CC)
   234    181   
   235    182   ##########
   236    183   # Do we want to support multithreaded use of sqlite
   237    184   #
   238    185   AC_ARG_ENABLE(threadsafe, 
   239         -AC_HELP_STRING([--enable-threadsafe],[Support threadsafe operation]),,enable_threadsafe=yes)
          186  +AC_HELP_STRING([--disable-threadsafe],[Disable mutexing]),,enable_threadsafe=yes)
   240    187   AC_MSG_CHECKING([whether to support threadsafe operation])
   241    188   if test "$enable_threadsafe" = "no"; then
   242    189     SQLITE_THREADSAFE=0
   243    190     AC_MSG_RESULT([no])
   244    191   else
   245    192     SQLITE_THREADSAFE=1
   246    193     AC_MSG_RESULT([yes])
................................................................................
   247    194   fi
   248    195   AC_SUBST(SQLITE_THREADSAFE)
   249    196   
   250    197   if test "$SQLITE_THREADSAFE" = "1"; then
   251    198     AC_SEARCH_LIBS(pthread_create, pthread)
   252    199   fi
   253    200   
   254         -##########
   255         -# Do we want to allow a connection created in one thread to be used
   256         -# in another thread.  This does not work on many Linux systems (ex: RedHat 9)
   257         -# due to bugs in the threading implementations.  This is thus off by default.
   258         -#
   259         -AC_ARG_ENABLE(cross-thread-connections, 
   260         -AC_HELP_STRING([--enable-cross-thread-connections],[Allow connection sharing across threads]),,enable_xthreadconnect=no)
   261         -AC_MSG_CHECKING([whether to allow connections to be shared across threads])
   262         -if test "$enable_xthreadconnect" = "no"; then
   263         -  XTHREADCONNECT=''
   264         -  AC_MSG_RESULT([no])
   265         -else
   266         -  XTHREADCONNECT='-DSQLITE_ALLOW_XTHREAD_CONNECT=1'
   267         -  AC_MSG_RESULT([yes])
   268         -fi
   269         -AC_SUBST(XTHREADCONNECT)
   270         -
   271    201   ##########
   272    202   # Do we want to support release
   273    203   #
   274    204   AC_ARG_ENABLE(releasemode, 
   275    205   AC_HELP_STRING([--enable-releasemode],[Support libtool link to release mode]),,enable_releasemode=no)
   276    206   AC_MSG_CHECKING([whether to support shared library linked as release mode or not])
   277    207   if test "$enable_releasemode" = "no"; then
................................................................................
   601    531   if test "${use_amalgamation}" != "yes" ; then
   602    532     USE_AMALGAMATION=0
   603    533   fi
   604    534   AC_SUBST(USE_AMALGAMATION)
   605    535   
   606    536   #########
   607    537   # See whether we should allow loadable extensions
   608         -AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--enable-load-extension],
   609         -      [Enable loading of external extensions]),
   610         -      [use_loadextension=$enableval],[use_loadextension=no])
          538  +AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--disable-load-extension],
          539  +      [Disable loading of external extensions]),
          540  +      [use_loadextension=$enableval],[use_loadextension=yes])
   611    541   if test "${use_loadextension}" = "yes" ; then
   612    542     OPT_FEATURE_FLAGS=""
   613    543     AC_SEARCH_LIBS(dlopen, dl)
   614    544   else
   615    545     OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
   616    546   fi
   617    547   

Changes to ext/fts3/fts3.c.

  1849   1849     const char *zTerm,              /* Term to select leaves for */
  1850   1850     int nTerm,                      /* Size of term zTerm in bytes */
  1851   1851     const char *zNode,              /* Buffer containing segment interior node */
  1852   1852     int nNode,                      /* Size of buffer at zNode */
  1853   1853     sqlite3_int64 *piLeaf,          /* Selected leaf node */
  1854   1854     sqlite3_int64 *piLeaf2          /* Selected leaf node */
  1855   1855   ){
  1856         -  int rc;                         /* Return code */
         1856  +  int rc = SQLITE_OK;             /* Return code */
  1857   1857     int iHeight;                    /* Height of this node in tree */
  1858   1858   
  1859   1859     assert( piLeaf || piLeaf2 );
  1860   1860   
  1861   1861     fts3GetVarint32(zNode, &iHeight);
  1862   1862     rc = fts3ScanInteriorNode(zTerm, nTerm, zNode, nNode, piLeaf, piLeaf2);
  1863   1863     assert( !piLeaf2 || !piLeaf || rc!=SQLITE_OK || (*piLeaf<=*piLeaf2) );
  1864   1864   
  1865   1865     if( rc==SQLITE_OK && iHeight>1 ){
  1866   1866       char *zBlob = 0;              /* Blob read from %_segments table */
  1867         -    int nBlob;                    /* Size of zBlob in bytes */
         1867  +    int nBlob = 0;                /* Size of zBlob in bytes */
  1868   1868   
  1869   1869       if( piLeaf && piLeaf2 && (*piLeaf!=*piLeaf2) ){
  1870   1870         rc = sqlite3Fts3ReadBlock(p, *piLeaf, &zBlob, &nBlob, 0);
  1871   1871         if( rc==SQLITE_OK ){
  1872   1872           rc = fts3SelectLeaf(p, zTerm, nTerm, zBlob, nBlob, piLeaf, 0);
  1873   1873         }
  1874   1874         sqlite3_free(zBlob);
................................................................................
  3082   3082   static int fts3FilterMethod(
  3083   3083     sqlite3_vtab_cursor *pCursor,   /* The cursor used for this query */
  3084   3084     int idxNum,                     /* Strategy index */
  3085   3085     const char *idxStr,             /* Unused */
  3086   3086     int nVal,                       /* Number of elements in apVal */
  3087   3087     sqlite3_value **apVal           /* Arguments for the indexing scheme */
  3088   3088   ){
  3089         -  int rc;
         3089  +  int rc = SQLITE_OK;
  3090   3090     char *zSql;                     /* SQL statement used to access %_content */
  3091   3091     int eSearch;
  3092   3092     Fts3Table *p = (Fts3Table *)pCursor->pVtab;
  3093   3093     Fts3Cursor *pCsr = (Fts3Cursor *)pCursor;
  3094   3094   
  3095   3095     sqlite3_value *pCons = 0;       /* The MATCH or rowid constraint, if any */
  3096   3096     sqlite3_value *pLangid = 0;     /* The "langid = ?" constraint, if any */

Changes to ext/fts3/fts3_tokenize_vtab.c.

   159    159     sqlite3 *db,                    /* Database connection */
   160    160     void *pHash,                    /* Hash table of tokenizers */
   161    161     int argc,                       /* Number of elements in argv array */
   162    162     const char * const *argv,       /* xCreate/xConnect argument array */
   163    163     sqlite3_vtab **ppVtab,          /* OUT: New sqlite3_vtab object */
   164    164     char **pzErr                    /* OUT: sqlite3_malloc'd error message */
   165    165   ){
   166         -  Fts3tokTable *pTab;
          166  +  Fts3tokTable *pTab = 0;
   167    167     const sqlite3_tokenizer_module *pMod = 0;
   168    168     sqlite3_tokenizer *pTok = 0;
   169    169     int rc;
   170    170     char **azDequote = 0;
   171    171     int nDequote;
   172    172   
   173    173     rc = sqlite3_declare_vtab(db, FTS3_TOK_SCHEMA);

Changes to ext/fts3/fts3_write.c.

  3078   3078         }
  3079   3079         bOk = 1;
  3080   3080       }
  3081   3081       rc = sqlite3_reset(pRange);
  3082   3082   
  3083   3083       if( bOk ){
  3084   3084         int iIdx = 0;
  3085         -      sqlite3_stmt *pUpdate1;
  3086         -      sqlite3_stmt *pUpdate2;
         3085  +      sqlite3_stmt *pUpdate1 = 0;
         3086  +      sqlite3_stmt *pUpdate2 = 0;
  3087   3087   
  3088   3088         if( rc==SQLITE_OK ){
  3089   3089           rc = fts3SqlStmt(p, SQL_UPDATE_LEVEL_IDX, &pUpdate1, 0);
  3090   3090         }
  3091   3091         if( rc==SQLITE_OK ){
  3092   3092           rc = fts3SqlStmt(p, SQL_UPDATE_LEVEL, &pUpdate2, 0);
  3093   3093         }

Changes to ext/misc/amatch.c.

   394    394   }
   395    395   
   396    396   /* Remove node pOld from the tree.  pOld must be an element of the tree or
   397    397   ** the AVL tree will become corrupt.
   398    398   */
   399    399   static void amatchAvlRemove(amatch_avl **ppHead, amatch_avl *pOld){
   400    400     amatch_avl **ppParent;
   401         -  amatch_avl *pBalance;
          401  +  amatch_avl *pBalance = 0;
   402    402     /* assert( amatchAvlSearch(*ppHead, pOld->zKey)==pOld ); */
   403    403     ppParent = amatchAvlFromPtr(pOld, ppHead);
   404    404     if( pOld->pBefore==0 && pOld->pAfter==0 ){
   405    405       *ppParent = 0;
   406    406       pBalance = pOld->pUp;
   407    407     }else if( pOld->pBefore && pOld->pAfter ){
   408    408       amatch_avl *pX, *pY;

Changes to ext/misc/spellfix.c.

   352    352   ** then this value is always the number of bytes in zB (i.e. strlen(zB)).
   353    353   ** If zA does end in a '*', then it is the number of bytes in the prefix
   354    354   ** of zB that was deemed to match zA.
   355    355   */
   356    356   static int editdist1(const char *zA, const char *zB, int *pnMatch){
   357    357     int nA, nB;            /* Number of characters in zA[] and zB[] */
   358    358     int xA, xB;            /* Loop counters for zA[] and zB[] */
   359         -  char cA, cB;           /* Current character of zA and zB */
          359  +  char cA = 0, cB;       /* Current character of zA and zB */
   360    360     char cAprev, cBprev;   /* Previous character of zA and zB */
   361    361     char cAnext, cBnext;   /* Next character in zA and zB */
   362    362     int d;                 /* North-west cost value */
   363    363     int dc = 0;            /* North-west character value */
   364    364     int res;               /* Final result */
   365    365     int *m;                /* The cost matrix */
   366    366     char *cx;              /* Corresponding character values */

Changes to ext/rtree/rtree.c.

   366    366   ** Functions to deserialize a 16 bit integer, 32 bit real number and
   367    367   ** 64 bit integer. The deserialized value is returned.
   368    368   */
   369    369   static int readInt16(u8 *p){
   370    370     return (p[0]<<8) + p[1];
   371    371   }
   372    372   static void readCoord(u8 *p, RtreeCoord *pCoord){
   373         -  u32 i = (
          373  +  pCoord->u = (
   374    374       (((u32)p[0]) << 24) + 
   375    375       (((u32)p[1]) << 16) + 
   376    376       (((u32)p[2]) <<  8) + 
   377    377       (((u32)p[3]) <<  0)
   378    378     );
   379         -  *(u32 *)pCoord = i;
   380    379   }
   381    380   static i64 readInt64(u8 *p){
   382    381     return (
   383    382       (((i64)p[0]) << 56) + 
   384    383       (((i64)p[1]) << 48) + 
   385    384       (((i64)p[2]) << 40) + 
   386    385       (((i64)p[3]) << 32) + 
................................................................................
   401    400     p[1] = (i>> 0)&0xFF;
   402    401     return 2;
   403    402   }
   404    403   static int writeCoord(u8 *p, RtreeCoord *pCoord){
   405    404     u32 i;
   406    405     assert( sizeof(RtreeCoord)==4 );
   407    406     assert( sizeof(u32)==4 );
   408         -  i = *(u32 *)pCoord;
          407  +  i = pCoord->u;
   409    408     p[0] = (i>>24)&0xFF;
   410    409     p[1] = (i>>16)&0xFF;
   411    410     p[2] = (i>> 8)&0xFF;
   412    411     p[3] = (i>> 0)&0xFF;
   413    412     return 4;
   414    413   }
   415    414   static int writeInt64(u8 *p, i64 i){
................................................................................
   732    731   static void nodeGetCell(
   733    732     Rtree *pRtree,               /* The overall R-Tree */
   734    733     RtreeNode *pNode,            /* The node containing the cell to be read */
   735    734     int iCell,                   /* Index of the cell within the node */
   736    735     RtreeCell *pCell             /* OUT: Write the cell contents here */
   737    736   ){
   738    737     u8 *pData;
   739         -  u8 *pEnd;
   740    738     RtreeCoord *pCoord;
          739  +  int ii;
   741    740     pCell->iRowid = nodeGetRowid(pRtree, pNode, iCell);
   742    741     pData = pNode->zData + (12 + pRtree->nBytesPerCell*iCell);
   743         -  pEnd = pData + pRtree->nDim*8;
   744    742     pCoord = pCell->aCoord;
   745         -  for(; pData<pEnd; pData+=4, pCoord++){
   746         -    readCoord(pData, pCoord);
          743  +  for(ii=0; ii<pRtree->nDim*2; ii++){
          744  +    readCoord(&pData[ii*4], &pCoord[ii]);
   747    745     }
   748    746   }
   749    747   
   750    748   
   751    749   /* Forward declaration for the function that does the work of
   752    750   ** the virtual table module xCreate() and xConnect() methods.
   753    751   */
................................................................................
  2802   2800     Rtree *pRtree = (Rtree *)pVtab;
  2803   2801     int rc = SQLITE_OK;
  2804   2802     RtreeCell cell;                 /* New cell to insert if nData>1 */
  2805   2803     int bHaveRowid = 0;             /* Set to 1 after new rowid is determined */
  2806   2804   
  2807   2805     rtreeReference(pRtree);
  2808   2806     assert(nData>=1);
         2807  +
         2808  +  cell.iRowid = 0;  /* Used only to suppress a compiler warning */
  2809   2809   
  2810   2810     /* Constraint handling. A write operation on an r-tree table may return
  2811   2811     ** SQLITE_CONSTRAINT for two reasons:
  2812   2812     **
  2813   2813     **   1. A duplicate rowid value, or
  2814   2814     **   2. The supplied data violates the "x2>=x1" constraint.
  2815   2815     **

Changes to main.mk.

   108    108     $(TOP)/src/malloc.c \
   109    109     $(TOP)/src/mem0.c \
   110    110     $(TOP)/src/mem1.c \
   111    111     $(TOP)/src/mem2.c \
   112    112     $(TOP)/src/mem3.c \
   113    113     $(TOP)/src/mem5.c \
   114    114     $(TOP)/src/memjournal.c \
          115  +  $(TOP)/src/msvc.h \
   115    116     $(TOP)/src/mutex.c \
   116    117     $(TOP)/src/mutex.h \
   117    118     $(TOP)/src/mutex_noop.c \
   118    119     $(TOP)/src/mutex_unix.c \
   119    120     $(TOP)/src/mutex_w32.c \
   120    121     $(TOP)/src/notify.c \
   121    122     $(TOP)/src/os.c \
................................................................................
   343    344   #
   344    345   HDR = \
   345    346      $(TOP)/src/btree.h \
   346    347      $(TOP)/src/btreeInt.h \
   347    348      $(TOP)/src/hash.h \
   348    349      $(TOP)/src/hwtime.h \
   349    350      keywordhash.h \
          351  +   $(TOP)/src/msvc.h \
   350    352      $(TOP)/src/mutex.h \
   351    353      opcodes.h \
   352    354      $(TOP)/src/os.h \
   353    355      $(TOP)/src/os_common.h \
   354    356      $(TOP)/src/os_setup.h \
   355    357      $(TOP)/src/os_win.h \
   356    358      $(TOP)/src/pager.h \
................................................................................
   671    673   # releasetest.tcl script.
   672    674   #
   673    675   checksymbols: sqlite3.o
   674    676   	nm -g --defined-only sqlite3.o | grep -v " sqlite3_" ; test $$? -ne 0
   675    677   
   676    678   # Build the amalgamation-autoconf package.
   677    679   #
   678         -dist: sqlite3.c
          680  +amalgamation-tarball: sqlite3.c
   679    681   	TOP=$(TOP) sh $(TOP)/tool/mkautoconfamal.sh
   680    682   
   681    683   
   682    684   # Standard install and cleanup targets
   683    685   #
   684    686   install:	sqlite3 libsqlite3.a sqlite3.h
   685    687   	mv sqlite3 /usr/bin

Changes to src/ctime.c.

    29     29   static const char * const azCompileOpt[] = {
    30     30   
    31     31   /* These macros are provided to "stringify" the value of the define
    32     32   ** for those options in which the value is meaningful. */
    33     33   #define CTIMEOPT_VAL_(opt) #opt
    34     34   #define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt)
    35     35   
    36         -#ifdef SQLITE_32BIT_ROWID
           36  +#if SQLITE_32BIT_ROWID
    37     37     "32BIT_ROWID",
    38     38   #endif
    39         -#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC
           39  +#if SQLITE_4_BYTE_ALIGNED_MALLOC
    40     40     "4_BYTE_ALIGNED_MALLOC",
    41     41   #endif
    42         -#ifdef SQLITE_CASE_SENSITIVE_LIKE
           42  +#if SQLITE_CASE_SENSITIVE_LIKE
    43     43     "CASE_SENSITIVE_LIKE",
    44     44   #endif
    45         -#ifdef SQLITE_CHECK_PAGES
           45  +#if SQLITE_CHECK_PAGES
    46     46     "CHECK_PAGES",
    47     47   #endif
    48         -#ifdef SQLITE_COVERAGE_TEST
           48  +#if SQLITE_COVERAGE_TEST
    49     49     "COVERAGE_TEST",
    50     50   #endif
    51         -#ifdef SQLITE_DEBUG
           51  +#if SQLITE_DEBUG
    52     52     "DEBUG",
    53     53   #endif
    54         -#ifdef SQLITE_DEFAULT_LOCKING_MODE
           54  +#if SQLITE_DEFAULT_LOCKING_MODE
    55     55     "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE),
    56     56   #endif
    57     57   #if defined(SQLITE_DEFAULT_MMAP_SIZE) && !defined(SQLITE_DEFAULT_MMAP_SIZE_xc)
    58     58     "DEFAULT_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_MMAP_SIZE),
    59     59   #endif
    60         -#ifdef SQLITE_DISABLE_DIRSYNC
           60  +#if SQLITE_DISABLE_DIRSYNC
    61     61     "DISABLE_DIRSYNC",
    62     62   #endif
    63         -#ifdef SQLITE_DISABLE_LFS
           63  +#if SQLITE_DISABLE_LFS
    64     64     "DISABLE_LFS",
    65     65   #endif
    66         -#ifdef SQLITE_ENABLE_API_ARMOR
           66  +#if SQLITE_ENABLE_API_ARMOR
    67     67     "ENABLE_API_ARMOR",
    68     68   #endif
    69         -#ifdef SQLITE_ENABLE_ATOMIC_WRITE
           69  +#if SQLITE_ENABLE_ATOMIC_WRITE
    70     70     "ENABLE_ATOMIC_WRITE",
    71     71   #endif
    72         -#ifdef SQLITE_ENABLE_CEROD
           72  +#if SQLITE_ENABLE_CEROD
    73     73     "ENABLE_CEROD",
    74     74   #endif
    75         -#ifdef SQLITE_ENABLE_COLUMN_METADATA
           75  +#if SQLITE_ENABLE_COLUMN_METADATA
    76     76     "ENABLE_COLUMN_METADATA",
    77     77   #endif
    78         -#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT
           78  +#if SQLITE_ENABLE_EXPENSIVE_ASSERT
    79     79     "ENABLE_EXPENSIVE_ASSERT",
    80     80   #endif
    81         -#ifdef SQLITE_ENABLE_FTS1
           81  +#if SQLITE_ENABLE_FTS1
    82     82     "ENABLE_FTS1",
    83     83   #endif
    84         -#ifdef SQLITE_ENABLE_FTS2
           84  +#if SQLITE_ENABLE_FTS2
    85     85     "ENABLE_FTS2",
    86     86   #endif
    87         -#ifdef SQLITE_ENABLE_FTS3
           87  +#if SQLITE_ENABLE_FTS3
    88     88     "ENABLE_FTS3",
    89     89   #endif
    90         -#ifdef SQLITE_ENABLE_FTS3_PARENTHESIS
           90  +#if SQLITE_ENABLE_FTS3_PARENTHESIS
    91     91     "ENABLE_FTS3_PARENTHESIS",
    92     92   #endif
    93         -#ifdef SQLITE_ENABLE_FTS4
           93  +#if SQLITE_ENABLE_FTS4
    94     94     "ENABLE_FTS4",
    95     95   #endif
    96         -#ifdef SQLITE_ENABLE_ICU
           96  +#if SQLITE_ENABLE_ICU
    97     97     "ENABLE_ICU",
    98     98   #endif
    99         -#ifdef SQLITE_ENABLE_IOTRACE
           99  +#if SQLITE_ENABLE_IOTRACE
   100    100     "ENABLE_IOTRACE",
   101    101   #endif
   102         -#ifdef SQLITE_ENABLE_LOAD_EXTENSION
          102  +#if SQLITE_ENABLE_LOAD_EXTENSION
   103    103     "ENABLE_LOAD_EXTENSION",
   104    104   #endif
   105         -#ifdef SQLITE_ENABLE_LOCKING_STYLE
          105  +#if SQLITE_ENABLE_LOCKING_STYLE
   106    106     "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
   107    107   #endif
   108         -#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
          108  +#if SQLITE_ENABLE_MEMORY_MANAGEMENT
   109    109     "ENABLE_MEMORY_MANAGEMENT",
   110    110   #endif
   111         -#ifdef SQLITE_ENABLE_MEMSYS3
          111  +#if SQLITE_ENABLE_MEMSYS3
   112    112     "ENABLE_MEMSYS3",
   113    113   #endif
   114         -#ifdef SQLITE_ENABLE_MEMSYS5
          114  +#if SQLITE_ENABLE_MEMSYS5
   115    115     "ENABLE_MEMSYS5",
   116    116   #endif
   117         -#ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK
          117  +#if SQLITE_ENABLE_OVERSIZE_CELL_CHECK
   118    118     "ENABLE_OVERSIZE_CELL_CHECK",
   119    119   #endif
   120         -#ifdef SQLITE_ENABLE_RTREE
          120  +#if SQLITE_ENABLE_RTREE
   121    121     "ENABLE_RTREE",
   122    122   #endif
   123    123   #if defined(SQLITE_ENABLE_STAT4)
   124    124     "ENABLE_STAT4",
   125    125   #elif defined(SQLITE_ENABLE_STAT3)
   126    126     "ENABLE_STAT3",
   127    127   #endif
   128         -#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY
          128  +#if SQLITE_ENABLE_UNLOCK_NOTIFY
   129    129     "ENABLE_UNLOCK_NOTIFY",
   130    130   #endif
   131         -#ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
          131  +#if SQLITE_ENABLE_UPDATE_DELETE_LIMIT
   132    132     "ENABLE_UPDATE_DELETE_LIMIT",
   133    133   #endif
   134         -#ifdef SQLITE_HAS_CODEC
          134  +#if SQLITE_HAS_CODEC
   135    135     "HAS_CODEC",
   136    136   #endif
   137         -#ifdef SQLITE_HAVE_ISNAN
          137  +#if HAVE_ISNAN || SQLITE_HAVE_ISNAN
   138    138     "HAVE_ISNAN",
   139    139   #endif
   140         -#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX
          140  +#if SQLITE_HOMEGROWN_RECURSIVE_MUTEX
   141    141     "HOMEGROWN_RECURSIVE_MUTEX",
   142    142   #endif
   143         -#ifdef SQLITE_IGNORE_AFP_LOCK_ERRORS
          143  +#if SQLITE_IGNORE_AFP_LOCK_ERRORS
   144    144     "IGNORE_AFP_LOCK_ERRORS",
   145    145   #endif
   146         -#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS
          146  +#if SQLITE_IGNORE_FLOCK_LOCK_ERRORS
   147    147     "IGNORE_FLOCK_LOCK_ERRORS",
   148    148   #endif
   149    149   #ifdef SQLITE_INT64_TYPE
   150    150     "INT64_TYPE",
   151    151   #endif
   152         -#ifdef SQLITE_LOCK_TRACE
          152  +#if SQLITE_LOCK_TRACE
   153    153     "LOCK_TRACE",
   154    154   #endif
   155    155   #if defined(SQLITE_MAX_MMAP_SIZE) && !defined(SQLITE_MAX_MMAP_SIZE_xc)
   156    156     "MAX_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE),
   157    157   #endif
   158    158   #ifdef SQLITE_MAX_SCHEMA_RETRY
   159    159     "MAX_SCHEMA_RETRY=" CTIMEOPT_VAL(SQLITE_MAX_SCHEMA_RETRY),
   160    160   #endif
   161         -#ifdef SQLITE_MEMDEBUG
          161  +#if SQLITE_MEMDEBUG
   162    162     "MEMDEBUG",
   163    163   #endif
   164         -#ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT
          164  +#if SQLITE_MIXED_ENDIAN_64BIT_FLOAT
   165    165     "MIXED_ENDIAN_64BIT_FLOAT",
   166    166   #endif
   167         -#ifdef SQLITE_NO_SYNC
          167  +#if SQLITE_NO_SYNC
   168    168     "NO_SYNC",
   169    169   #endif
   170         -#ifdef SQLITE_OMIT_ALTERTABLE
          170  +#if SQLITE_OMIT_ALTERTABLE
   171    171     "OMIT_ALTERTABLE",
   172    172   #endif
   173         -#ifdef SQLITE_OMIT_ANALYZE
          173  +#if SQLITE_OMIT_ANALYZE
   174    174     "OMIT_ANALYZE",
   175    175   #endif
   176         -#ifdef SQLITE_OMIT_ATTACH
          176  +#if SQLITE_OMIT_ATTACH
   177    177     "OMIT_ATTACH",
   178    178   #endif
   179         -#ifdef SQLITE_OMIT_AUTHORIZATION
          179  +#if SQLITE_OMIT_AUTHORIZATION
   180    180     "OMIT_AUTHORIZATION",
   181    181   #endif
   182         -#ifdef SQLITE_OMIT_AUTOINCREMENT
          182  +#if SQLITE_OMIT_AUTOINCREMENT
   183    183     "OMIT_AUTOINCREMENT",
   184    184   #endif
   185         -#ifdef SQLITE_OMIT_AUTOINIT
          185  +#if SQLITE_OMIT_AUTOINIT
   186    186     "OMIT_AUTOINIT",
   187    187   #endif
   188         -#ifdef SQLITE_OMIT_AUTOMATIC_INDEX
          188  +#if SQLITE_OMIT_AUTOMATIC_INDEX
   189    189     "OMIT_AUTOMATIC_INDEX",
   190    190   #endif
   191         -#ifdef SQLITE_OMIT_AUTORESET
          191  +#if SQLITE_OMIT_AUTORESET
   192    192     "OMIT_AUTORESET",
   193    193   #endif
   194         -#ifdef SQLITE_OMIT_AUTOVACUUM
          194  +#if SQLITE_OMIT_AUTOVACUUM
   195    195     "OMIT_AUTOVACUUM",
   196    196   #endif
   197         -#ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION
          197  +#if SQLITE_OMIT_BETWEEN_OPTIMIZATION
   198    198     "OMIT_BETWEEN_OPTIMIZATION",
   199    199   #endif
   200         -#ifdef SQLITE_OMIT_BLOB_LITERAL
          200  +#if SQLITE_OMIT_BLOB_LITERAL
   201    201     "OMIT_BLOB_LITERAL",
   202    202   #endif
   203         -#ifdef SQLITE_OMIT_BTREECOUNT
          203  +#if SQLITE_OMIT_BTREECOUNT
   204    204     "OMIT_BTREECOUNT",
   205    205   #endif
   206         -#ifdef SQLITE_OMIT_BUILTIN_TEST
          206  +#if SQLITE_OMIT_BUILTIN_TEST
   207    207     "OMIT_BUILTIN_TEST",
   208    208   #endif
   209         -#ifdef SQLITE_OMIT_CAST
          209  +#if SQLITE_OMIT_CAST
   210    210     "OMIT_CAST",
   211    211   #endif
   212         -#ifdef SQLITE_OMIT_CHECK
          212  +#if SQLITE_OMIT_CHECK
   213    213     "OMIT_CHECK",
   214    214   #endif
   215         -#ifdef SQLITE_OMIT_COMPLETE
          215  +#if SQLITE_OMIT_COMPLETE
   216    216     "OMIT_COMPLETE",
   217    217   #endif
   218         -#ifdef SQLITE_OMIT_COMPOUND_SELECT
          218  +#if SQLITE_OMIT_COMPOUND_SELECT
   219    219     "OMIT_COMPOUND_SELECT",
   220    220   #endif
   221         -#ifdef SQLITE_OMIT_CTE
          221  +#if SQLITE_OMIT_CTE
   222    222     "OMIT_CTE",
   223    223   #endif
   224         -#ifdef SQLITE_OMIT_DATETIME_FUNCS
          224  +#if SQLITE_OMIT_DATETIME_FUNCS
   225    225     "OMIT_DATETIME_FUNCS",
   226    226   #endif
   227         -#ifdef SQLITE_OMIT_DECLTYPE
          227  +#if SQLITE_OMIT_DECLTYPE
   228    228     "OMIT_DECLTYPE",
   229    229   #endif
   230         -#ifdef SQLITE_OMIT_DEPRECATED
          230  +#if SQLITE_OMIT_DEPRECATED
   231    231     "OMIT_DEPRECATED",
   232    232   #endif
   233         -#ifdef SQLITE_OMIT_DISKIO
          233  +#if SQLITE_OMIT_DISKIO
   234    234     "OMIT_DISKIO",
   235    235   #endif
   236         -#ifdef SQLITE_OMIT_EXPLAIN
          236  +#if SQLITE_OMIT_EXPLAIN
   237    237     "OMIT_EXPLAIN",
   238    238   #endif
   239         -#ifdef SQLITE_OMIT_FLAG_PRAGMAS
          239  +#if SQLITE_OMIT_FLAG_PRAGMAS
   240    240     "OMIT_FLAG_PRAGMAS",
   241    241   #endif
   242         -#ifdef SQLITE_OMIT_FLOATING_POINT
          242  +#if SQLITE_OMIT_FLOATING_POINT
   243    243     "OMIT_FLOATING_POINT",
   244    244   #endif
   245         -#ifdef SQLITE_OMIT_FOREIGN_KEY
          245  +#if SQLITE_OMIT_FOREIGN_KEY
   246    246     "OMIT_FOREIGN_KEY",
   247    247   #endif
   248         -#ifdef SQLITE_OMIT_GET_TABLE
          248  +#if SQLITE_OMIT_GET_TABLE
   249    249     "OMIT_GET_TABLE",
   250    250   #endif
   251         -#ifdef SQLITE_OMIT_INCRBLOB
          251  +#if SQLITE_OMIT_INCRBLOB
   252    252     "OMIT_INCRBLOB",
   253    253   #endif
   254         -#ifdef SQLITE_OMIT_INTEGRITY_CHECK
          254  +#if SQLITE_OMIT_INTEGRITY_CHECK
   255    255     "OMIT_INTEGRITY_CHECK",
   256    256   #endif
   257         -#ifdef SQLITE_OMIT_LIKE_OPTIMIZATION
          257  +#if SQLITE_OMIT_LIKE_OPTIMIZATION
   258    258     "OMIT_LIKE_OPTIMIZATION",
   259    259   #endif
   260         -#ifdef SQLITE_OMIT_LOAD_EXTENSION
          260  +#if SQLITE_OMIT_LOAD_EXTENSION
   261    261     "OMIT_LOAD_EXTENSION",
   262    262   #endif
   263         -#ifdef SQLITE_OMIT_LOCALTIME
          263  +#if SQLITE_OMIT_LOCALTIME
   264    264     "OMIT_LOCALTIME",
   265    265   #endif
   266         -#ifdef SQLITE_OMIT_LOOKASIDE
          266  +#if SQLITE_OMIT_LOOKASIDE
   267    267     "OMIT_LOOKASIDE",
   268    268   #endif
   269         -#ifdef SQLITE_OMIT_MEMORYDB
          269  +#if SQLITE_OMIT_MEMORYDB
   270    270     "OMIT_MEMORYDB",
   271    271   #endif
   272         -#ifdef SQLITE_OMIT_OR_OPTIMIZATION
          272  +#if SQLITE_OMIT_OR_OPTIMIZATION
   273    273     "OMIT_OR_OPTIMIZATION",
   274    274   #endif
   275         -#ifdef SQLITE_OMIT_PAGER_PRAGMAS
          275  +#if SQLITE_OMIT_PAGER_PRAGMAS
   276    276     "OMIT_PAGER_PRAGMAS",
   277    277   #endif
   278         -#ifdef SQLITE_OMIT_PRAGMA
          278  +#if SQLITE_OMIT_PRAGMA
   279    279     "OMIT_PRAGMA",
   280    280   #endif
   281         -#ifdef SQLITE_OMIT_PROGRESS_CALLBACK
          281  +#if SQLITE_OMIT_PROGRESS_CALLBACK
   282    282     "OMIT_PROGRESS_CALLBACK",
   283    283   #endif
   284         -#ifdef SQLITE_OMIT_QUICKBALANCE
          284  +#if SQLITE_OMIT_QUICKBALANCE
   285    285     "OMIT_QUICKBALANCE",
   286    286   #endif
   287         -#ifdef SQLITE_OMIT_REINDEX
          287  +#if SQLITE_OMIT_REINDEX
   288    288     "OMIT_REINDEX",
   289    289   #endif
   290         -#ifdef SQLITE_OMIT_SCHEMA_PRAGMAS
          290  +#if SQLITE_OMIT_SCHEMA_PRAGMAS
   291    291     "OMIT_SCHEMA_PRAGMAS",
   292    292   #endif
   293         -#ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
          293  +#if SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
   294    294     "OMIT_SCHEMA_VERSION_PRAGMAS",
   295    295   #endif
   296         -#ifdef SQLITE_OMIT_SHARED_CACHE
          296  +#if SQLITE_OMIT_SHARED_CACHE
   297    297     "OMIT_SHARED_CACHE",
   298    298   #endif
   299         -#ifdef SQLITE_OMIT_SUBQUERY
          299  +#if SQLITE_OMIT_SUBQUERY
   300    300     "OMIT_SUBQUERY",
   301    301   #endif
   302         -#ifdef SQLITE_OMIT_TCL_VARIABLE
          302  +#if SQLITE_OMIT_TCL_VARIABLE
   303    303     "OMIT_TCL_VARIABLE",
   304    304   #endif
   305         -#ifdef SQLITE_OMIT_TEMPDB
          305  +#if SQLITE_OMIT_TEMPDB
   306    306     "OMIT_TEMPDB",
   307    307   #endif
   308         -#ifdef SQLITE_OMIT_TRACE
          308  +#if SQLITE_OMIT_TRACE
   309    309     "OMIT_TRACE",
   310    310   #endif
   311         -#ifdef SQLITE_OMIT_TRIGGER
          311  +#if SQLITE_OMIT_TRIGGER
   312    312     "OMIT_TRIGGER",
   313    313   #endif
   314         -#ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
          314  +#if SQLITE_OMIT_TRUNCATE_OPTIMIZATION
   315    315     "OMIT_TRUNCATE_OPTIMIZATION",
   316    316   #endif
   317         -#ifdef SQLITE_OMIT_UTF16
          317  +#if SQLITE_OMIT_UTF16
   318    318     "OMIT_UTF16",
   319    319   #endif
   320         -#ifdef SQLITE_OMIT_VACUUM
          320  +#if SQLITE_OMIT_VACUUM
   321    321     "OMIT_VACUUM",
   322    322   #endif
   323         -#ifdef SQLITE_OMIT_VIEW
          323  +#if SQLITE_OMIT_VIEW
   324    324     "OMIT_VIEW",
   325    325   #endif
   326         -#ifdef SQLITE_OMIT_VIRTUALTABLE
          326  +#if SQLITE_OMIT_VIRTUALTABLE
   327    327     "OMIT_VIRTUALTABLE",
   328    328   #endif
   329         -#ifdef SQLITE_OMIT_WAL
          329  +#if SQLITE_OMIT_WAL
   330    330     "OMIT_WAL",
   331    331   #endif
   332         -#ifdef SQLITE_OMIT_WSD
          332  +#if SQLITE_OMIT_WSD
   333    333     "OMIT_WSD",
   334    334   #endif
   335         -#ifdef SQLITE_OMIT_XFER_OPT
          335  +#if SQLITE_OMIT_XFER_OPT
   336    336     "OMIT_XFER_OPT",
   337    337   #endif
   338         -#ifdef SQLITE_PERFORMANCE_TRACE
          338  +#if SQLITE_PERFORMANCE_TRACE
   339    339     "PERFORMANCE_TRACE",
   340    340   #endif
   341         -#ifdef SQLITE_PROXY_DEBUG
          341  +#if SQLITE_PROXY_DEBUG
   342    342     "PROXY_DEBUG",
   343    343   #endif
   344         -#ifdef SQLITE_RTREE_INT_ONLY
          344  +#if SQLITE_RTREE_INT_ONLY
   345    345     "RTREE_INT_ONLY",
   346    346   #endif
   347         -#ifdef SQLITE_SECURE_DELETE
          347  +#if SQLITE_SECURE_DELETE
   348    348     "SECURE_DELETE",
   349    349   #endif
   350         -#ifdef SQLITE_SMALL_STACK
          350  +#if SQLITE_SMALL_STACK
   351    351     "SMALL_STACK",
   352    352   #endif
   353         -#ifdef SQLITE_SOUNDEX
          353  +#if SQLITE_SOUNDEX
   354    354     "SOUNDEX",
   355    355   #endif
   356         -#ifdef SQLITE_SYSTEM_MALLOC
          356  +#if SQLITE_SYSTEM_MALLOC
   357    357     "SYSTEM_MALLOC",
   358    358   #endif
   359         -#ifdef SQLITE_TCL
          359  +#if SQLITE_TCL
   360    360     "TCL",
   361    361   #endif
   362    362   #if defined(SQLITE_TEMP_STORE) && !defined(SQLITE_TEMP_STORE_xc)
   363    363     "TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE),
   364    364   #endif
   365         -#ifdef SQLITE_TEST
          365  +#if SQLITE_TEST
   366    366     "TEST",
   367    367   #endif
   368    368   #if defined(SQLITE_THREADSAFE)
   369    369     "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE),
   370    370   #endif
   371         -#ifdef SQLITE_USE_ALLOCA
          371  +#if SQLITE_USE_ALLOCA
   372    372     "USE_ALLOCA",
   373    373   #endif
   374         -#ifdef SQLITE_USER_AUTHENTICATION
          374  +#if SQLITE_USER_AUTHENTICATION
   375    375     "USER_AUTHENTICATION",
   376    376   #endif
   377         -#ifdef SQLITE_WIN32_MALLOC
          377  +#if SQLITE_WIN32_MALLOC
   378    378     "WIN32_MALLOC",
   379    379   #endif
   380         -#ifdef SQLITE_ZERO_MALLOC
          380  +#if SQLITE_ZERO_MALLOC
   381    381     "ZERO_MALLOC"
   382    382   #endif
   383    383   };
   384    384   
   385    385   /*
   386    386   ** Given the name of a compile-time option, return true if that option
   387    387   ** was used and false if not.
................................................................................
   388    388   **
   389    389   ** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix
   390    390   ** is not required for a match.
   391    391   */
   392    392   int sqlite3_compileoption_used(const char *zOptName){
   393    393     int i, n;
   394    394   
   395         -#ifdef SQLITE_ENABLE_API_ARMOR
          395  +#if SQLITE_ENABLE_API_ARMOR
   396    396     if( zOptName==0 ){
   397    397       (void)SQLITE_MISUSE_BKPT;
   398    398       return 0;
   399    399     }
   400    400   #endif
   401    401     if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7;
   402    402     n = sqlite3Strlen30(zOptName);

Changes to src/date.c.

   408    408   **
   409    409   ** See http://msdn.microsoft.com/en-us/library/a442x3ye(VS.80).aspx.
   410    410   **
   411    411   ** If the user has not indicated to use localtime_r() or localtime_s()
   412    412   ** already, check for an MSVC build environment that provides 
   413    413   ** localtime_s().
   414    414   */
   415         -#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S) && \
   416         -     defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE)
          415  +#if !HAVE_LOCALTIME_R && !HAVE_LOCALTIME_S \
          416  +    && defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE)
          417  +#undef  HAVE_LOCALTIME_S
   417    418   #define HAVE_LOCALTIME_S 1
   418    419   #endif
   419    420   
   420    421   #ifndef SQLITE_OMIT_LOCALTIME
   421    422   /*
   422    423   ** The following routine implements the rough equivalent of localtime_r()
   423    424   ** using whatever operating-system specific localtime facility that
................................................................................
   429    430   **
   430    431   ** EVIDENCE-OF: R-62172-00036 In this implementation, the standard C
   431    432   ** library function localtime_r() is used to assist in the calculation of
   432    433   ** local time.
   433    434   */
   434    435   static int osLocaltime(time_t *t, struct tm *pTm){
   435    436     int rc;
   436         -#if (!defined(HAVE_LOCALTIME_R) || !HAVE_LOCALTIME_R) \
   437         -      && (!defined(HAVE_LOCALTIME_S) || !HAVE_LOCALTIME_S)
          437  +#if !HAVE_LOCALTIME_R && !HAVE_LOCALTIME_S
   438    438     struct tm *pX;
   439    439   #if SQLITE_THREADSAFE>0
   440    440     sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
   441    441   #endif
   442    442     sqlite3_mutex_enter(mutex);
   443    443     pX = localtime(t);
   444    444   #ifndef SQLITE_OMIT_BUILTIN_TEST
................................................................................
   447    447     if( pX ) *pTm = *pX;
   448    448     sqlite3_mutex_leave(mutex);
   449    449     rc = pX==0;
   450    450   #else
   451    451   #ifndef SQLITE_OMIT_BUILTIN_TEST
   452    452     if( sqlite3GlobalConfig.bLocaltimeFault ) return 1;
   453    453   #endif
   454         -#if defined(HAVE_LOCALTIME_R) && HAVE_LOCALTIME_R
          454  +#if HAVE_LOCALTIME_R
   455    455     rc = localtime_r(t, pTm)==0;
   456    456   #else
   457    457     rc = localtime_s(pTm, t);
   458    458   #endif /* HAVE_LOCALTIME_R */
   459    459   #endif /* HAVE_LOCALTIME_R || HAVE_LOCALTIME_S */
   460    460     return rc;
   461    461   }
................................................................................
   891    891     sqlite3_value **argv
   892    892   ){
   893    893     DateTime x;
   894    894     u64 n;
   895    895     size_t i,j;
   896    896     char *z;
   897    897     sqlite3 *db;
   898         -  const char *zFmt = (const char*)sqlite3_value_text(argv[0]);
          898  +  const char *zFmt;
   899    899     char zBuf[100];
          900  +  if( argc==0 ) return;
          901  +  zFmt = (const char*)sqlite3_value_text(argv[0]);
   900    902     if( zFmt==0 || isDate(context, argc-1, argv+1, &x) ) return;
   901    903     db = sqlite3_context_db_handle(context);
   902    904     for(i=0, n=1; zFmt[i]; i++, n++){
   903    905       if( zFmt[i]=='%' ){
   904    906         switch( zFmt[i+1] ){
   905    907           case 'd':
   906    908           case 'H':
................................................................................
  1086   1088   
  1087   1089     UNUSED_PARAMETER(argc);
  1088   1090     UNUSED_PARAMETER(argv);
  1089   1091   
  1090   1092     iT = sqlite3StmtCurrentTime(context);
  1091   1093     if( iT<=0 ) return;
  1092   1094     t = iT/1000 - 10000*(sqlite3_int64)21086676;
  1093         -#ifdef HAVE_GMTIME_R
         1095  +#if HAVE_GMTIME_R
  1094   1096     pTm = gmtime_r(&t, &sNow);
  1095   1097   #else
  1096   1098     sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));
  1097   1099     pTm = gmtime(&t);
  1098   1100     if( pTm ) memcpy(&sNow, pTm, sizeof(sNow));
  1099   1101     sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));
  1100   1102   #endif

Changes to src/delete.c.

   222    222     Vdbe *v;               /* The virtual database engine */
   223    223     Table *pTab;           /* The table from which records will be deleted */
   224    224     const char *zDb;       /* Name of database holding pTab */
   225    225     int i;                 /* Loop counter */
   226    226     WhereInfo *pWInfo;     /* Information about the WHERE clause */
   227    227     Index *pIdx;           /* For looping over indices of the table */
   228    228     int iTabCur;           /* Cursor number for the table */
   229         -  int iDataCur;          /* VDBE cursor for the canonical data source */
   230         -  int iIdxCur;           /* Cursor number of the first index */
          229  +  int iDataCur = 0;      /* VDBE cursor for the canonical data source */
          230  +  int iIdxCur = 0;       /* Cursor number of the first index */
   231    231     int nIdx;              /* Number of indices */
   232    232     sqlite3 *db;           /* Main database structure */
   233    233     AuthContext sContext;  /* Authorization context */
   234    234     NameContext sNC;       /* Name context to resolve expressions in */
   235    235     int iDb;               /* Database number */
   236    236     int memCnt = -1;       /* Memory cell used for change counting */
   237    237     int rcauth;            /* Value returned by authorization callback */

Changes to src/expr.c.

   511    511     Parse *pParse,          /* Parsing context */
   512    512     int op,                 /* Expression opcode */
   513    513     Expr *pLeft,            /* Left operand */
   514    514     Expr *pRight,           /* Right operand */
   515    515     const Token *pToken     /* Argument token */
   516    516   ){
   517    517     Expr *p;
   518         -  if( op==TK_AND && pLeft && pRight ){
          518  +  if( op==TK_AND && pLeft && pRight && pParse->nErr==0 ){
   519    519       /* Take advantage of short-circuit false optimization for AND */
   520    520       p = sqlite3ExprAnd(pParse->db, pLeft, pRight);
   521    521     }else{
   522    522       p = sqlite3ExprAlloc(pParse->db, op, pToken, 1);
   523    523       sqlite3ExprAttachSubtrees(pParse->db, p, pLeft, pRight);
   524    524     }
   525    525     if( p ) {
................................................................................
  4065   4065     ** TK_COLUMNs have not yet been converted into TK_AGG_COLUMN.  If
  4066   4066     ** sqlite3FunctionUsesThisSrc() is used differently in the future, the
  4067   4067     ** NEVER() will need to be removed. */
  4068   4068     if( pExpr->op==TK_COLUMN || NEVER(pExpr->op==TK_AGG_COLUMN) ){
  4069   4069       int i;
  4070   4070       struct SrcCount *p = pWalker->u.pSrcCount;
  4071   4071       SrcList *pSrc = p->pSrc;
  4072         -    for(i=0; i<pSrc->nSrc; i++){
         4072  +    int nSrc = pSrc ? pSrc->nSrc : 0;
         4073  +    for(i=0; i<nSrc; i++){
  4073   4074         if( pExpr->iTable==pSrc->a[i].iCursor ) break;
  4074   4075       }
  4075         -    if( i<pSrc->nSrc ){
         4076  +    if( i<nSrc ){
  4076   4077         p->nThis++;
  4077   4078       }else{
  4078   4079         p->nOther++;
  4079   4080       }
  4080   4081     }
  4081   4082     return WRC_Continue;
  4082   4083   }

Changes to src/main.c.

  1353   1353   ** an integer number of milliseconds passed in as the first
  1354   1354   ** argument.
  1355   1355   */
  1356   1356   static int sqliteDefaultBusyCallback(
  1357   1357    void *ptr,               /* Database connection */
  1358   1358    int count                /* Number of times table has been busy */
  1359   1359   ){
  1360         -#if SQLITE_OS_WIN || (defined(HAVE_USLEEP) && HAVE_USLEEP)
         1360  +#if SQLITE_OS_WIN || HAVE_USLEEP
  1361   1361     static const u8 delays[] =
  1362   1362        { 1, 2, 5, 10, 15, 20, 25, 25,  25,  50,  50, 100 };
  1363   1363     static const u8 totals[] =
  1364   1364        { 0, 1, 3,  8, 18, 33, 53, 78, 103, 128, 178, 228 };
  1365   1365   # define NDELAY ArraySize(delays)
  1366   1366     sqlite3 *db = (sqlite3 *)ptr;
  1367   1367     int timeout = db->busyTimeout;
................................................................................
  3258   3258     int *pPrimaryKey,           /* OUTPUT: True if column part of PK */
  3259   3259     int *pAutoinc               /* OUTPUT: True if column is auto-increment */
  3260   3260   ){
  3261   3261     int rc;
  3262   3262     char *zErrMsg = 0;
  3263   3263     Table *pTab = 0;
  3264   3264     Column *pCol = 0;
  3265         -  int iCol;
         3265  +  int iCol = 0;
  3266   3266   
  3267   3267     char const *zDataType = 0;
  3268   3268     char const *zCollSeq = 0;
  3269   3269     int notnull = 0;
  3270   3270     int primarykey = 0;
  3271   3271     int autoinc = 0;
  3272   3272   

Changes to src/mem1.c.

    75     75   #define SQLITE_FREE(x)               free(x)
    76     76   #define SQLITE_REALLOC(x,y)          realloc((x),(y))
    77     77   
    78     78   /*
    79     79   ** The malloc.h header file is needed for malloc_usable_size() function
    80     80   ** on some systems (e.g. Linux).
    81     81   */
    82         -#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLOC_USABLE_SIZE)
    83         -#  define SQLITE_USE_MALLOC_H
    84         -#  define SQLITE_USE_MALLOC_USABLE_SIZE
           82  +#if HAVE_MALLOC_H && HAVE_MALLOC_USABLE_SIZE
           83  +#  define SQLITE_USE_MALLOC_H 1
           84  +#  define SQLITE_USE_MALLOC_USABLE_SIZE 1
    85     85   /*
    86     86   ** The MSVCRT has malloc_usable_size(), but it is called _msize().  The
    87     87   ** use of _msize() is automatic, but can be disabled by compiling with
    88     88   ** -DSQLITE_WITHOUT_MSIZE.  Using the _msize() function also requires
    89     89   ** the malloc.h header file.
    90     90   */
    91     91   #elif defined(_MSC_VER) && !defined(SQLITE_WITHOUT_MSIZE)

Added src/msvc.h.

            1  +/*
            2  +** 2015 January 12
            3  +**
            4  +** The author disclaims copyright to this source code.  In place of
            5  +** a legal notice, here is a blessing:
            6  +**
            7  +**    May you do good and not evil.
            8  +**    May you find forgiveness for yourself and forgive others.
            9  +**    May you share freely, never taking more than you give.
           10  +**
           11  +******************************************************************************
           12  +**
           13  +** This file contains code that is specific to MSVC.
           14  +*/
           15  +#ifndef _MSVC_H_
           16  +#define _MSVC_H_
           17  +
           18  +#if defined(_MSC_VER)
           19  +#pragma warning(disable : 4054)
           20  +#pragma warning(disable : 4055)
           21  +#pragma warning(disable : 4100)
           22  +#pragma warning(disable : 4127)
           23  +#pragma warning(disable : 4152)
           24  +#pragma warning(disable : 4189)
           25  +#pragma warning(disable : 4206)
           26  +#pragma warning(disable : 4210)
           27  +#pragma warning(disable : 4232)
           28  +#pragma warning(disable : 4244)
           29  +#pragma warning(disable : 4305)
           30  +#pragma warning(disable : 4306)
           31  +#pragma warning(disable : 4702)
           32  +#pragma warning(disable : 4706)
           33  +#endif /* defined(_MSC_VER) */
           34  +
           35  +#endif /* _MSVC_H_ */

Changes to src/os_unix.c.

  3769   3769   int sqlite3_fullsync_count = 0;
  3770   3770   #endif
  3771   3771   
  3772   3772   /*
  3773   3773   ** We do not trust systems to provide a working fdatasync().  Some do.
  3774   3774   ** Others do no.  To be safe, we will stick with the (slightly slower)
  3775   3775   ** fsync(). If you know that your system does support fdatasync() correctly,
  3776         -** then simply compile with -Dfdatasync=fdatasync
         3776  +** then simply compile with -Dfdatasync=fdatasync or -DHAVE_FDATASYNC
  3777   3777   */
  3778         -#if !defined(fdatasync)
         3778  +#if !defined(fdatasync) && !HAVE_FDATASYNC
  3779   3779   # define fdatasync fsync
  3780   3780   #endif
  3781   3781   
  3782   3782   /*
  3783   3783   ** Define HAVE_FULLFSYNC to 0 or 1 depending on whether or not
  3784   3784   ** the F_FULLFSYNC macro is defined.  F_FULLFSYNC is currently
  3785   3785   ** only available on Mac OS X.  But that could change.

Changes to src/pcache.c.

    27     27     u8 eCreate;                         /* eCreate value for for xFetch() */
    28     28     int (*xStress)(void*,PgHdr*);       /* Call to try make a page clean */
    29     29     void *pStress;                      /* Argument to xStress */
    30     30     sqlite3_pcache *pCache;             /* Pluggable cache module */
    31     31     PgHdr *pPage1;                      /* Reference to page 1 */
    32     32   };
    33     33   
    34         -/*
    35         -** Some of the assert() macros in this code are too expensive to run
    36         -** even during normal debugging.  Use them only rarely on long-running
    37         -** tests.  Enable the expensive asserts using the
    38         -** -DSQLITE_ENABLE_EXPENSIVE_ASSERT=1 compile-time option.
    39         -*/
    40         -#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT
    41         -# define expensive_assert(X)  assert(X)
    42         -#else
    43         -# define expensive_assert(X)
    44         -#endif
    45         -
    46     34   /********************************** Linked List Management ********************/
    47     35   
    48     36   /* Allowed values for second argument to pcacheManageDirtyList() */
    49     37   #define PCACHE_DIRTYLIST_REMOVE   1    /* Remove pPage from dirty list */
    50     38   #define PCACHE_DIRTYLIST_ADD      2    /* Add pPage to the dirty list */
    51     39   #define PCACHE_DIRTYLIST_FRONT    3    /* Move pPage to the front of the list */
    52     40   

Changes to src/pragma.c.

   723    723   ){
   724    724     char *zLeft = 0;       /* Nul-terminated UTF-8 string <id> */
   725    725     char *zRight = 0;      /* Nul-terminated UTF-8 string <value>, or NULL */
   726    726     const char *zDb = 0;   /* The database name */
   727    727     Token *pId;            /* Pointer to <id> token */
   728    728     char *aFcntl[4];       /* Argument to SQLITE_FCNTL_PRAGMA */
   729    729     int iDb;               /* Database index for <database> */
   730         -  int lwr, upr, mid;           /* Binary search bounds */
          730  +  int lwr, upr, mid = 0;       /* Binary search bounds */
   731    731     int rc;                      /* return value form SQLITE_FCNTL_PRAGMA */
   732    732     sqlite3 *db = pParse->db;    /* The database connection */
   733    733     Db *pDb;                     /* The specific database being pragmaed */
   734    734     Vdbe *v = sqlite3GetVdbe(pParse);  /* Prepared statement */
   735    735   
   736    736     if( v==0 ) return;
   737    737     sqlite3VdbeRunOnlyOnce(v);

Changes to src/printf.c.

     9      9   **
    10     10   ** This file contains code for a set of "printf"-like routines.  These
    11     11   ** routines format strings much like the printf() from the standard C
    12     12   ** library, though the implementation here has enhancements to support
    13     13   ** SQLlite.
    14     14   */
    15     15   #include "sqliteInt.h"
    16         -
    17         -/*
    18         -** If the strchrnul() library function is available, then set
    19         -** HAVE_STRCHRNUL.  If that routine is not available, this module
    20         -** will supply its own.  The built-in version is slower than
    21         -** the glibc version so the glibc version is definitely preferred.
    22         -*/
    23         -#if !defined(HAVE_STRCHRNUL)
    24         -# define HAVE_STRCHRNUL 0
    25         -#endif
    26         -
    27     16   
    28     17   /*
    29     18   ** Conversion types fall into various categories as defined by the
    30     19   ** following enumeration.
    31     20   */
    32     21   #define etRADIX       1 /* Integer types.  %d, %x, %o, and so forth */
    33     22   #define etFLOAT       2 /* Floating point.  %f */

Changes to src/shell.c.

    13     13   ** utility for accessing SQLite databases.
    14     14   */
    15     15   #if (defined(_WIN32) || defined(WIN32)) && !defined(_CRT_SECURE_NO_WARNINGS)
    16     16   /* This needs to come before any includes for MSVC compiler */
    17     17   #define _CRT_SECURE_NO_WARNINGS
    18     18   #endif
    19     19   
           20  +/*
           21  +** If requested, include the SQLite compiler options file for MSVC.
           22  +*/
           23  +#if defined(INCLUDE_MSVC_H)
           24  +#include "msvc.h"
           25  +#endif
           26  +
    20     27   /*
    21     28   ** Enable large-file support for fopen() and friends on unix.
    22     29   */
    23     30   #ifndef SQLITE_DISABLE_LFS
    24     31   # define _LARGE_FILE       1
    25     32   # ifndef _FILE_OFFSET_BITS
    26     33   #   define _FILE_OFFSET_BITS 64
................................................................................
    44     51   # if !defined(__RTP__) && !defined(_WRS_KERNEL)
    45     52   #  include <pwd.h>
    46     53   # endif
    47     54   # include <unistd.h>
    48     55   # include <sys/types.h>
    49     56   #endif
    50     57   
    51         -#if defined(HAVE_READLINE) && HAVE_READLINE!=0
           58  +#if HAVE_READLINE
    52     59   # include <readline/readline.h>
    53     60   # include <readline/history.h>
    54         -#else
           61  +#endif
           62  +#if HAVE_EDITLINE
    55     63   # undef HAVE_READLINE
    56         -#endif
    57         -#if defined(HAVE_EDITLINE) && !defined(HAVE_READLINE)
    58     64   # define HAVE_READLINE 1
    59     65   # include <editline/readline.h>
    60     66   #endif
    61         -#if !defined(HAVE_READLINE)
           67  +#if !HAVE_READLINE
    62     68   # define add_history(X)
    63     69   # define read_history(X)
    64     70   # define write_history(X)
    65     71   # define stifle_history(X)
    66     72   #endif
    67     73   
    68     74   #if defined(_WIN32) || defined(WIN32)
................................................................................
   421    427   static char *one_input_line(FILE *in, char *zPrior, int isContinuation){
   422    428     char *zPrompt;
   423    429     char *zResult;
   424    430     if( in!=0 ){
   425    431       zResult = local_getline(zPrior, in);
   426    432     }else{
   427    433       zPrompt = isContinuation ? continuePrompt : mainPrompt;
   428         -#if defined(HAVE_READLINE)
          434  +#if HAVE_READLINE
   429    435       free(zPrior);
   430    436       zResult = readline(zPrompt);
   431    437       if( zResult && *zResult ) add_history(zResult);
   432    438   #else
   433    439       printf("%s", zPrompt);
   434    440       fflush(stdout);
   435    441       zResult = local_getline(zPrior, stdin);
................................................................................
   467    473     FILE *traceOut;        /* Output for sqlite3_trace() */
   468    474     int nErr;              /* Number of errors seen */
   469    475     int mode;              /* An output mode setting */
   470    476     int writableSchema;    /* True if PRAGMA writable_schema=ON */
   471    477     int showHeader;        /* True to show column names in List or Column mode */
   472    478     unsigned shellFlgs;    /* Various flags */
   473    479     char *zDestTable;      /* Name of destination table when MODE_Insert */
   474         -  char separator[20];    /* Separator character for MODE_List */
   475         -  char newline[20];      /* Record separator in MODE_Csv */
          480  +  char colSeparator[20]; /* Column separator character for several modes */
          481  +  char rowSeparator[20]; /* Row separator character for MODE_Ascii */
   476    482     int colWidth[100];     /* Requested width of each column when in column mode*/
   477    483     int actualWidth[100];  /* Actual width of each column */
   478         -  char nullvalue[20];    /* The text to print when a NULL comes back from
          484  +  char nullValue[20];    /* The text to print when a NULL comes back from
   479    485                            ** the database */
   480    486     SavedModeInfo normalMode;/* Holds the mode just before .explain ON */
   481    487     char outfile[FILENAME_MAX]; /* Filename for *out */
   482    488     const char *zDbFilename;    /* name of the database file */
   483    489     char *zFreeOnClose;         /* Filename to free when closing */
   484    490     const char *zVfs;           /* Name of VFS to use */
   485    491     sqlite3_stmt *pStmt;   /* Current statement if any. */
................................................................................
   504    510   #define MODE_List     2  /* One record per line with a separator */
   505    511   #define MODE_Semi     3  /* Same as MODE_List but append ";" to each line */
   506    512   #define MODE_Html     4  /* Generate an XHTML table */
   507    513   #define MODE_Insert   5  /* Generate SQL "insert" statements */
   508    514   #define MODE_Tcl      6  /* Generate ANSI-C or TCL quoted elements */
   509    515   #define MODE_Csv      7  /* Quote strings, numbers are plain */
   510    516   #define MODE_Explain  8  /* Like MODE_Column, but do not truncate data */
          517  +#define MODE_Ascii    9  /* Use ASCII unit and record separators (0x1F/0x1E) */
   511    518   
   512    519   static const char *modeDescr[] = {
   513    520     "line",
   514    521     "column",
   515    522     "list",
   516    523     "semi",
   517    524     "html",
   518    525     "insert",
   519    526     "tcl",
   520    527     "csv",
   521    528     "explain",
          529  +  "ascii",
   522    530   };
   523    531   
          532  +/*
          533  +** These are the column/row/line separators used by the various
          534  +** import/export modes.
          535  +*/
          536  +#define SEP_Column    "|"
          537  +#define SEP_Row       "\n"
          538  +#define SEP_Tab       "\t"
          539  +#define SEP_Space     " "
          540  +#define SEP_Comma     ","
          541  +#define SEP_CrLf      "\r\n"
          542  +#define SEP_Unit      "\x1F"
          543  +#define SEP_Record    "\x1E"
          544  +
   524    545   /*
   525    546   ** Number of elements in an array
   526    547   */
   527    548   #define ArraySize(X)  (int)(sizeof(X)/sizeof(X[0]))
   528    549   
   529    550   /*
   530    551   ** Compute a string length that is limited to what can be stored in
................................................................................
   673    694     1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
   674    695     1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
   675    696     1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
   676    697     1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
   677    698   };
   678    699   
   679    700   /*
   680         -** Output a single term of CSV.  Actually, p->separator is used for
   681         -** the separator, which may or may not be a comma.  p->nullvalue is
          701  +** Output a single term of CSV.  Actually, p->colSeparator is used for
          702  +** the separator, which may or may not be a comma.  p->nullValue is
   682    703   ** the null value.  Strings are quoted if necessary.  The separator
   683    704   ** is only issued if bSep is true.
   684    705   */
   685    706   static void output_csv(ShellState *p, const char *z, int bSep){
   686    707     FILE *out = p->out;
   687    708     if( z==0 ){
   688         -    fprintf(out,"%s",p->nullvalue);
          709  +    fprintf(out,"%s",p->nullValue);
   689    710     }else{
   690    711       int i;
   691         -    int nSep = strlen30(p->separator);
          712  +    int nSep = strlen30(p->colSeparator);
   692    713       for(i=0; z[i]; i++){
   693    714         if( needCsvQuote[((unsigned char*)z)[i]] 
   694         -         || (z[i]==p->separator[0] && 
   695         -             (nSep==1 || memcmp(z, p->separator, nSep)==0)) ){
          715  +         || (z[i]==p->colSeparator[0] && 
          716  +             (nSep==1 || memcmp(z, p->colSeparator, nSep)==0)) ){
   696    717           i = 0;
   697    718           break;
   698    719         }
   699    720       }
   700    721       if( i==0 ){
   701    722         putc('"', out);
   702    723         for(i=0; z[i]; i++){
................................................................................
   705    726         }
   706    727         putc('"', out);
   707    728       }else{
   708    729         fprintf(out, "%s", z);
   709    730       }
   710    731     }
   711    732     if( bSep ){
   712         -    fprintf(p->out, "%s", p->separator);
          733  +    fprintf(p->out, "%s", p->colSeparator);
   713    734     }
   714    735   }
   715    736   
   716    737   #ifdef SIGINT
   717    738   /*
   718    739   ** This routine runs when the user presses Ctrl-C
   719    740   */
................................................................................
   743    764       case MODE_Line: {
   744    765         int w = 5;
   745    766         if( azArg==0 ) break;
   746    767         for(i=0; i<nArg; i++){
   747    768           int len = strlen30(azCol[i] ? azCol[i] : "");
   748    769           if( len>w ) w = len;
   749    770         }
   750         -      if( p->cnt++>0 ) fprintf(p->out,"\n");
          771  +      if( p->cnt++>0 ) fprintf(p->out, "%s", p->rowSeparator);
   751    772         for(i=0; i<nArg; i++){
   752         -        fprintf(p->out,"%*s = %s\n", w, azCol[i],
   753         -                azArg[i] ? azArg[i] : p->nullvalue);
          773  +        fprintf(p->out,"%*s = %s%s", w, azCol[i],
          774  +                azArg[i] ? azArg[i] : p->nullValue, p->rowSeparator);
   754    775         }
   755    776         break;
   756    777       }
   757    778       case MODE_Explain:
   758    779       case MODE_Column: {
   759    780         if( p->cnt++==0 ){
   760    781           for(i=0; i<nArg; i++){
................................................................................
   763    784               w = p->colWidth[i];
   764    785             }else{
   765    786               w = 0;
   766    787             }
   767    788             if( w==0 ){
   768    789               w = strlen30(azCol[i] ? azCol[i] : "");
   769    790               if( w<10 ) w = 10;
   770         -            n = strlen30(azArg && azArg[i] ? azArg[i] : p->nullvalue);
          791  +            n = strlen30(azArg && azArg[i] ? azArg[i] : p->nullValue);
   771    792               if( w<n ) w = n;
   772    793             }
   773    794             if( i<ArraySize(p->actualWidth) ){
   774    795               p->actualWidth[i] = w;
   775    796             }
   776    797             if( p->showHeader ){
   777    798               if( w<0 ){
   778         -              fprintf(p->out,"%*.*s%s",-w,-w,azCol[i], i==nArg-1 ? "\n": "  ");
          799  +              fprintf(p->out,"%*.*s%s",-w,-w,azCol[i],
          800  +                      i==nArg-1 ? p->rowSeparator : "  ");
   779    801               }else{
   780         -              fprintf(p->out,"%-*.*s%s",w,w,azCol[i], i==nArg-1 ? "\n": "  ");
          802  +              fprintf(p->out,"%-*.*s%s",w,w,azCol[i],
          803  +                      i==nArg-1 ? p->rowSeparator : "  ");
   781    804               }
   782    805             }
   783    806           }
   784    807           if( p->showHeader ){
   785    808             for(i=0; i<nArg; i++){
   786    809               int w;
   787    810               if( i<ArraySize(p->actualWidth) ){
................................................................................
   788    811                  w = p->actualWidth[i];
   789    812                  if( w<0 ) w = -w;
   790    813               }else{
   791    814                  w = 10;
   792    815               }
   793    816               fprintf(p->out,"%-*.*s%s",w,w,"-----------------------------------"
   794    817                      "----------------------------------------------------------",
   795         -                    i==nArg-1 ? "\n": "  ");
          818  +                    i==nArg-1 ? p->rowSeparator : "  ");
   796    819             }
   797    820           }
   798    821         }
   799    822         if( azArg==0 ) break;
   800    823         for(i=0; i<nArg; i++){
   801    824           int w;
   802    825           if( i<ArraySize(p->actualWidth) ){
................................................................................
   811    834             if( p->iIndent<p->nIndent ){
   812    835               fprintf(p->out, "%*.s", p->aiIndent[p->iIndent], "");
   813    836             }
   814    837             p->iIndent++;
   815    838           }
   816    839           if( w<0 ){
   817    840             fprintf(p->out,"%*.*s%s",-w,-w,
   818         -              azArg[i] ? azArg[i] : p->nullvalue, i==nArg-1 ? "\n": "  ");
          841  +              azArg[i] ? azArg[i] : p->nullValue,
          842  +              i==nArg-1 ? p->rowSeparator : "  ");
   819    843           }else{
   820    844             fprintf(p->out,"%-*.*s%s",w,w,
   821         -              azArg[i] ? azArg[i] : p->nullvalue, i==nArg-1 ? "\n": "  ");
          845  +              azArg[i] ? azArg[i] : p->nullValue,
          846  +              i==nArg-1 ? p->rowSeparator : "  ");
   822    847           }
   823    848         }
   824    849         break;
   825    850       }
   826    851       case MODE_Semi:
   827    852       case MODE_List: {
   828    853         if( p->cnt++==0 && p->showHeader ){
   829    854           for(i=0; i<nArg; i++){
   830         -          fprintf(p->out,"%s%s",azCol[i], i==nArg-1 ? "\n" : p->separator);
          855  +          fprintf(p->out,"%s%s",azCol[i],
          856  +                  i==nArg-1 ? p->rowSeparator : p->colSeparator);
   831    857           }
   832    858         }
   833    859         if( azArg==0 ) break;
   834    860         for(i=0; i<nArg; i++){
   835    861           char *z = azArg[i];
   836         -        if( z==0 ) z = p->nullvalue;
          862  +        if( z==0 ) z = p->nullValue;
   837    863           fprintf(p->out, "%s", z);
   838    864           if( i<nArg-1 ){
   839         -          fprintf(p->out, "%s", p->separator);
          865  +          fprintf(p->out, "%s", p->colSeparator);
   840    866           }else if( p->mode==MODE_Semi ){
   841         -          fprintf(p->out, ";\n");
          867  +          fprintf(p->out, ";%s", p->rowSeparator);
   842    868           }else{
   843         -          fprintf(p->out, "\n");
          869  +          fprintf(p->out, "%s", p->rowSeparator);
   844    870           }
   845    871         }
   846    872         break;
   847    873       }
   848    874       case MODE_Html: {
   849    875         if( p->cnt++==0 && p->showHeader ){
   850    876           fprintf(p->out,"<TR>");
................................................................................
   855    881           }
   856    882           fprintf(p->out,"</TR>\n");
   857    883         }
   858    884         if( azArg==0 ) break;
   859    885         fprintf(p->out,"<TR>");
   860    886         for(i=0; i<nArg; i++){
   861    887           fprintf(p->out,"<TD>");
   862         -        output_html_string(p->out, azArg[i] ? azArg[i] : p->nullvalue);
          888  +        output_html_string(p->out, azArg[i] ? azArg[i] : p->nullValue);
   863    889           fprintf(p->out,"</TD>\n");
   864    890         }
   865    891         fprintf(p->out,"</TR>\n");
   866    892         break;
   867    893       }
   868    894       case MODE_Tcl: {
   869    895         if( p->cnt++==0 && p->showHeader ){
   870    896           for(i=0; i<nArg; i++){
   871    897             output_c_string(p->out,azCol[i] ? azCol[i] : "");
   872         -          if(i<nArg-1) fprintf(p->out, "%s", p->separator);
          898  +          if(i<nArg-1) fprintf(p->out, "%s", p->colSeparator);
   873    899           }
   874         -        fprintf(p->out,"\n");
          900  +        fprintf(p->out, "%s", p->rowSeparator);
   875    901         }
   876    902         if( azArg==0 ) break;
   877    903         for(i=0; i<nArg; i++){
   878         -        output_c_string(p->out, azArg[i] ? azArg[i] : p->nullvalue);
   879         -        if(i<nArg-1) fprintf(p->out, "%s", p->separator);
          904  +        output_c_string(p->out, azArg[i] ? azArg[i] : p->nullValue);
          905  +        if(i<nArg-1) fprintf(p->out, "%s", p->colSeparator);
   880    906         }
   881         -      fprintf(p->out,"\n");
          907  +      fprintf(p->out, "%s", p->rowSeparator);
   882    908         break;
   883    909       }
   884    910       case MODE_Csv: {
   885    911   #if defined(WIN32) || defined(_WIN32)
   886    912         fflush(p->out);
   887    913         _setmode(_fileno(p->out), _O_BINARY);
   888    914   #endif
   889    915         if( p->cnt++==0 && p->showHeader ){
   890    916           for(i=0; i<nArg; i++){
   891    917             output_csv(p, azCol[i] ? azCol[i] : "", i<nArg-1);
   892    918           }
   893         -        fprintf(p->out,"%s",p->newline);
          919  +        fprintf(p->out, "%s", p->rowSeparator);
   894    920         }
   895    921         if( nArg>0 ){
   896    922           for(i=0; i<nArg; i++){
   897    923             output_csv(p, azArg[i], i<nArg-1);
   898    924           }
   899         -        fprintf(p->out,"%s",p->newline);
          925  +        fprintf(p->out, "%s", p->rowSeparator);
   900    926         }
   901    927   #if defined(WIN32) || defined(_WIN32)
   902    928         fflush(p->out);
   903    929         _setmode(_fileno(p->out), _O_TEXT);
   904    930   #endif
   905    931         break;
   906    932       }
................................................................................
   928    954           }else{
   929    955             if( zSep[0] ) fprintf(p->out,"%s",zSep);
   930    956             output_quoted_string(p->out, azArg[i]);
   931    957           }
   932    958         }
   933    959         fprintf(p->out,");\n");
   934    960         break;
          961  +    }
          962  +    case MODE_Ascii: {
          963  +      if( p->cnt++==0 && p->showHeader ){
          964  +        for(i=0; i<nArg; i++){
          965  +          if( i>0 ) fprintf(p->out, "%s", p->colSeparator);
          966  +          fprintf(p->out,"%s",azCol[i] ? azCol[i] : "");
          967  +        }
          968  +        fprintf(p->out, "%s", p->rowSeparator);
          969  +      }
          970  +      if( azArg==0 ) break;
          971  +      for(i=0; i<nArg; i++){
          972  +        if( i>0 ) fprintf(p->out, "%s", p->colSeparator);
          973  +        fprintf(p->out,"%s",azArg[i] ? azArg[i] : p->nullValue);
          974  +      }
          975  +      fprintf(p->out, "%s", p->rowSeparator);
          976  +      break;
   935    977       }
   936    978     }
   937    979     return 0;
   938    980   }
   939    981   
   940    982   /*
   941    983   ** This is the callback routine that the SQLite library
................................................................................
  1694   1736     ".iotrace FILE          Enable I/O diagnostic logging to FILE\n"
  1695   1737   #endif
  1696   1738   #ifndef SQLITE_OMIT_LOAD_EXTENSION
  1697   1739     ".load FILE ?ENTRY?     Load an extension library\n"
  1698   1740   #endif
  1699   1741     ".log FILE|off          Turn logging on or off.  FILE can be stderr/stdout\n"
  1700   1742     ".mode MODE ?TABLE?     Set output mode where MODE is one of:\n"
         1743  +  "                         ascii    Columns/rows delimited by 0x1F and 0x1E\n"
  1701   1744     "                         csv      Comma-separated values\n"
  1702   1745     "                         column   Left-aligned columns.  (See .width)\n"
  1703   1746     "                         html     HTML <table> code\n"
  1704   1747     "                         insert   SQL insert statements for TABLE\n"
  1705   1748     "                         line     One value per line\n"
  1706         -  "                         list     Values delimited by .separator string\n"
         1749  +  "                         list     Values delimited by .separator strings\n"
  1707   1750     "                         tabs     Tab-separated values\n"
  1708   1751     "                         tcl      TCL list elements\n"
  1709   1752     ".nullvalue STRING      Use STRING in place of NULL values\n"
  1710   1753     ".once FILENAME         Output for the next SQL command only to FILENAME\n"
  1711   1754     ".open ?FILENAME?       Close existing database and reopen FILENAME\n"
  1712   1755     ".output ?FILENAME?     Send output to FILENAME or stdout\n"
  1713   1756     ".print STRING...       Print literal STRING\n"
................................................................................
  1716   1759     ".read FILENAME         Execute SQL in FILENAME\n"
  1717   1760     ".restore ?DB? FILE     Restore content of DB (default \"main\") from FILE\n"
  1718   1761     ".save FILE             Write in-memory database into FILE\n"
  1719   1762     ".scanstats on|off      Turn sqlite3_stmt_scanstatus() metrics on or off\n"
  1720   1763     ".schema ?TABLE?        Show the CREATE statements\n"
  1721   1764     "                         If TABLE specified, only show tables matching\n"
  1722   1765     "                         LIKE pattern TABLE.\n"
  1723         -  ".separator STRING ?NL? Change separator used by output mode and .import\n"
  1724         -  "                         NL is the end-of-line mark for CSV\n"
         1766  +  ".separator COL ?ROW?   Change the column separator and optionally the row\n"
         1767  +  "                         separator for both the output mode and .import\n"
  1725   1768     ".shell CMD ARGS...     Run CMD ARGS... in a system shell\n"
  1726   1769     ".show                  Show the current values for various settings\n"
  1727   1770     ".stats on|off          Turn stats on or off\n"
  1728   1771     ".system CMD ARGS...    Run CMD ARGS... in a system shell\n"
  1729   1772     ".tables ?TABLE?        List names of tables\n"
  1730   1773     "                         If TABLE specified, only list tables matching\n"
  1731   1774     "                         LIKE pattern TABLE.\n"
................................................................................
  1998   2041   */
  1999   2042   static void test_breakpoint(void){
  2000   2043     static int nCall = 0;
  2001   2044     nCall++;
  2002   2045   }
  2003   2046   
  2004   2047   /*
  2005         -** An object used to read a CSV file
         2048  +** An object used to read a CSV and other files for import.
  2006   2049   */
  2007         -typedef struct CSVReader CSVReader;
  2008         -struct CSVReader {
         2050  +typedef struct ImportCtx ImportCtx;
         2051  +struct ImportCtx {
  2009   2052     const char *zFile;  /* Name of the input file */
  2010   2053     FILE *in;           /* Read the CSV text from this input stream */
  2011   2054     char *z;            /* Accumulated text for a field */
  2012   2055     int n;              /* Number of bytes in z */
  2013   2056     int nAlloc;         /* Space allocated for z[] */
  2014   2057     int nLine;          /* Current line number */
  2015   2058     int cTerm;          /* Character that terminated the most recent field */
  2016         -  int cSeparator;     /* The separator character.  (Usually ",") */
         2059  +  int cColSep;        /* The column separator character.  (Usually ",") */
         2060  +  int cRowSep;        /* The row separator character.  (Usually "\n") */
  2017   2061   };
  2018   2062   
  2019   2063   /* Append a single byte to z[] */
  2020         -static void csv_append_char(CSVReader *p, int c){
         2064  +static void import_append_char(ImportCtx *p, int c){
  2021   2065     if( p->n+1>=p->nAlloc ){
  2022   2066       p->nAlloc += p->nAlloc + 100;
  2023   2067       p->z = sqlite3_realloc(p->z, p->nAlloc);
  2024   2068       if( p->z==0 ){
  2025   2069         fprintf(stderr, "out of memory\n");
  2026   2070         exit(1);
  2027   2071       }
................................................................................
  2031   2075   
  2032   2076   /* Read a single field of CSV text.  Compatible with rfc4180 and extended
  2033   2077   ** with the option of having a separator other than ",".
  2034   2078   **
  2035   2079   **   +  Input comes from p->in.
  2036   2080   **   +  Store results in p->z of length p->n.  Space to hold p->z comes
  2037   2081   **      from sqlite3_malloc().
  2038         -**   +  Use p->cSep as the separator.  The default is ",".
         2082  +**   +  Use p->cSep as the column separator.  The default is ",".
         2083  +**   +  Use p->rSep as the row separator.  The default is "\n".
  2039   2084   **   +  Keep track of the line number in p->nLine.
  2040   2085   **   +  Store the character that terminates the field in p->cTerm.  Store
  2041   2086   **      EOF on end-of-file.
  2042   2087   **   +  Report syntax errors on stderr
  2043   2088   */
  2044         -static char *csv_read_one_field(CSVReader *p){
  2045         -  int c, pc, ppc;
  2046         -  int cSep = p->cSeparator;
         2089  +static char *csv_read_one_field(ImportCtx *p){
         2090  +  int c;
         2091  +  int cSep = p->cColSep;
         2092  +  int rSep = p->cRowSep;
  2047   2093     p->n = 0;
  2048   2094     c = fgetc(p->in);
  2049   2095     if( c==EOF || seenInterrupt ){
  2050   2096       p->cTerm = EOF;
  2051   2097       return 0;
  2052   2098     }
  2053   2099     if( c=='"' ){
         2100  +    int pc, ppc;
  2054   2101       int startLine = p->nLine;
  2055   2102       int cQuote = c;
  2056   2103       pc = ppc = 0;
  2057   2104       while( 1 ){
  2058   2105         c = fgetc(p->in);
  2059         -      if( c=='\n' ) p->nLine++;
         2106  +      if( c==rSep ) p->nLine++;
  2060   2107         if( c==cQuote ){
  2061   2108           if( pc==cQuote ){
  2062   2109             pc = 0;
  2063   2110             continue;
  2064   2111           }
  2065   2112         }
  2066   2113         if( (c==cSep && pc==cQuote)
  2067         -       || (c=='\n' && pc==cQuote)
  2068         -       || (c=='\n' && pc=='\r' && ppc==cQuote)
         2114  +       || (c==rSep && pc==cQuote)
         2115  +       || (c==rSep && pc=='\r' && ppc==cQuote)
  2069   2116          || (c==EOF && pc==cQuote)
  2070   2117         ){
  2071   2118           do{ p->n--; }while( p->z[p->n]!=cQuote );
  2072   2119           p->cTerm = c;
  2073   2120           break;
  2074   2121         }
  2075   2122         if( pc==cQuote && c!='\r' ){
  2076   2123           fprintf(stderr, "%s:%d: unescaped %c character\n",
  2077   2124                   p->zFile, p->nLine, cQuote);
  2078   2125         }
  2079   2126         if( c==EOF ){
  2080   2127           fprintf(stderr, "%s:%d: unterminated %c-quoted field\n",
  2081   2128                   p->zFile, startLine, cQuote);
  2082         -        p->cTerm = EOF;
         2129  +        p->cTerm = c;
  2083   2130           break;
  2084   2131         }
  2085         -      csv_append_char(p, c);
         2132  +      import_append_char(p, c);
  2086   2133         ppc = pc;
  2087   2134         pc = c;
  2088   2135       }
  2089   2136     }else{
  2090         -    while( c!=EOF && c!=cSep && c!='\n' ){
  2091         -      csv_append_char(p, c);
         2137  +    while( c!=EOF && c!=cSep && c!=rSep ){
         2138  +      import_append_char(p, c);
  2092   2139         c = fgetc(p->in);
  2093   2140       }
  2094         -    if( c=='\n' ){
         2141  +    if( c==rSep ){
  2095   2142         p->nLine++;
  2096   2143         if( p->n>0 && p->z[p->n-1]=='\r' ) p->n--;
  2097   2144       }
  2098   2145       p->cTerm = c;
  2099   2146     }
  2100   2147     if( p->z ) p->z[p->n] = 0;
  2101   2148     return p->z;
  2102   2149   }
         2150  +
         2151  +/* Read a single field of ASCII delimited text.
         2152  +**
         2153  +**   +  Input comes from p->in.
         2154  +**   +  Store results in p->z of length p->n.  Space to hold p->z comes
         2155  +**      from sqlite3_malloc().
         2156  +**   +  Use p->cSep as the column separator.  The default is "\x1F".
         2157  +**   +  Use p->rSep as the row separator.  The default is "\x1E".
         2158  +**   +  Keep track of the row number in p->nLine.
         2159  +**   +  Store the character that terminates the field in p->cTerm.  Store
         2160  +**      EOF on end-of-file.
         2161  +**   +  Report syntax errors on stderr
         2162  +*/
         2163  +static char *ascii_read_one_field(ImportCtx *p){
         2164  +  int c;
         2165  +  int cSep = p->cColSep;
         2166  +  int rSep = p->cRowSep;
         2167  +  p->n = 0;
         2168  +  c = fgetc(p->in);
         2169  +  if( c==EOF || seenInterrupt ){
         2170  +    p->cTerm = EOF;
         2171  +    return 0;
         2172  +  }
         2173  +  while( c!=EOF && c!=cSep && c!=rSep ){
         2174  +    import_append_char(p, c);
         2175  +    c = fgetc(p->in);
         2176  +  }
         2177  +  if( c==rSep ){
         2178  +    p->nLine++;
         2179  +  }
         2180  +  p->cTerm = c;
         2181  +  if( p->z ) p->z[p->n] = 0;
         2182  +  return p->z;
         2183  +}
  2103   2184   
  2104   2185   /*
  2105   2186   ** Try to transfer data for table zTable.  If an error is seen while
  2106   2187   ** moving forward, try to go backwards.  The backwards movement won't
  2107   2188   ** work for WITHOUT ROWID tables.
  2108   2189   */
  2109   2190   static void tryToCloneData(
................................................................................
  2651   2732       char *zTable;               /* Insert data into this table */
  2652   2733       char *zFile;                /* Name of file to extra content from */
  2653   2734       sqlite3_stmt *pStmt = NULL; /* A statement */
  2654   2735       int nCol;                   /* Number of columns in the table */
  2655   2736       int nByte;                  /* Number of bytes in an SQL string */
  2656   2737       int i, j;                   /* Loop counters */
  2657   2738       int needCommit;             /* True to COMMIT or ROLLBACK at end */
  2658         -    int nSep;                   /* Number of bytes in p->separator[] */
         2739  +    int nSep;                   /* Number of bytes in p->colSeparator[] */
  2659   2740       char *zSql;                 /* An SQL statement */
  2660         -    CSVReader sCsv;             /* Reader context */
         2741  +    ImportCtx sCtx;             /* Reader context */
         2742  +    char *(*xRead)(ImportCtx*); /* Procedure to read one value */
  2661   2743       int (*xCloser)(FILE*);      /* Procedure to close th3 connection */
  2662   2744   
  2663   2745       if( nArg!=3 ){
  2664   2746         fprintf(stderr, "Usage: .import FILE TABLE\n");
  2665   2747         goto meta_command_exit;
  2666   2748       }
  2667   2749       zFile = azArg[1];
  2668   2750       zTable = azArg[2];
  2669   2751       seenInterrupt = 0;
  2670         -    memset(&sCsv, 0, sizeof(sCsv));
         2752  +    memset(&sCtx, 0, sizeof(sCtx));
  2671   2753       open_db(p, 0);
  2672         -    nSep = strlen30(p->separator);
         2754  +    nSep = strlen30(p->colSeparator);
         2755  +    if( nSep==0 ){
         2756  +      fprintf(stderr, "Error: non-null column separator required for import\n");
         2757  +      return 1;
         2758  +    }
         2759  +    if( nSep>1 ){
         2760  +      fprintf(stderr, "Error: multi-character column separators not allowed"
         2761  +                      " for import\n");
         2762  +      return 1;
         2763  +    }
         2764  +    nSep = strlen30(p->rowSeparator);
  2673   2765       if( nSep==0 ){
  2674         -      fprintf(stderr, "Error: non-null separator required for import\n");
         2766  +      fprintf(stderr, "Error: non-null row separator required for import\n");
  2675   2767         return 1;
  2676   2768       }
         2769  +    if( nSep==2 && p->mode==MODE_Csv && strcmp(p->rowSeparator, SEP_CrLf)==0 ){
         2770  +      /* When importing CSV (only), if the row separator is set to the
         2771  +      ** default output row separator, change it to the default input
         2772  +      ** row separator.  This avoids having to maintain different input
         2773  +      ** and output row separators. */
         2774  +      sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row);
         2775  +      nSep = strlen30(p->rowSeparator);
         2776  +    }
  2677   2777       if( nSep>1 ){
  2678         -      fprintf(stderr, "Error: multi-character separators not allowed"
         2778  +      fprintf(stderr, "Error: multi-character row separators not allowed"
  2679   2779                         " for import\n");
  2680   2780         return 1;
  2681   2781       }
  2682         -    sCsv.zFile = zFile;
  2683         -    sCsv.nLine = 1;
  2684         -    if( sCsv.zFile[0]=='|' ){
  2685         -      sCsv.in = popen(sCsv.zFile+1, "r");
  2686         -      sCsv.zFile = "<pipe>";
         2782  +    sCtx.zFile = zFile;
         2783  +    sCtx.nLine = 1;
         2784  +    if( sCtx.zFile[0]=='|' ){
         2785  +      sCtx.in = popen(sCtx.zFile+1, "r");
         2786  +      sCtx.zFile = "<pipe>";
  2687   2787         xCloser = pclose;
  2688   2788       }else{
  2689         -      sCsv.in = fopen(sCsv.zFile, "rb");
         2789  +      sCtx.in = fopen(sCtx.zFile, "rb");
  2690   2790         xCloser = fclose;
  2691   2791       }
  2692         -    if( sCsv.in==0 ){
         2792  +    if( p->mode==MODE_Ascii ){
         2793  +      xRead = ascii_read_one_field;
         2794  +    }else{
         2795  +      xRead = csv_read_one_field;
         2796  +    }
         2797  +    if( sCtx.in==0 ){
  2693   2798         fprintf(stderr, "Error: cannot open \"%s\"\n", zFile);
  2694   2799         return 1;
  2695   2800       }
  2696         -    sCsv.cSeparator = p->separator[0];
         2801  +    sCtx.cColSep = p->colSeparator[0];
         2802  +    sCtx.cRowSep = p->rowSeparator[0];
  2697   2803       zSql = sqlite3_mprintf("SELECT * FROM %s", zTable);
  2698   2804       if( zSql==0 ){
  2699   2805         fprintf(stderr, "Error: out of memory\n");
  2700         -      xCloser(sCsv.in);
         2806  +      xCloser(sCtx.in);
  2701   2807         return 1;
  2702   2808       }
  2703   2809       nByte = strlen30(zSql);
  2704   2810       rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
  2705         -    csv_append_char(&sCsv, 0);    /* To ensure sCsv.z is allocated */
         2811  +    import_append_char(&sCtx, 0);    /* To ensure sCtx.z is allocated */
  2706   2812       if( rc && sqlite3_strglob("no such table: *", sqlite3_errmsg(db))==0 ){
  2707   2813         char *zCreate = sqlite3_mprintf("CREATE TABLE %s", zTable);
  2708   2814         char cSep = '(';
  2709         -      while( csv_read_one_field(&sCsv) ){
  2710         -        zCreate = sqlite3_mprintf("%z%c\n  \"%s\" TEXT", zCreate, cSep, sCsv.z);
         2815  +      while( xRead(&sCtx) ){
         2816  +        zCreate = sqlite3_mprintf("%z%c\n  \"%s\" TEXT", zCreate, cSep, sCtx.z);
  2711   2817           cSep = ',';
  2712         -        if( sCsv.cTerm!=sCsv.cSeparator ) break;
         2818  +        if( sCtx.cTerm!=sCtx.cColSep ) break;
  2713   2819         }
  2714   2820         if( cSep=='(' ){
  2715   2821           sqlite3_free(zCreate);
  2716         -        sqlite3_free(sCsv.z);
  2717         -        xCloser(sCsv.in);
  2718         -        fprintf(stderr,"%s: empty file\n", sCsv.zFile);
         2822  +        sqlite3_free(sCtx.z);
         2823  +        xCloser(sCtx.in);
         2824  +        fprintf(stderr,"%s: empty file\n", sCtx.zFile);
  2719   2825           return 1;
  2720   2826         }
  2721   2827         zCreate = sqlite3_mprintf("%z\n)", zCreate);
  2722   2828         rc = sqlite3_exec(p->db, zCreate, 0, 0, 0);
  2723   2829         sqlite3_free(zCreate);
  2724   2830         if( rc ){
  2725   2831           fprintf(stderr, "CREATE TABLE %s(...) failed: %s\n", zTable,
  2726   2832                   sqlite3_errmsg(db));
  2727         -        sqlite3_free(sCsv.z);
  2728         -        xCloser(sCsv.in);
         2833  +        sqlite3_free(sCtx.z);
         2834  +        xCloser(sCtx.in);
  2729   2835           return 1;
  2730   2836         }
  2731   2837         rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
  2732   2838       }
  2733   2839       sqlite3_free(zSql);
  2734   2840       if( rc ){
  2735   2841         if (pStmt) sqlite3_finalize(pStmt);
  2736   2842         fprintf(stderr,"Error: %s\n", sqlite3_errmsg(db));
  2737         -      xCloser(sCsv.in);
         2843  +      xCloser(sCtx.in);
  2738   2844         return 1;
  2739   2845       }
  2740   2846       nCol = sqlite3_column_count(pStmt);
  2741   2847       sqlite3_finalize(pStmt);
  2742   2848       pStmt = 0;
  2743   2849       if( nCol==0 ) return 0; /* no columns, no error */
  2744   2850       zSql = sqlite3_malloc( nByte*2 + 20 + nCol*2 );
  2745   2851       if( zSql==0 ){
  2746   2852         fprintf(stderr, "Error: out of memory\n");
  2747         -      xCloser(sCsv.in);
         2853  +      xCloser(sCtx.in);
  2748   2854         return 1;
  2749   2855       }
  2750   2856       sqlite3_snprintf(nByte+20, zSql, "INSERT INTO \"%w\" VALUES(?", zTable);
  2751   2857       j = strlen30(zSql);
  2752   2858       for(i=1; i<nCol; i++){
  2753   2859         zSql[j++] = ',';
  2754   2860         zSql[j++] = '?';
................................................................................
  2756   2862       zSql[j++] = ')';
  2757   2863       zSql[j] = 0;
  2758   2864       rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
  2759   2865       sqlite3_free(zSql);
  2760   2866       if( rc ){
  2761   2867         fprintf(stderr, "Error: %s\n", sqlite3_errmsg(db));
  2762   2868         if (pStmt) sqlite3_finalize(pStmt);
  2763         -      xCloser(sCsv.in);
         2869  +      xCloser(sCtx.in);
  2764   2870         return 1;
  2765   2871       }
  2766   2872       needCommit = sqlite3_get_autocommit(db);
  2767   2873       if( needCommit ) sqlite3_exec(db, "BEGIN", 0, 0, 0);
  2768   2874       do{
  2769         -      int startLine = sCsv.nLine;
         2875  +      int startLine = sCtx.nLine;
  2770   2876         for(i=0; i<nCol; i++){
  2771         -        char *z = csv_read_one_field(&sCsv);
         2877  +        char *z = xRead(&sCtx);
         2878  +        /*
         2879  +        ** Did we reach end-of-file before finding any columns?
         2880  +        ** If so, stop instead of NULL filling the remaining columns.
         2881  +        */
  2772   2882           if( z==0 && i==0 ) break;
         2883  +        /*
         2884  +        ** Did we reach end-of-file OR end-of-line before finding any
         2885  +        ** columns in ASCII mode?  If so, stop instead of NULL filling
         2886  +        ** the remaining columns.
         2887  +        */
         2888  +        if( p->mode==MODE_Ascii && (z==0 || z[0]==0) && i==0 ) break;
  2773   2889           sqlite3_bind_text(pStmt, i+1, z, -1, SQLITE_TRANSIENT);
  2774         -        if( i<nCol-1 && sCsv.cTerm!=sCsv.cSeparator ){
         2890  +        if( i<nCol-1 && sCtx.cTerm!=sCtx.cColSep ){
  2775   2891             fprintf(stderr, "%s:%d: expected %d columns but found %d - "
  2776   2892                             "filling the rest with NULL\n",
  2777         -                          sCsv.zFile, startLine, nCol, i+1);
         2893  +                          sCtx.zFile, startLine, nCol, i+1);
  2778   2894             i++;
  2779   2895             while( i<=nCol ){ sqlite3_bind_null(pStmt, i); i++; }
  2780   2896           }
  2781   2897         }
  2782         -      if( sCsv.cTerm==sCsv.cSeparator ){
         2898  +      if( sCtx.cTerm==sCtx.cColSep ){
  2783   2899           do{
  2784         -          csv_read_one_field(&sCsv);
         2900  +          xRead(&sCtx);
  2785   2901             i++;
  2786         -        }while( sCsv.cTerm==sCsv.cSeparator );
         2902  +        }while( sCtx.cTerm==sCtx.cColSep );
  2787   2903           fprintf(stderr, "%s:%d: expected %d columns but found %d - "
  2788   2904                           "extras ignored\n",
  2789         -                        sCsv.zFile, startLine, nCol, i);
         2905  +                        sCtx.zFile, startLine, nCol, i);
  2790   2906         }
  2791   2907         if( i>=nCol ){
  2792   2908           sqlite3_step(pStmt);
  2793   2909           rc = sqlite3_reset(pStmt);
  2794   2910           if( rc!=SQLITE_OK ){
  2795         -          fprintf(stderr, "%s:%d: INSERT failed: %s\n", sCsv.zFile, startLine,
         2911  +          fprintf(stderr, "%s:%d: INSERT failed: %s\n", sCtx.zFile, startLine,
  2796   2912                     sqlite3_errmsg(db));
  2797   2913           }
  2798   2914         }
  2799         -    }while( sCsv.cTerm!=EOF );
         2915  +    }while( sCtx.cTerm!=EOF );
  2800   2916   
  2801         -    xCloser(sCsv.in);
  2802         -    sqlite3_free(sCsv.z);
         2917  +    xCloser(sCtx.in);
         2918  +    sqlite3_free(sCtx.z);
  2803   2919       sqlite3_finalize(pStmt);
  2804   2920       if( needCommit ) sqlite3_exec(db, "COMMIT", 0, 0, 0);
  2805   2921     }else
  2806   2922   
  2807   2923     if( c=='i' && strncmp(azArg[0], "indices", n)==0 ){
  2808   2924       ShellState data;
  2809   2925       char *zErrMsg = 0;
................................................................................
  2913   3029         p->mode = MODE_Column;
  2914   3030       }else if( c2=='l' && n2>2 && strncmp(azArg[1],"list",n2)==0 ){
  2915   3031         p->mode = MODE_List;
  2916   3032       }else if( c2=='h' && strncmp(azArg[1],"html",n2)==0 ){
  2917   3033         p->mode = MODE_Html;
  2918   3034       }else if( c2=='t' && strncmp(azArg[1],"tcl",n2)==0 ){
  2919   3035         p->mode = MODE_Tcl;
  2920         -      sqlite3_snprintf(sizeof(p->separator), p->separator, " ");
         3036  +      sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Space);
  2921   3037       }else if( c2=='c' && strncmp(azArg[1],"csv",n2)==0 ){
  2922   3038         p->mode = MODE_Csv;
  2923         -      sqlite3_snprintf(sizeof(p->separator), p->separator, ",");
  2924         -      sqlite3_snprintf(sizeof(p->newline), p->newline, "\r\n");
         3039  +      sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Comma);
         3040  +      sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_CrLf);
  2925   3041       }else if( c2=='t' && strncmp(azArg[1],"tabs",n2)==0 ){
  2926   3042         p->mode = MODE_List;
  2927         -      sqlite3_snprintf(sizeof(p->separator), p->separator, "\t");
         3043  +      sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Tab);
  2928   3044       }else if( c2=='i' && strncmp(azArg[1],"insert",n2)==0 ){
  2929   3045         p->mode = MODE_Insert;
  2930   3046         set_table_name(p, nArg>=3 ? azArg[2] : "table");
         3047  +    }else if( c2=='a' && strncmp(azArg[1],"ascii",n2)==0 ){
         3048  +      p->mode = MODE_Ascii;
         3049  +      sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Unit);
         3050  +      sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Record);
  2931   3051       }else {
  2932   3052         fprintf(stderr,"Error: mode should be one of: "
  2933         -         "column csv html insert line list tabs tcl\n");
         3053  +         "ascii column csv html insert line list tabs tcl\n");
  2934   3054         rc = 1;
  2935   3055       }
  2936   3056     }else
  2937   3057   
  2938   3058     if( c=='n' && strncmp(azArg[0], "nullvalue", n)==0 ){
  2939   3059       if( nArg==2 ){
  2940         -      sqlite3_snprintf(sizeof(p->nullvalue), p->nullvalue,
  2941         -                       "%.*s", (int)ArraySize(p->nullvalue)-1, azArg[1]);
         3060  +      sqlite3_snprintf(sizeof(p->nullValue), p->nullValue,
         3061  +                       "%.*s", (int)ArraySize(p->nullValue)-1, azArg[1]);
  2942   3062       }else{
  2943   3063         fprintf(stderr, "Usage: .nullvalue STRING\n");
  2944   3064         rc = 1;
  2945   3065       }
  2946   3066     }else
  2947   3067   
  2948   3068     if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){
................................................................................
  3219   3339         }
  3220   3340       }
  3221   3341     }else
  3222   3342   #endif
  3223   3343   
  3224   3344     if( c=='s' && strncmp(azArg[0], "separator", n)==0 ){
  3225   3345       if( nArg<2 || nArg>3 ){
  3226         -      fprintf(stderr, "Usage: .separator SEPARATOR ?NEWLINE?\n");
         3346  +      fprintf(stderr, "Usage: .separator COL ?ROW?\n");
  3227   3347         rc = 1;
  3228   3348       }
  3229   3349       if( nArg>=2 ){
  3230         -      sqlite3_snprintf(sizeof(p->separator), p->separator, azArg[1]);
         3350  +      sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator,
         3351  +                       "%.*s", (int)ArraySize(p->colSeparator)-1, azArg[1]);
  3231   3352       }
  3232   3353       if( nArg>=3 ){
  3233         -      sqlite3_snprintf(sizeof(p->newline), p->newline, azArg[2]);
         3354  +      sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator,
         3355  +                       "%.*s", (int)ArraySize(p->rowSeparator)-1, azArg[2]);
  3234   3356       }
  3235   3357     }else
  3236   3358   
  3237   3359     if( c=='s'
  3238   3360      && (strncmp(azArg[0], "shell", n)==0 || strncmp(azArg[0],"system",n)==0)
  3239   3361     ){
  3240   3362       char *zCmd;
................................................................................
  3257   3379     if( c=='s' && strncmp(azArg[0], "show", n)==0 ){
  3258   3380       int i;
  3259   3381       if( nArg!=1 ){
  3260   3382         fprintf(stderr, "Usage: .show\n");
  3261   3383         rc = 1;
  3262   3384         goto meta_command_exit;
  3263   3385       }
  3264         -    fprintf(p->out,"%9.9s: %s\n","echo", p->echoOn ? "on" : "off");
  3265         -    fprintf(p->out,"%9.9s: %s\n","eqp", p->autoEQP ? "on" : "off");
         3386  +    fprintf(p->out,"%12.12s: %s\n","echo", p->echoOn ? "on" : "off");
         3387  +    fprintf(p->out,"%12.12s: %s\n","eqp", p->autoEQP ? "on" : "off");
  3266   3388       fprintf(p->out,"%9.9s: %s\n","explain", p->normalMode.valid ? "on" :"off");
  3267         -    fprintf(p->out,"%9.9s: %s\n","headers", p->showHeader ? "on" : "off");
  3268         -    fprintf(p->out,"%9.9s: %s\n","mode", modeDescr[p->mode]);
  3269         -    fprintf(p->out,"%9.9s: ", "nullvalue");
  3270         -      output_c_string(p->out, p->nullvalue);
         3389  +    fprintf(p->out,"%12.12s: %s\n","headers", p->showHeader ? "on" : "off");
         3390  +    fprintf(p->out,"%12.12s: %s\n","mode", modeDescr[p->mode]);
         3391  +    fprintf(p->out,"%12.12s: ", "nullvalue");
         3392  +      output_c_string(p->out, p->nullValue);
  3271   3393         fprintf(p->out, "\n");
  3272         -    fprintf(p->out,"%9.9s: %s\n","output",
         3394  +    fprintf(p->out,"%12.12s: %s\n","output",
  3273   3395               strlen30(p->outfile) ? p->outfile : "stdout");
  3274         -    fprintf(p->out,"%9.9s: ", "separator");
  3275         -      output_c_string(p->out, p->separator);
  3276         -      fprintf(p->out," ");
  3277         -      output_c_string(p->out, p->newline);
         3396  +    fprintf(p->out,"%12.12s: ", "colseparator");
         3397  +      output_c_string(p->out, p->colSeparator);
         3398  +      fprintf(p->out, "\n");
         3399  +    fprintf(p->out,"%12.12s: ", "rowseparator");
         3400  +      output_c_string(p->out, p->rowSeparator);
  3278   3401         fprintf(p->out, "\n");
  3279         -    fprintf(p->out,"%9.9s: %s\n","stats", p->statsOn ? "on" : "off");
  3280         -    fprintf(p->out,"%9.9s: ","width");
         3402  +    fprintf(p->out,"%12.12s: %s\n","stats", p->statsOn ? "on" : "off");
         3403  +    fprintf(p->out,"%12.12s: ","width");
  3281   3404       for (i=0;i<(int)ArraySize(p->colWidth) && p->colWidth[i] != 0;i++) {
  3282   3405         fprintf(p->out,"%d ",p->colWidth[i]);
  3283   3406       }
  3284   3407       fprintf(p->out,"\n");
  3285   3408     }else
  3286   3409   
  3287   3410     if( c=='s' && strncmp(azArg[0], "stats", n)==0 ){
................................................................................
  3934   4057     return rc;
  3935   4058   }
  3936   4059   
  3937   4060   /*
  3938   4061   ** Show available command line options
  3939   4062   */
  3940   4063   static const char zOptions[] = 
         4064  +  "   -ascii               set output mode to 'ascii'\n"
  3941   4065     "   -bail                stop after hitting an error\n"
  3942   4066     "   -batch               force batch I/O\n"
  3943   4067     "   -column              set output mode to 'column'\n"
  3944   4068     "   -cmd COMMAND         run \"COMMAND\" before reading stdin\n"
  3945   4069     "   -csv                 set output mode to 'csv'\n"
  3946   4070     "   -echo                print commands before execution\n"
  3947   4071     "   -init FILENAME       read/process named file\n"
................................................................................
  3955   4079     "   -line                set output mode to 'line'\n"
  3956   4080     "   -list                set output mode to 'list'\n"
  3957   4081     "   -lookaside SIZE N    use N entries of SZ bytes for lookaside memory\n"
  3958   4082     "   -mmap N              default mmap size set to N\n"
  3959   4083   #ifdef SQLITE_ENABLE_MULTIPLEX
  3960   4084     "   -multiplex           enable the multiplexor VFS\n"
  3961   4085   #endif
  3962         -  "   -newline SEP         set newline character(s) for CSV\n"
         4086  +  "   -newline SEP         set output row separator. Default: '\\n'\n"
  3963   4087     "   -nullvalue TEXT      set text string for NULL values. Default ''\n"
  3964   4088     "   -pagecache SIZE N    use N slots of SZ bytes each for page cache memory\n"
  3965   4089     "   -scratch SIZE N      use N slots of SZ bytes each for scratch memory\n"
  3966         -  "   -separator SEP       set output field separator. Default: '|'\n"
         4090  +  "   -separator SEP       set output column separator. Default: '|'\n"
  3967   4091     "   -stats               print memory stats before each finalize\n"
  3968   4092     "   -version             show SQLite version\n"
  3969   4093     "   -vfs NAME            use NAME as the default VFS\n"
  3970   4094   #ifdef SQLITE_ENABLE_VFSTRACE
  3971   4095     "   -vfstrace            enable tracing of all VFS calls\n"
  3972   4096   #endif
  3973   4097   ;
................................................................................
  3986   4110   
  3987   4111   /*
  3988   4112   ** Initialize the state information in data
  3989   4113   */
  3990   4114   static void main_init(ShellState *data) {
  3991   4115     memset(data, 0, sizeof(*data));
  3992   4116     data->mode = MODE_List;
  3993         -  memcpy(data->separator,"|", 2);
  3994         -  memcpy(data->newline,"\r\n", 3);
         4117  +  memcpy(data->colSeparator,SEP_Column, 2);
         4118  +  memcpy(data->rowSeparator,SEP_Row, 2);
  3995   4119     data->showHeader = 0;
  3996   4120     data->shellFlgs = SHFLG_Lookaside;
  3997   4121     sqlite3_config(SQLITE_CONFIG_URI, 1);
  3998   4122     sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
  3999   4123     sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
  4000   4124     sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
  4001   4125     sqlite3_snprintf(sizeof(continuePrompt), continuePrompt,"   ...> ");
................................................................................
  4226   4350         data.mode = MODE_List;
  4227   4351       }else if( strcmp(z,"-line")==0 ){
  4228   4352         data.mode = MODE_Line;
  4229   4353       }else if( strcmp(z,"-column")==0 ){
  4230   4354         data.mode = MODE_Column;
  4231   4355       }else if( strcmp(z,"-csv")==0 ){
  4232   4356         data.mode = MODE_Csv;
  4233         -      memcpy(data.separator,",",2);
         4357  +      memcpy(data.colSeparator,",",2);
         4358  +    }else if( strcmp(z,"-ascii")==0 ){
         4359  +      data.mode = MODE_Ascii;
         4360  +      sqlite3_snprintf(sizeof(data.colSeparator), data.colSeparator,
         4361  +                       SEP_Unit);
         4362  +      sqlite3_snprintf(sizeof(data.rowSeparator), data.rowSeparator,
         4363  +                       SEP_Record);
  4234   4364       }else if( strcmp(z,"-separator")==0 ){
  4235         -      sqlite3_snprintf(sizeof(data.separator), data.separator,
         4365  +      sqlite3_snprintf(sizeof(data.colSeparator), data.colSeparator,
  4236   4366                          "%s",cmdline_option_value(argc,argv,++i));
  4237   4367       }else if( strcmp(z,"-newline")==0 ){
  4238         -      sqlite3_snprintf(sizeof(data.newline), data.newline,
         4368  +      sqlite3_snprintf(sizeof(data.rowSeparator), data.rowSeparator,
  4239   4369                          "%s",cmdline_option_value(argc,argv,++i));
  4240   4370       }else if( strcmp(z,"-nullvalue")==0 ){
  4241         -      sqlite3_snprintf(sizeof(data.nullvalue), data.nullvalue,
         4371  +      sqlite3_snprintf(sizeof(data.nullValue), data.nullValue,
  4242   4372                          "%s",cmdline_option_value(argc,argv,++i));
  4243   4373       }else if( strcmp(z,"-header")==0 ){
  4244   4374         data.showHeader = 1;
  4245   4375       }else if( strcmp(z,"-noheader")==0 ){
  4246   4376         data.showHeader = 0;
  4247   4377       }else if( strcmp(z,"-echo")==0 ){
  4248   4378         data.echoOn = 1;
................................................................................
  4354   4484         zHome = find_home_dir();
  4355   4485         if( zHome ){
  4356   4486           nHistory = strlen30(zHome) + 20;
  4357   4487           if( (zHistory = malloc(nHistory))!=0 ){
  4358   4488             sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome);
  4359   4489           }
  4360   4490         }
  4361         -#if defined(HAVE_READLINE)
         4491  +#if HAVE_READLINE
  4362   4492         if( zHistory ) read_history(zHistory);
  4363   4493   #endif
  4364   4494         rc = process_input(&data, 0);
  4365   4495         if( zHistory ){
  4366   4496           stifle_history(100);
  4367   4497           write_history(zHistory);
  4368   4498           free(zHistory);

Changes to src/sqlite.h.in.

  7492   7492   ** CAPI3REF: Prepared Statement Scan Status Opcodes
  7493   7493   ** KEYWORDS: {scanstatus options}
  7494   7494   **
  7495   7495   ** The following constants can be used for the T parameter to the
  7496   7496   ** [sqlite3_stmt_scanstatus(S,X,T,V)] interface.  Each constant designates a
  7497   7497   ** different metric for sqlite3_stmt_scanstatus() to return.
  7498   7498   **
         7499  +** When the value returned to V is a string, space to hold that string is
         7500  +** managed by the prepared statement S and will be automatically freed when
         7501  +** S is finalized.
         7502  +**
  7499   7503   ** <dl>
  7500   7504   ** [[SQLITE_SCANSTAT_NLOOP]] <dt>SQLITE_SCANSTAT_NLOOP</dt>
  7501   7505   ** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be
  7502   7506   ** set to the total number of times that the X-th loop has run.</dd>
  7503   7507   **
  7504   7508   ** [[SQLITE_SCANSTAT_NVISIT]] <dt>SQLITE_SCANSTAT_NVISIT</dt>
  7505   7509   ** <dd>^The [sqlite3_int64] variable pointed to by the T parameter will be set
................................................................................
  7537   7541   #define SQLITE_SCANSTAT_NAME     3
  7538   7542   #define SQLITE_SCANSTAT_EXPLAIN  4
  7539   7543   #define SQLITE_SCANSTAT_SELECTID 5
  7540   7544   
  7541   7545   /*
  7542   7546   ** CAPI3REF: Prepared Statement Scan Status
  7543   7547   **
  7544         -** Return status data for a single loop within query pStmt.
         7548  +** This interface returns information about the predicted and measured
         7549  +** performance for pStmt.  Advanced applications can use this
         7550  +** interface to compare the predicted and the measured performance and
         7551  +** issue warnings and/or rerun [ANALYZE] if discrepancies are found.
         7552  +**
         7553  +** Since this interface is expected to be rarely used, it is only
         7554  +** available if SQLite is compiled using the [SQLITE_ENABLE_STMT_SCANSTATUS]
         7555  +** compile-time option.
  7545   7556   **
  7546   7557   ** The "iScanStatusOp" parameter determines which status information to return.
  7547   7558   ** The "iScanStatusOp" must be one of the [scanstatus options] or the behavior
  7548   7559   ** of this interface is undefined.
  7549   7560   ** ^The requested measurement is written into a variable pointed to by
  7550   7561   ** the "pOut" parameter.
  7551   7562   ** Parameter "idx" identifies the specific loop to retrieve statistics for.
................................................................................
  7555   7566   ** points to is unchanged.
  7556   7567   **
  7557   7568   ** ^Statistics might not be available for all loops in all statements. ^In cases
  7558   7569   ** where there exist loops with no available statistics, this function behaves
  7559   7570   ** as if the loop did not exist - it returns non-zero and leave the variable
  7560   7571   ** that pOut points to unchanged.
  7561   7572   **
  7562         -** This API is only available if the library is built with pre-processor
  7563         -** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.
  7564         -**
  7565   7573   ** See also: [sqlite3_stmt_scanstatus_reset()]
  7566   7574   */
  7567   7575   SQLITE_EXPERIMENTAL int sqlite3_stmt_scanstatus(
  7568   7576     sqlite3_stmt *pStmt,      /* Prepared statement for which info desired */
  7569   7577     int idx,                  /* Index of loop to report on */
  7570   7578     int iScanStatusOp,        /* Information desired.  SQLITE_SCANSTAT_* */
  7571   7579     void *pOut                /* Result written here */

Changes to src/sqliteInt.h.

    11     11   *************************************************************************
    12     12   ** Internal interface definitions for SQLite.
    13     13   **
    14     14   */
    15     15   #ifndef _SQLITEINT_H_
    16     16   #define _SQLITEINT_H_
    17     17   
           18  +/*
           19  +** Include the header file used to customize the compiler options for MSVC.
           20  +** This should be done first so that it can successfully prevent spurious
           21  +** compiler warnings due to subsequent content in this file and other files
           22  +** that are included by this file.
           23  +*/
           24  +#include "msvc.h"
           25  +
    18     26   /*
    19     27   ** These #defines should enable >2GB file support on POSIX if the
    20     28   ** underlying operating system supports it.  If the OS lacks
    21     29   ** large file support, or if the OS is windows, these should be no-ops.
    22     30   **
    23     31   ** Ticket #2739:  The _LARGEFILE_SOURCE macro must appear before any
    24     32   ** system #includes.  Hence, this block of code must be the very first
................................................................................
  2983   2991   
  2984   2992   /*
  2985   2993   ** FTS4 is really an extension for FTS3.  It is enabled using the
  2986   2994   ** SQLITE_ENABLE_FTS3 macro.  But to avoid confusion we also call
  2987   2995   ** the SQLITE_ENABLE_FTS4 macro to serve as an alias for SQLITE_ENABLE_FTS3.
  2988   2996   */
  2989   2997   #if defined(SQLITE_ENABLE_FTS4) && !defined(SQLITE_ENABLE_FTS3)
  2990         -# define SQLITE_ENABLE_FTS3
         2998  +# define SQLITE_ENABLE_FTS3 1
  2991   2999   #endif
  2992   3000   
  2993   3001   /*
  2994   3002   ** The ctype.h header is needed for non-ASCII systems.  It is also
  2995   3003   ** needed by FTS3 when FTS3 is included in the amalgamation.
  2996   3004   */
  2997   3005   #if !defined(SQLITE_ASCII) || \

Changes to src/tclsqlite.c.

    21     21   **                        generating MD5 checksums:  md5, md5file,
    22     22   **                        md5-10x8, and md5file-10x8.
    23     23   **
    24     24   **  -DSQLITE_TEST         When used in conjuction with -DTCLSH=1, add
    25     25   **                        hundreds of new commands used for testing
    26     26   **                        SQLite.  This option implies -DSQLITE_TCLMD5.
    27     27   */
           28  +
           29  +/*
           30  +** If requested, include the SQLite compiler options file for MSVC.
           31  +*/
           32  +#if defined(INCLUDE_MSVC_H)
           33  +#include "msvc.h"
           34  +#endif
           35  +
    28     36   #include "tcl.h"
    29     37   #include <errno.h>
    30     38   
    31     39   /*
    32     40   ** Some additional include files are needed if this file is not
    33     41   ** appended to the amalgamation.
    34     42   */
................................................................................
  1081   1089   static int dbPrepareAndBind(
  1082   1090     SqliteDb *pDb,                  /* Database object */
  1083   1091     char const *zIn,                /* SQL to compile */
  1084   1092     char const **pzOut,             /* OUT: Pointer to next SQL statement */
  1085   1093     SqlPreparedStmt **ppPreStmt     /* OUT: Object used to cache statement */
  1086   1094   ){
  1087   1095     const char *zSql = zIn;         /* Pointer to first SQL statement in zIn */
  1088         -  sqlite3_stmt *pStmt;            /* Prepared statement object */
         1096  +  sqlite3_stmt *pStmt = 0;        /* Prepared statement object */
  1089   1097     SqlPreparedStmt *pPreStmt;      /* Pointer to cached statement */
  1090   1098     int nSql;                       /* Length of zSql in bytes */
  1091         -  int nVar;                       /* Number of variables in statement */
         1099  +  int nVar = 0;                   /* Number of variables in statement */
  1092   1100     int iParm = 0;                  /* Next free entry in apParm */
  1093   1101     char c;
  1094   1102     int i;
  1095   1103     Tcl_Interp *interp = pDb->interp;
  1096   1104   
  1097   1105     *ppPreStmt = 0;
  1098   1106   
................................................................................
  3098   3106   ** if the extension only supplies one new name!)  The "sqlite" command is
  3099   3107   ** used to open a new SQLite database.  See the DbMain() routine above
  3100   3108   ** for additional information.
  3101   3109   **
  3102   3110   ** The EXTERN macros are required by TCL in order to work on windows.
  3103   3111   */
  3104   3112   EXTERN int Sqlite3_Init(Tcl_Interp *interp){
  3105         -  int rc = Tcl_InitStubs(interp, "8.4", 0)==0 ? TCL_ERROR : TCL_OK;
         3113  +  int rc = Tcl_InitStubs(interp, "8.4", 0) ? TCL_OK : TCL_ERROR;
  3106   3114     if( rc==TCL_OK ){
  3107   3115       Tcl_CreateObjCommand(interp, "sqlite3", (Tcl_ObjCmdProc*)DbMain, 0, 0);
  3108   3116   #ifndef SQLITE_3_SUFFIX_ONLY
  3109   3117       /* The "sqlite" alias is undocumented.  It is here only to support
  3110   3118       ** legacy scripts.  All new scripts should use only the "sqlite3"
  3111   3119       ** command. */
  3112   3120       Tcl_CreateObjCommand(interp, "sqlite", (Tcl_ObjCmdProc*)DbMain, 0, 0);
................................................................................
  3808   3816   
  3809   3817   #ifdef SQLITE_SSE
  3810   3818       Sqlitetestsse_Init(interp);
  3811   3819   #endif
  3812   3820     }
  3813   3821   #endif
  3814   3822   }
         3823  +
         3824  +/* Needed for the setrlimit() system call on unix */
         3825  +#if defined(unix)
         3826  +#include <sys/resource.h>
         3827  +#endif
  3815   3828   
  3816   3829   #define TCLSH_MAIN main   /* Needed to fake out mktclapp */
  3817   3830   int TCLSH_MAIN(int argc, char **argv){
  3818   3831     Tcl_Interp *interp;
  3819   3832   
  3820   3833   #if !defined(_WIN32_WCE)
  3821   3834     if( getenv("BREAK") ){
  3822   3835       fprintf(stderr,
  3823   3836           "attach debugger to process %d and press any key to continue.\n",
  3824   3837           GETPID());
  3825   3838       fgetc(stdin);
  3826   3839     }
  3827   3840   #endif
         3841  +
         3842  +  /* Since the primary use case for this binary is testing of SQLite,
         3843  +  ** be sure to generate core files if we crash */
         3844  +#if defined(SQLITE_TEST) && defined(unix)
         3845  +  { struct rlimit x;
         3846  +    getrlimit(RLIMIT_CORE, &x);
         3847  +    x.rlim_cur = x.rlim_max;
         3848  +    setrlimit(RLIMIT_CORE, &x);
         3849  +  }
         3850  +#endif /* SQLITE_TEST && unix */
         3851  +
  3828   3852   
  3829   3853     /* Call sqlite3_shutdown() once before doing anything else. This is to
  3830   3854     ** test that sqlite3_shutdown() can be safely called by a process before
  3831   3855     ** sqlite3_initialize() is. */
  3832   3856     sqlite3_shutdown();
  3833   3857   
  3834   3858     Tcl_FindExecutable(argv[0]);

Changes to src/test1.c.

   563    563     int argc,              /* Number of arguments */
   564    564     char **argv            /* Text of each argument */
   565    565   ){
   566    566     sqlite3 *db;
   567    567     Tcl_DString str;
   568    568     int rc;
   569    569     char *zErr = 0;
   570         -  int nRow, nCol;
          570  +  int nRow = 0, nCol = 0;
   571    571     char **aResult;
   572    572     int i;
   573    573     char zBuf[30];
   574    574     char *zSql;
   575    575     int resCount = -1;
   576    576     if( argc==5 ){
   577    577       if( Tcl_GetInt(interp, argv[4], &resCount) ) return TCL_ERROR;
................................................................................
  2116   2116   static int test_stmt_status(
  2117   2117     void * clientData,
  2118   2118     Tcl_Interp *interp,
  2119   2119     int objc,
  2120   2120     Tcl_Obj *CONST objv[]
  2121   2121   ){
  2122   2122     int iValue;
  2123         -  int i, op, resetFlag;
         2123  +  int i, op = 0, resetFlag;
  2124   2124     const char *zOpName;
  2125   2125     sqlite3_stmt *pStmt;
  2126   2126   
  2127   2127     static const struct {
  2128   2128       const char *zName;
  2129   2129       int op;
  2130   2130     } aOp[] = {
................................................................................
  3094   3094     void * clientData,
  3095   3095     Tcl_Interp *interp,
  3096   3096     int objc,
  3097   3097     Tcl_Obj *CONST objv[]
  3098   3098   ){
  3099   3099     sqlite3_stmt *pStmt;
  3100   3100     int idx;
  3101         -  double value;
         3101  +  double value = 0;
  3102   3102     int rc;
  3103   3103     const char *zVal;
  3104   3104     int i;
  3105   3105     static const struct {
  3106   3106       const char *zName;     /* Name of the special floating point value */
  3107   3107       unsigned int iUpper;   /* Upper 32 bits */
  3108   3108       unsigned int iLower;   /* Lower 32 bits */
................................................................................
  5646   5646       { "SQLITE_LIMIT_TRIGGER_DEPTH",       SQLITE_LIMIT_TRIGGER_DEPTH        },
  5647   5647       { "SQLITE_LIMIT_WORKER_THREADS",      SQLITE_LIMIT_WORKER_THREADS       },
  5648   5648       
  5649   5649       /* Out of range test cases */
  5650   5650       { "SQLITE_LIMIT_TOOSMALL",            -1,                               },
  5651   5651       { "SQLITE_LIMIT_TOOBIG",              SQLITE_LIMIT_WORKER_THREADS+1     },
  5652   5652     };
  5653         -  int i, id;
         5653  +  int i, id = 0;
  5654   5654     int val;
  5655   5655     const char *zId;
  5656   5656   
  5657   5657     if( objc!=4 ){
  5658   5658       Tcl_AppendResult(interp, "wrong # args: should be \"",
  5659   5659           Tcl_GetStringFromObj(objv[0], 0), " DB ID VALUE", 0);
  5660   5660       return TCL_ERROR;
................................................................................
  6806   6806   ** warning.  This is used to verify that errors and warnings output by those
  6807   6807   ** tools are detected by the test scripts.
  6808   6808   **
  6809   6809   **       TYPE       BEHAVIOR
  6810   6810   **       1          Overflow a signed integer
  6811   6811   **       2          Jump based on an uninitialized variable
  6812   6812   **       3          Read after free
         6813  +**       4          Panic
  6813   6814   */
  6814   6815   static int test_bad_behavior(
  6815   6816     ClientData clientData, /* Pointer to an integer containing zero */
  6816   6817     Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
  6817   6818     int objc,              /* Number of arguments */
  6818   6819     Tcl_Obj *CONST objv[]  /* Command arguments */
  6819   6820   ){
................................................................................
  6843   6844       }
  6844   6845       case 3: {
  6845   6846         a = malloc( sizeof(int)*10 );
  6846   6847         for(j=0; j<10; j++) a[j] = j;
  6847   6848         free(a);
  6848   6849         Tcl_SetObjResult(interp, Tcl_NewIntObj(a[i]));
  6849   6850         break;
         6851  +    }
         6852  +    case 4: {
         6853  +      Tcl_Panic("Deliberate panic");
         6854  +      break;
  6850   6855       }
  6851   6856     }
  6852   6857     return TCL_OK;
  6853   6858   }  
  6854   6859     
  6855   6860   
  6856   6861   /*

Changes to src/test2.c.

   306    306     void *NotUsed,
   307    307     Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
   308    308     int argc,              /* Number of arguments */
   309    309     const char **argv      /* Text of each argument */
   310    310   ){
   311    311     Pager *pPager;
   312    312     char zBuf[100];
   313         -  DbPage *pPage;
          313  +  DbPage *pPage = 0;
   314    314     int pgno;
   315    315     int rc;
   316    316     if( argc!=3 ){
   317    317       Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
   318    318          " ID PGNO\"", 0);
   319    319       return TCL_ERROR;
   320    320     }

Changes to src/test8.c.

   773    773     char *zNew;
   774    774     int nArg = 0;
   775    775     const char *zSep = "WHERE";
   776    776     echo_vtab *pVtab = (echo_vtab *)tab;
   777    777     sqlite3_stmt *pStmt = 0;
   778    778     Tcl_Interp *interp = pVtab->interp;
   779    779   
   780         -  int nRow;
          780  +  int nRow = 0;
   781    781     int useIdx = 0;
   782    782     int rc = SQLITE_OK;
   783    783     int useCost = 0;
   784         -  double cost;
          784  +  double cost = 0;
   785    785     int isIgnoreUsable = 0;
   786    786     if( Tcl_GetVar(interp, "echo_module_ignore_usable", TCL_GLOBAL_ONLY) ){
   787    787       isIgnoreUsable = 1;
   788    788     }
   789    789   
   790    790     if( simulateVtabError(pVtab, "xBestIndex") ){
   791    791       return SQLITE_ERROR;
................................................................................
   923    923     sqlite3_value **apData, 
   924    924     sqlite_int64 *pRowid
   925    925   ){
   926    926     echo_vtab *pVtab = (echo_vtab *)tab;
   927    927     sqlite3 *db = pVtab->db;
   928    928     int rc = SQLITE_OK;
   929    929   
   930         -  sqlite3_stmt *pStmt;
          930  +  sqlite3_stmt *pStmt = 0;
   931    931     char *z = 0;               /* SQL statement to execute */
   932    932     int bindArgZero = 0;       /* True to bind apData[0] to sql var no. nData */
   933    933     int bindArgOne = 0;        /* True to bind apData[1] to sql var no. 1 */
   934    934     int i;                     /* Counter variable used by for loops */
   935    935   
   936    936     assert( nData==pVtab->nCol+2 || nData==1 );
   937    937   

Changes to src/test_config.c.

    37     37   
    38     38   /*
    39     39   ** This routine sets entries in the global ::sqlite_options() array variable
    40     40   ** according to the compile-time configuration of the database.  Test
    41     41   ** procedures use this to determine when tests should be omitted.
    42     42   */
    43     43   static void set_options(Tcl_Interp *interp){
    44         -#ifdef HAVE_MALLOC_USABLE_SIZE
           44  +#if HAVE_MALLOC_USABLE_SIZE
    45     45     Tcl_SetVar2(interp, "sqlite_options", "malloc_usable_size", "1",
    46     46                 TCL_GLOBAL_ONLY);
    47     47   #else
    48     48     Tcl_SetVar2(interp, "sqlite_options", "malloc_usable_size", "0",
    49     49                 TCL_GLOBAL_ONLY);
    50     50   #endif
    51     51   

Changes to src/test_journal.c.

   405    405       if( rc==SQLITE_OK ){
   406    406         int ii;
   407    407         for(ii=0; rc==SQLITE_OK && ii<(int)pMain->nPage; ii++){
   408    408           i64 iOff = (i64)(pMain->nPagesize) * (i64)ii;
   409    409           if( iOff==PENDING_BYTE ) continue;
   410    410           rc = sqlite3OsRead(pMain->pReal, aData, pMain->nPagesize, iOff);
   411    411           pMain->aCksum[ii] = genCksum(aData, pMain->nPagesize);
   412         -        if( ii+1==pMain->nPage && rc==SQLITE_IOERR_SHORT_READ ) rc = SQLITE_OK;
          412  +        if( ii+1==(int)pMain->nPage && rc==SQLITE_IOERR_SHORT_READ ){
          413  +          rc = SQLITE_OK;
          414  +        }
   413    415         }
   414    416       }
   415    417   
   416    418       start_ioerr_simulation(iSave, iSave2);
   417    419     }
   418    420   
   419    421     sqlite3_free(aData);
................................................................................
   546    548         /* No-op. This special case is hit when the backup code is copying a
   547    549         ** to a database with a larger page-size than the source database and
   548    550         ** it needs to fill in the non-locking-region part of the original
   549    551         ** pending-byte page.
   550    552         */
   551    553       }else{
   552    554         u32 pgno = (u32)(iOfst/p->nPagesize + 1);
   553         -      assert( (iAmt==1||iAmt==p->nPagesize) && ((iOfst+iAmt)%p->nPagesize)==0 );
          555  +      assert( (iAmt==1||iAmt==(int)p->nPagesize) &&
          556  +              ((iOfst+iAmt)%p->nPagesize)==0 );
   554    557         assert( pgno<=p->nPage || p->nSync>0 );
   555    558         assert( pgno>p->nPage || sqlite3BitvecTest(p->pWritable, pgno) );
   556    559       }
   557    560     }
   558    561   
   559    562     rc = sqlite3OsWrite(p->pReal, zBuf, iAmt, iOfst);
   560    563     if( (p->flags&SQLITE_OPEN_MAIN_JOURNAL) && iAmt==12 ){

Changes to src/test_malloc.c.

  1334   1334   static int test_status(
  1335   1335     void * clientData,
  1336   1336     Tcl_Interp *interp,
  1337   1337     int objc,
  1338   1338     Tcl_Obj *CONST objv[]
  1339   1339   ){
  1340   1340     int rc, iValue, mxValue;
  1341         -  int i, op, resetFlag;
         1341  +  int i, op = 0, resetFlag;
  1342   1342     const char *zOpName;
  1343   1343     static const struct {
  1344   1344       const char *zName;
  1345   1345       int op;
  1346   1346     } aOp[] = {
  1347   1347       { "SQLITE_STATUS_MEMORY_USED",         SQLITE_STATUS_MEMORY_USED         },
  1348   1348       { "SQLITE_STATUS_MALLOC_SIZE",         SQLITE_STATUS_MALLOC_SIZE         },
................................................................................
  1391   1391   static int test_db_status(
  1392   1392     void * clientData,
  1393   1393     Tcl_Interp *interp,
  1394   1394     int objc,
  1395   1395     Tcl_Obj *CONST objv[]
  1396   1396   ){
  1397   1397     int rc, iValue, mxValue;
  1398         -  int i, op, resetFlag;
         1398  +  int i, op = 0, resetFlag;
  1399   1399     const char *zOpName;
  1400   1400     sqlite3 *db;
  1401   1401     extern int getDbPointer(Tcl_Interp*, const char*, sqlite3**);
  1402   1402     static const struct {
  1403   1403       const char *zName;
  1404   1404       int op;
  1405   1405     } aOp[] = {

Changes to src/test_multiplex.c.

   402    402   static void multiplexControlFunc(
   403    403     sqlite3_context *context,
   404    404     int argc,
   405    405     sqlite3_value **argv
   406    406   ){
   407    407     int rc = SQLITE_OK;
   408    408     sqlite3 *db = sqlite3_context_db_handle(context);
   409         -  int op;
          409  +  int op = 0;
   410    410     int iVal;
   411    411   
   412    412     if( !db || argc!=2 ){ 
   413    413       rc = SQLITE_ERROR; 
   414    414     }else{
   415    415       /* extract params */
   416    416       op = sqlite3_value_int(argv[0]);
................................................................................
   531    531     }
   532    532   
   533    533     if( rc==SQLITE_OK ){
   534    534       const char *zUri = (flags & SQLITE_OPEN_URI) ? zName : 0;
   535    535       /* assign pointers to extra space allocated */
   536    536       memset(pGroup, 0, sz);
   537    537       pMultiplexOpen->pGroup = pGroup;
   538         -    pGroup->bEnabled = -1;
          538  +    pGroup->bEnabled = (unsigned char)-1;
   539    539       pGroup->bTruncate = sqlite3_uri_boolean(zUri, "truncate", 
   540    540                                      (flags & SQLITE_OPEN_MAIN_DB)==0);
   541    541       pGroup->szChunk = (int)sqlite3_uri_int64(zUri, "chunksize",
   542    542                                           SQLITE_MULTIPLEX_CHUNK_SIZE);
   543    543       pGroup->szChunk = (pGroup->szChunk+0xffff)&~0xffff;
   544    544       if( zName ){
   545    545         char *p = (char *)&pGroup[1];

Changes to src/test_quota.c.

   885    885   }
   886    886   
   887    887   /*
   888    888   ** Bring the named file under quota management.  Or if it is already under
   889    889   ** management, update its size.
   890    890   */
   891    891   int sqlite3_quota_file(const char *zFilename){
   892         -  char *zFull;
          892  +  char *zFull = 0;
   893    893     sqlite3_file *fd;
   894    894     int rc;
   895    895     int outFlags = 0;
   896    896     sqlite3_int64 iSize;
   897    897     int nAlloc = gQuota.sThisVfs.szOsFile + gQuota.sThisVfs.mxPathname+2;
   898    898   
   899    899     /* Allocate space for a file-handle and the full path for file zFilename */

Changes to src/test_vfs.c.

   417    417   */
   418    418   static int tvfsSync(sqlite3_file *pFile, int flags){
   419    419     int rc = SQLITE_OK;
   420    420     TestvfsFd *pFd = tvfsGetFd(pFile);
   421    421     Testvfs *p = (Testvfs *)pFd->pVfs->pAppData;
   422    422   
   423    423     if( p->pScript && p->mask&TESTVFS_SYNC_MASK ){
   424         -    char *zFlags;
          424  +    char *zFlags = 0;
   425    425   
   426    426       switch( flags ){
   427    427         case SQLITE_SYNC_NORMAL:
   428    428           zFlags = "normal";
   429    429           break;
   430    430         case SQLITE_SYNC_FULL:
   431    431           zFlags = "full";
................................................................................
  1221   1221       ** TESTVFS ioerr ?IFAIL PERSIST?
  1222   1222       **
  1223   1223       **   Where IFAIL is an integer and PERSIST is boolean.
  1224   1224       */
  1225   1225       case CMD_CANTOPENERR:
  1226   1226       case CMD_IOERR:
  1227   1227       case CMD_FULLERR: {
  1228         -      TestFaultInject *pTest;
         1228  +      TestFaultInject *pTest = 0;
  1229   1229         int iRet;
  1230   1230   
  1231   1231         switch( aSubcmd[i].eCmd ){
  1232   1232           case CMD_IOERR: pTest = &p->ioerr_err; break;
  1233   1233           case CMD_FULLERR: pTest = &p->full_err; break;
  1234   1234           case CMD_CANTOPENERR: pTest = &p->cantopen_err; break;
  1235   1235           default: assert(0);

Changes to src/util.c.

    13     13   **
    14     14   ** This file contains functions for allocating memory, comparing
    15     15   ** strings, and stuff like that.
    16     16   **
    17     17   */
    18     18   #include "sqliteInt.h"
    19     19   #include <stdarg.h>
    20         -#ifdef SQLITE_HAVE_ISNAN
           20  +#if HAVE_ISNAN || SQLITE_HAVE_ISNAN
    21     21   # include <math.h>
    22     22   #endif
    23     23   
    24     24   /*
    25     25   ** Routine needed to support the testcase() macro.
    26     26   */
    27     27   #ifdef SQLITE_COVERAGE_TEST
................................................................................
    54     54   ** Return true if the floating point value is Not a Number (NaN).
    55     55   **
    56     56   ** Use the math library isnan() function if compiled with SQLITE_HAVE_ISNAN.
    57     57   ** Otherwise, we have our own implementation that works on most systems.
    58     58   */
    59     59   int sqlite3IsNaN(double x){
    60     60     int rc;   /* The value return */
    61         -#if !defined(SQLITE_HAVE_ISNAN)
           61  +#if !SQLITE_HAVE_ISNAN && !HAVE_ISNAN
    62     62     /*
    63     63     ** Systems that support the isnan() library function should probably
    64     64     ** make use of it by compiling with -DSQLITE_HAVE_ISNAN.  But we have
    65     65     ** found that many systems do not have a working isnan() function so
    66     66     ** this implementation is provided as an alternative.
    67     67     **
    68     68     ** This NaN test sometimes fails if compiled on GCC with -ffast-math.
................................................................................
    84     84     */
    85     85   #ifdef __FAST_MATH__
    86     86   # error SQLite will not work correctly with the -ffast-math option of GCC.
    87     87   #endif
    88     88     volatile double y = x;
    89     89     volatile double z = y;
    90     90     rc = (y!=z);
    91         -#else  /* if defined(SQLITE_HAVE_ISNAN) */
           91  +#else  /* if HAVE_ISNAN */
    92     92     rc = isnan(x);
    93         -#endif /* SQLITE_HAVE_ISNAN */
           93  +#endif /* HAVE_ISNAN */
    94     94     testcase( rc );
    95     95     return rc;
    96     96   }
    97     97   #endif /* SQLITE_OMIT_FLOATING_POINT */
    98     98   
    99     99   /*
   100    100   ** Compute a string length that is limited to what can be stored in

Changes to src/vdbe.c.

  3819   3819       sqlite3VdbeRecordUnpack(pC->pKeyInfo, pIn3->n, pIn3->z, pIdxKey);
  3820   3820     }
  3821   3821     pIdxKey->default_rc = 0;
  3822   3822     if( pOp->opcode==OP_NoConflict ){
  3823   3823       /* For the OP_NoConflict opcode, take the jump if any of the
  3824   3824       ** input fields are NULL, since any key with a NULL will not
  3825   3825       ** conflict */
  3826         -    for(ii=0; ii<r.nField; ii++){
  3827         -      if( r.aMem[ii].flags & MEM_Null ){
         3826  +    for(ii=0; ii<pIdxKey->nField; ii++){
         3827  +      if( pIdxKey->aMem[ii].flags & MEM_Null ){
  3828   3828           pc = pOp->p2 - 1; VdbeBranchTaken(1,2);
  3829   3829           break;
  3830   3830         }
  3831   3831       }
  3832   3832     }
  3833   3833     rc = sqlite3BtreeMovetoUnpacked(pC->pCursor, pIdxKey, 0, 0, &res);
  3834   3834     if( pOp->p4.i==0 ){

Changes to src/vdbesort.c.

  2410   2410   #if SQLITE_MAX_WORKER_THREADS>0
  2411   2411       if( pSorter->bUseThreads ){
  2412   2412         rc = vdbePmaReaderNext(pSorter->pReader);
  2413   2413         *pbEof = (pSorter->pReader->pFd==0);
  2414   2414       }else
  2415   2415   #endif
  2416   2416       /*if( !pSorter->bUseThreads )*/ {
         2417  +      assert( pSorter->pMerger!=0 );
  2417   2418         assert( pSorter->pMerger->pTask==(&pSorter->aTask[0]) );
  2418   2419         rc = vdbeMergeEngineStep(pSorter->pMerger, pbEof);
  2419   2420       }
  2420   2421     }else{
  2421   2422       SorterRecord *pFree = pSorter->list.pList;
  2422   2423       pSorter->list.pList = pFree->u.pNext;
  2423   2424       pFree->u.pNext = 0;

Changes to test/e_walauto.test.

    14     14   source $testdir/tester.tcl
    15     15   source $testdir/wal_common.tcl
    16     16   set testprefix e_walauto
    17     17   
    18     18   
    19     19   proc read_nbackfill {} {
    20     20     seek $::shmfd 96
    21         -  binary scan [read $::shmfd 4] i nBackfill
           21  +  binary scan [read $::shmfd 4] n nBackfill
    22     22     set nBackfill
    23     23   }
    24     24   proc read_mxframe {} {
    25     25     seek $::shmfd 16
    26         -  binary scan [read $::shmfd 4] i mxFrame
           26  +  binary scan [read $::shmfd 4] n mxFrame
    27     27     set mxFrame
    28     28   }
    29     29   
    30     30   # Assuming that the main db for database handle
    31     31   #
    32     32   proc do_autocommit_threshold_test {tn value} {
    33     33   

Changes to test/fuzz2.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library. 
    12     12   #
    13     13   # This file checks error recovery from malformed SQL strings.
    14     14   #
    15         -# $Id: fuzz2.test,v 1.3 2007/05/15 16:51:37 drh Exp $
    16     15   
    17     16   set testdir [file dirname $argv0]
    18     17   source $testdir/tester.tcl
    19     18   
    20     19   
    21     20   proc fuzzcatch {sql} {
    22     21     return [lindex [catchsql $sql] 0]
................................................................................
   100     99   } {1}
   101    100   do_test fuzz2-5.4 {
   102    101     fuzzcatch {REPLACE INTO AAAAAA SELECT DISTINCT "AAAAAA" . * WHERE AAAAAA ( AAAAAA ( ) ) GROUP BY AAAAAA . AAAAAA . "AAAAAA" IN "AAAAAA" | AAAAAA ( ALL , ) ORDER BY #238, #92 DESC LIMIT 0 OFFSET - RAISE ( IGNORE ) NOT NULL > RAISE ( IGNORE ) IS NULL}
   103    102   } {1}
   104    103   do_test fuzz2-5.5 {
   105    104     fuzzcatch {SELECT ALL * GROUP BY EXISTS ( SELECT "AAAAAA" . * , AAAAAA ( * ) AS AAAAAA FROM "AAAAAA" . "AAAAAA" AS "AAAAAA" USING ( AAAAAA , "AAAAAA" , "AAAAAA" ) WHERE AAAAAA ( DISTINCT ) - RAISE ( FAIL , "AAAAAA" ) HAVING "AAAAAA" . "AAAAAA" . AAAAAA ORDER BY #182 , #55 ) BETWEEN EXISTS ( SELECT ALL * FROM ( ( }
   106    105   } {1}
          106  +
          107  +# Test cases discovered by Michal Zalewski on 2015-01-03 and reported on the
          108  +# sqlite-users mailing list.  All of these cases cause segfaults in 
          109  +# SQLite 3.8.7.4 and earlier.
          110  +#
          111  +do_test fuzz2-6.1 {
          112  +  catchsql {SELECT n()AND+#0;}
          113  +} {1 {near "#0": syntax error}}
          114  +do_test fuzz2-6.2 {
          115  +  catchsql {SELECT strftime()}
          116  +} {0 {{}}}
          117  +do_test fuzz2-6.3 {
          118  +  catchsql {DETACH(SELECT group_concat(q));}
          119  +} {1 {no such column: q}}
          120  +do_test fuzz2-6.4a {
          121  +  db eval {DROP TABLE IF EXISTS t0; CREATE TABLE t0(t);}
          122  +  catchsql {INSERT INTO t0 SELECT strftime();}
          123  +} {0 {}}
          124  +do_test fuzz2-6.4b {
          125  +  db eval {SELECT quote(t) FROM t0} 
          126  +} {NULL}
          127  +
   107    128   
   108    129   finish_test

Changes to test/permutations.test.

   161    161     test_set $allquicktests -exclude *malloc* *ioerr* *fault* -include malloc.test
   162    162   ]
   163    163   
   164    164   test_suite "valgrind" -prefix "" -description {
   165    165     Run the "veryquick" test suite with a couple of multi-process tests (that
   166    166     fail under valgrind) omitted.
   167    167   } -files [
   168         -  test_set $allquicktests -exclude *malloc* *ioerr* *fault* wal.test atof1.test
          168  +  test_set $allquicktests -exclude *malloc* *ioerr* *fault* wal.test \
          169  +              shell*.test crash8.test atof1.test selectG.test \
          170  +              tkt-fc62af4523.test
   169    171   ] -initialize {
   170    172     set ::G(valgrind) 1
   171    173   } -shutdown {
   172    174     unset -nocomplain ::G(valgrind)
   173    175   }
   174    176   
   175    177   test_suite "valgrind-nolookaside" -prefix "" -description {

Changes to test/releasetest.tcl.

    25     25   $tcl_platform(os) and $tcl_platform(machine) variables. Supported
    26     26   platforms are "Linux-x86", "Linux-x86_64" and "Darwin-i386".
    27     27   
    28     28   Every test begins with a fresh run of the configure script at the top
    29     29   of the SQLite source tree.
    30     30   }
    31     31   
    32         -array set ::Configs {
           32  +# Omit comments (text between # and \n) in a long multi-line string.
           33  +#
           34  +proc strip_comments {in} {
           35  +  regsub -all {#[^\n]*\n} $in {} out
           36  +  return $out
           37  +}
           38  +
           39  +array set ::Configs [strip_comments {
    33     40     "Default" {
    34     41       -O2
    35     42       --disable-amalgamation --disable-shared
    36     43     }
    37     44     "Sanitize" {
    38     45       CC=clang -fsanitize=undefined
    39     46       -DSQLITE_ENABLE_STAT4
    40     47     }
           48  +  "Have-Not" {
           49  +    # The "Have-Not" configuration sets all possible -UHAVE_feature options
           50  +    # in order to verify that the code works even on platforms that lack
           51  +    # these support services.
           52  +    -DHAVE_FDATASYNC=0
           53  +    -DHAVE_GMTIME_R=0
           54  +    -DHAVE_ISNAN=0
           55  +    -DHAVE_LOCALTIME_R=0
           56  +    -DHAVE_LOCALTIME_S=0
           57  +    -DHAVE_MALLOC_USABLE_SIZE=0
           58  +    -DHAVE_STRCHRNUL=0
           59  +    -DHAVE_USLEEP=0
           60  +    -DHAVE_UTIME=0
           61  +  }
    41     62     "Unlock-Notify" {
    42     63       -O2
    43     64       -DSQLITE_ENABLE_UNLOCK_NOTIFY
    44     65       -DSQLITE_THREADSAFE
    45     66       -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
    46     67     }
    47     68     "Secure-Delete" {
................................................................................
    49     70       -DSQLITE_SECURE_DELETE=1
    50     71       -DSQLITE_SOUNDEX=1
    51     72     }
    52     73     "Update-Delete-Limit" {
    53     74       -O2
    54     75       -DSQLITE_DEFAULT_FILE_FORMAT=4
    55     76       -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
           77  +    -DSQLITE_ENABLE_STMT_SCANSTATUS
    56     78     }
    57     79     "Check-Symbols" {
    58     80       -DSQLITE_MEMDEBUG=1
    59     81       -DSQLITE_ENABLE_FTS3_PARENTHESIS=1
    60     82       -DSQLITE_ENABLE_FTS3=1
    61     83       -DSQLITE_ENABLE_RTREE=1
    62     84       -DSQLITE_ENABLE_MEMSYS5=1
................................................................................
    65     87       -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1
    66     88       -DSQLITE_SECURE_DELETE=1
    67     89       -DSQLITE_SOUNDEX=1
    68     90       -DSQLITE_ENABLE_ATOMIC_WRITE=1
    69     91       -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1
    70     92       -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
    71     93       -DSQLITE_ENABLE_STAT4
           94  +    -DSQLITE_ENABLE_STMT_SCANSTATUS
    72     95     }
    73     96     "Debug-One" {
    74     97       --disable-shared
    75     98       -O2
    76     99       -DSQLITE_DEBUG=1
    77    100       -DSQLITE_MEMDEBUG=1
    78    101       -DSQLITE_MUTEX_NOOP=1
................................................................................
   160    183       -DHAVE_USLEEP=1
   161    184     }
   162    185     "Valgrind" {
   163    186       -DSQLITE_ENABLE_STAT4
   164    187       -DSQLITE_ENABLE_FTS4
   165    188       -DSQLITE_ENABLE_RTREE
   166    189     }
          190  +
          191  +  # The next group of configurations are used only by the
          192  +  # Failure-Detection platform.  They are all the same, but we need
          193  +  # different names for them all so that they results appear in separate
          194  +  # subdirectories.
          195  +  #
   167    196     Fail0 {-O0}
   168    197     Fail2 {-O0}
   169    198     Fail3 {-O0}
   170         -}
          199  +  Fail4 {-O0}
          200  +}]
   171    201   
   172         -array set ::Platforms {
          202  +array set ::Platforms [strip_comments {
   173    203     Linux-x86_64 {
   174    204       "Check-Symbols"           checksymbols
   175    205       "Debug-One"               "mptest test"
          206  +    "Have-Not"                test
   176    207       "Secure-Delete"           test
   177    208       "Unlock-Notify"           "QUICKTEST_INCLUDE=notify2.test test"
   178    209       "Update-Delete-Limit"     test
   179    210       "Extra-Robustness"        test
   180    211       "Device-Two"              test
   181    212       "No-lookaside"            test
   182    213       "Devkit"                  test
................................................................................
   183    214       "Sanitize"                {QUICKTEST_OMIT=func4.test,nan.test test}
   184    215       "Valgrind"                valgrindtest
   185    216       "Default"                 "threadtest fulltest"
   186    217       "Device-One"              fulltest
   187    218     }
   188    219     Linux-i686 {
   189    220       "Devkit"                  test
          221  +    "Have-Not"                test
   190    222       "Unlock-Notify"           "QUICKTEST_INCLUDE=notify2.test test"
   191    223       "Device-One"              test
   192    224       "Device-Two"              test
   193    225       "Default"                 "threadtest fulltest"
   194    226     }
   195    227     Darwin-i386 {
   196    228       "Locking-Style"           "mptest test"
          229  +    "Have-Not"                test
   197    230       "OS-X"                    "threadtest fulltest"
   198    231     }
   199    232     Darwin-x86_64 {
   200    233       "Locking-Style"           "mptest test"
          234  +    "Have-Not"                test
   201    235       "OS-X"                    "threadtest fulltest"
   202    236     }
   203    237     "Windows NT-intel" {
   204    238       "Default"                 "mptest fulltestonly"
          239  +    "Have-Not"                test
   205    240     }
          241  +
          242  +  # The Failure-Detection platform runs various tests that deliberately
          243  +  # fail.  This is used as a test of this script to verify that this script
          244  +  # correctly identifies failures.
          245  +  #
   206    246     Failure-Detection {
   207    247       Fail0     "TEST_FAILURE=0 test"
   208    248       Sanitize  "TEST_FAILURE=1 test"
   209    249       Fail2     "TEST_FAILURE=2 valgrindtest"
   210    250       Fail3     "TEST_FAILURE=3 valgrindtest"
          251  +    Fail4     "TEST_FAILURE=4 test"
   211    252     }
   212         -}
          253  +}]
   213    254   
   214    255   
   215    256   # End of configuration section.
   216    257   #########################################################################
   217    258   #########################################################################
   218    259   
   219    260   foreach {key value} [array get ::Platforms] {
................................................................................
   272    313         }
   273    314       }
   274    315     }
   275    316     close $fd
   276    317     if {!$seen} {
   277    318       set rc 1
   278    319       set errmsg "Test did not complete"
          320  +    if {[file readable core]} {
          321  +      append errmsg " - core file exists"
          322  +    }
   279    323     }
   280    324   }
   281    325   
   282    326   proc run_test_suite {name testtarget config} {
   283    327     # Tcl variable $opts is used to build up the value used to set the
   284    328     # OPTS Makefile variable. Variable $cflags holds the value for
   285    329     # CFLAGS. The makefile will pass OPTS to both gcc and lemon, but
................................................................................
   288    332     set cflags "-g"
   289    333     set opts ""
   290    334     set title ${name}($testtarget)
   291    335     set configOpts ""
   292    336   
   293    337     regsub -all {#[^\n]*\n} $config \n config
   294    338     foreach arg $config {
   295         -    if {[string match -D* $arg]} {
          339  +    if {[regexp {^-[UD]} $arg]} {
   296    340         lappend opts $arg
   297         -    } elseif {[string match CC=* $arg]} {
          341  +    } elseif {[regexp {^[A-Z]+=} $arg]} {
   298    342         lappend testtarget $arg
   299    343       } elseif {[regexp {^--(enable|disable)-} $arg]} {
   300    344         lappend configOpts $arg
   301    345       } else {
   302    346         lappend cflags $arg
   303    347       }
   304    348     }
................................................................................
   325    369   
   326    370     set rc 0
   327    371     set tm1 [clock seconds]
   328    372     set origdir [pwd]
   329    373     trace_cmd file mkdir $dir
   330    374     trace_cmd cd $dir
   331    375     set errmsg {}
          376  +  catch {file delete core}
   332    377     set rc [catch [configureCommand $configOpts]]
   333    378     if {!$rc} {
   334    379       set rc [catch [makeCommand $testtarget $cflags $opts]]
   335    380       count_tests_and_errors test.log rc errmsg
   336    381     }
   337    382     trace_cmd cd $origdir
   338    383     set tm2 [clock seconds]

Changes to test/shell1.test.

   203    203     catchcmd "test.db" ".explain \"OFF"
   204    204   } {0 {}}
   205    205   do_test shell1-2.2.4 {
   206    206     catchcmd "test.db" ".explain \'OFF"
   207    207   } {0 {}}
   208    208   do_test shell1-2.2.5 {
   209    209     catchcmd "test.db" ".mode \"insert FOO"
   210         -} {1 {Error: mode should be one of: column csv html insert line list tabs tcl}}
          210  +} {1 {Error: mode should be one of: ascii column csv html insert line list tabs tcl}}
   211    211   do_test shell1-2.2.6 {
   212    212     catchcmd "test.db" ".mode \'insert FOO"
   213         -} {1 {Error: mode should be one of: column csv html insert line list tabs tcl}}
          213  +} {1 {Error: mode should be one of: ascii column csv html insert line list tabs tcl}}
   214    214   
   215    215   # check multiple tokens, and quoted tokens
   216    216   do_test shell1-2.3.1 {
   217    217     catchcmd "test.db" ".explain 1"
   218    218   } {0 {}}
   219    219   do_test shell1-2.3.2 {
   220    220     catchcmd "test.db" ".explain on"
................................................................................
   234    234   do_test shell1-2.3.7 {
   235    235     catchcmd "test.db" ".\'explain\' \'OFF\'"
   236    236   } {0 {}}
   237    237   
   238    238   # check quoted args are unquoted
   239    239   do_test shell1-2.4.1 {
   240    240     catchcmd "test.db" ".mode FOO"
   241         -} {1 {Error: mode should be one of: column csv html insert line list tabs tcl}}
          241  +} {1 {Error: mode should be one of: ascii column csv html insert line list tabs tcl}}
   242    242   do_test shell1-2.4.2 {
   243    243     catchcmd "test.db" ".mode csv"
   244    244   } {0 {}}
   245    245   do_test shell1-2.4.2 {
   246    246     catchcmd "test.db" ".mode \"csv\""
   247    247   } {0 {}}
   248    248   
................................................................................
   417    417   } {0 {}}
   418    418   do_test shell1-3.12.3 {
   419    419     # too many arguments
   420    420     catchcmd "test.db" ".indices FOO BAD"
   421    421   } {1 {Usage: .indices ?LIKE-PATTERN?}}
   422    422   
   423    423   # .mode MODE ?TABLE?     Set output mode where MODE is one of:
          424  +#                          ascii    Columns/rows delimited by 0x1F and 0x1E
   424    425   #                          csv      Comma-separated values
   425    426   #                          column   Left-aligned columns.  (See .width)
   426    427   #                          html     HTML <table> code
   427    428   #                          insert   SQL insert statements for TABLE
   428    429   #                          line     One value per line
   429         -#                          list     Values delimited by .separator string
          430  +#                          list     Values delimited by .separator strings
   430    431   #                          tabs     Tab-separated values
   431    432   #                          tcl      TCL list elements
   432    433   do_test shell1-3.13.1 {
   433    434     catchcmd "test.db" ".mode"
   434         -} {1 {Error: mode should be one of: column csv html insert line list tabs tcl}}
          435  +} {1 {Error: mode should be one of: ascii column csv html insert line list tabs tcl}}
   435    436   do_test shell1-3.13.2 {
   436    437     catchcmd "test.db" ".mode FOO"
   437         -} {1 {Error: mode should be one of: column csv html insert line list tabs tcl}}
          438  +} {1 {Error: mode should be one of: ascii column csv html insert line list tabs tcl}}
   438    439   do_test shell1-3.13.3 {
   439    440     catchcmd "test.db" ".mode csv"
   440    441   } {0 {}}
   441    442   do_test shell1-3.13.4 {
   442    443     catchcmd "test.db" ".mode column"
   443    444   } {0 {}}
   444    445   do_test shell1-3.13.5 {
................................................................................
   463    464     # extra arguments ignored
   464    465     catchcmd "test.db" ".mode tcl BAD"
   465    466   } {0 {}}
   466    467   
   467    468   # don't allow partial mode type matches
   468    469   do_test shell1-3.13.12 {
   469    470     catchcmd "test.db" ".mode l"
   470         -} {1 {Error: mode should be one of: column csv html insert line list tabs tcl}}
          471  +} {1 {Error: mode should be one of: ascii column csv html insert line list tabs tcl}}
   471    472   do_test shell1-3.13.13 {
   472    473     catchcmd "test.db" ".mode li"
   473         -} {1 {Error: mode should be one of: column csv html insert line list tabs tcl}}
          474  +} {1 {Error: mode should be one of: ascii column csv html insert line list tabs tcl}}
   474    475   do_test shell1-3.13.14 {
   475    476     catchcmd "test.db" ".mode lin"
   476    477   } {0 {}}
   477    478   
   478    479   # .nullvalue STRING      Print STRING in place of NULL values
   479    480   do_test shell1-3.14.1 {
   480    481     catchcmd "test.db" ".nullvalue"
................................................................................
   582    583     }
   583    584     catchcmd "test.db" ".schema"
   584    585   } {0 {CREATE TABLE t1(x);
   585    586   CREATE VIEW v2 AS SELECT x+1 AS y FROM t1;
   586    587   CREATE VIEW v1 AS SELECT y+1 FROM v2;}}
   587    588   db eval {DROP VIEW v1; DROP VIEW v2; DROP TABLE t1;}
   588    589   
   589         -# .separator STRING      Change separator used by output mode and .import
          590  +# .separator STRING  Change column separator used by output and .import
   590    591   do_test shell1-3.22.1 {
   591    592     catchcmd "test.db" ".separator"
   592         -} {1 {Usage: .separator SEPARATOR ?NEWLINE?}}
          593  +} {1 {Usage: .separator COL ?ROW?}}
   593    594   do_test shell1-3.22.2 {
   594    595     catchcmd "test.db" ".separator FOO"
   595    596   } {0 {}}
   596    597   do_test shell1-3.22.3 {
   597    598     catchcmd "test.db" ".separator ABC XYZ"
   598    599   } {0 {}}
   599    600   do_test shell1-3.22.4 {
   600    601     # too many arguments
   601    602     catchcmd "test.db" ".separator FOO BAD BAD2"
   602         -} {1 {Usage: .separator SEPARATOR ?NEWLINE?}}
          603  +} {1 {Usage: .separator COL ?ROW?}}
   603    604   
   604    605   # .show                  Show the current values for various settings
   605    606   do_test shell1-3.23.1 {
   606    607     set res [catchcmd "test.db" ".show"]
   607    608     list [regexp {echo:} $res] \
   608    609          [regexp {explain:} $res] \
   609    610          [regexp {headers:} $res] \
   610    611          [regexp {mode:} $res] \
   611    612          [regexp {nullvalue:} $res] \
   612    613          [regexp {output:} $res] \
   613         -       [regexp {separator:} $res] \
          614  +       [regexp {colseparator:} $res] \
          615  +       [regexp {rowseparator:} $res] \
   614    616          [regexp {stats:} $res] \
   615    617          [regexp {width:} $res]
   616         -} {1 1 1 1 1 1 1 1 1}
          618  +} {1 1 1 1 1 1 1 1 1 1}
   617    619   do_test shell1-3.23.2 {
   618    620     # too many arguments
   619    621     catchcmd "test.db" ".show BAD"
   620    622   } {1 {Usage: .show}}
   621    623   
   622    624   # .stats ON|OFF          Turn stats on or off
   623    625   do_test shell1-3.23b.1 {

Changes to test/shell5.test.

    51     51     # too many arguments
    52     52     catchcmd "test.db" ".import FOO BAR BAD"
    53     53   } {1 {Usage: .import FILE TABLE}}
    54     54   
    55     55   # .separator STRING      Change separator used by output mode and .import
    56     56   do_test shell5-1.2.1 {
    57     57     catchcmd "test.db" ".separator"
    58         -} {1 {Usage: .separator SEPARATOR ?NEWLINE?}}
           58  +} {1 {Usage: .separator COL ?ROW?}}
    59     59   do_test shell5-1.2.2 {
    60     60     catchcmd "test.db" ".separator ONE"
    61     61   } {0 {}}
    62     62   do_test shell5-1.2.3 {
    63     63     catchcmd "test.db" ".separator ONE TWO"
    64     64   } {0 {}}
    65     65   do_test shell5-1.2.4 {
    66     66     # too many arguments
    67     67     catchcmd "test.db" ".separator ONE TWO THREE"
    68         -} {1 {Usage: .separator SEPARATOR ?NEWLINE?}}
           68  +} {1 {Usage: .separator COL ?ROW?}}
    69     69   
    70         -# separator should default to "|"
    71         -do_test shell5-1.3.1 {
           70  +# column separator should default to "|"
           71  +do_test shell5-1.3.1.1 {
           72  +  set res [catchcmd "test.db" ".show"]
           73  +  list [regexp {colseparator: \"\|\"} $res]
           74  +} {1}
           75  +
           76  +# row separator should default to "\n"
           77  +do_test shell5-1.3.1.2 {
    72     78     set res [catchcmd "test.db" ".show"]
    73         -  list [regexp {separator: \"\|\"} $res]
           79  +  list [regexp {rowseparator: \"\\n\"} $res]
    74     80   } {1}
    75     81   
    76     82   # set separator to different value.
    77     83   # check that .show reports new value
    78     84   do_test shell5-1.3.2 {
    79     85     set res [catchcmd "test.db" {.separator ,
    80     86   .show}]
................................................................................
   368    374   .mode csv
   369    375   CREATE TABLE t4(a, b);
   370    376   .import shell5.csv t4
   371    377     }]
   372    378     db eval { SELECT * FROM t4 }
   373    379   } {xy\" hello one 2 {} {}}
   374    380   
          381  +#----------------------------------------------------------------------------
          382  +# Tests for the shell "ascii" import/export mode.
          383  +#
          384  +do_test shell5-3.1 {
          385  +  set fd [open shell5.csv w]
          386  +  fconfigure $fd -encoding binary -translation binary
          387  +  puts -nonewline $fd "\"test 1\"\x1F,test 2\r\n\x1E"
          388  +  puts -nonewline $fd "test 3\x1Ftest 4\n"
          389  +  close $fd
          390  +  catchcmd test.db {
          391  +.mode ascii
          392  +CREATE TABLE t5(a, b);
          393  +.import shell5.csv t5
          394  +  }
          395  +  db eval { SELECT * FROM t5 }
          396  +} "\{\"test 1\"} \{,test 2\r\n\} \{test 3\} \{test 4\n\}"
          397  +
          398  +do_test shell5-3.2 {
          399  +  set x [catchcmd test.db {
          400  +.mode ascii
          401  +SELECT * FROM t5;
          402  +  }]
          403  +  # Handle platform end-of-line differences
          404  +  regsub -all {[\n\r]?\n} $x <EOL> x
          405  +  set x
          406  +} "0 \{\"test 1\"\x1F,test 2<EOL>\x1Etest 3\x1Ftest 4<EOL>\x1E\}"
   375    407   
   376    408   finish_test

Changes to tool/lemon.c.

  2438   2438           psp->errorcnt++;
  2439   2439         }
  2440   2440         break;
  2441   2441       case WAITING_FOR_DECL_ARG:
  2442   2442         if( x[0]=='{' || x[0]=='\"' || isalnum(x[0]) ){
  2443   2443           const char *zOld, *zNew;
  2444   2444           char *zBuf, *z;
  2445         -        int nOld, n, nLine, nNew, nBack;
         2445  +        int nOld, n, nLine = 0, nNew, nBack;
  2446   2446           int addLineMacro;
  2447   2447           char zLine[50];
  2448   2448           zNew = x;
  2449   2449           if( zNew[0]=='"' || zNew[0]=='{' ) zNew++;
  2450   2450           nNew = lemonStrlen(zNew);
  2451   2451           if( *psp->declargslot ){
  2452   2452             zOld = *psp->declargslot;
................................................................................
  2637   2637   ** the appropriate data structures in the global state vector "gp".
  2638   2638   */
  2639   2639   void Parse(struct lemon *gp)
  2640   2640   {
  2641   2641     struct pstate ps;
  2642   2642     FILE *fp;
  2643   2643     char *filebuf;
  2644         -  int filesize;
         2644  +  unsigned int filesize;
  2645   2645     int lineno;
  2646   2646     int c;
  2647   2647     char *cp, *nextcp;
  2648   2648     int startline = 0;
  2649   2649   
  2650   2650     memset(&ps, '\0', sizeof(ps));
  2651   2651     ps.gp = gp;
................................................................................
  2771   2771       }else{                          /* All other (one character) operators */
  2772   2772         cp++;
  2773   2773         nextcp = cp;
  2774   2774       }
  2775   2775       c = *cp;
  2776   2776       *cp = 0;                        /* Null terminate the token */
  2777   2777       parseonetoken(&ps);             /* Parse the token */
  2778         -    *cp = c;                        /* Restore the buffer */
         2778  +    *cp = (char)c;                  /* Restore the buffer */
  2779   2779       cp = nextcp;
  2780   2780     }
  2781   2781     free(filebuf);                    /* Release the buffer after parsing */
  2782   2782     gp->rule = ps.firstrule;
  2783   2783     gp->errorcnt = ps.errorcnt;
  2784   2784   }
  2785   2785   /*************************** From the file "plink.c" *********************/
................................................................................
  3394   3394         lemon_sprintf(zInt, "%d", p1);
  3395   3395         p1 = p2;
  3396   3396         lemon_strcpy(&z[used], zInt);
  3397   3397         used += lemonStrlen(&z[used]);
  3398   3398         zText++;
  3399   3399         n--;
  3400   3400       }else{
  3401         -      z[used++] = c;
         3401  +      z[used++] = (char)c;
  3402   3402       }
  3403   3403     }
  3404   3404     z[used] = 0;
  3405   3405     return z;
  3406   3406   }
  3407   3407   
  3408   3408   /*

Changes to tool/mkautoconfamal.sh.

    62     62   echo "#ifdef USE_SYSTEM_SQLITE"      > tea/generic/tclsqlite3.c 
    63     63   echo "# include <sqlite3.h>"        >> tea/generic/tclsqlite3.c
    64     64   echo "#else"                        >> tea/generic/tclsqlite3.c
    65     65   echo "#include \"sqlite3.c\""       >> tea/generic/tclsqlite3.c
    66     66   echo "#endif"                       >> tea/generic/tclsqlite3.c
    67     67   cat  $TOP/src/tclsqlite.c           >> tea/generic/tclsqlite3.c
    68     68   
    69         -cat tea/configure.in | 
           69  +cat tea/configure.ac | 
    70     70     sed "s/AC_INIT(\[sqlite\], .*)/AC_INIT([sqlite], [$VERSION])/" > tmp
    71         -mv tmp tea/configure.in
           71  +mv tmp tea/configure.ac
    72     72   
    73     73   cd tea
    74     74   autoconf
    75     75   rm -rf autom4te.cache
    76     76   
    77     77   cd ../
    78     78   ./configure && make dist
    79     79   tar -xzf sqlite-$VERSION.tar.gz
    80     80   mv sqlite-$VERSION sqlite-autoconf-$ARTIFACT
    81     81   tar -czf sqlite-autoconf-$ARTIFACT.tar.gz sqlite-autoconf-$ARTIFACT
    82     82   mv sqlite-autoconf-$ARTIFACT.tar.gz ..
    83         -

Changes to tool/mksqlite3c-noext.tcl.

    92     92   #
    93     93   foreach hdr {
    94     94      btree.h
    95     95      btreeInt.h
    96     96      hash.h
    97     97      hwtime.h
    98     98      keywordhash.h
           99  +   msvc.h
    99    100      mutex.h
   100    101      opcodes.h
   101    102      os_common.h
   102    103      os_setup.h
   103    104      os_win.h
   104    105      os.h
   105    106      pager.h

Changes to tool/mksqlite3c.tcl.

    96     96      fts3.h
    97     97      fts3Int.h
    98     98      fts3_hash.h
    99     99      fts3_tokenizer.h
   100    100      hash.h
   101    101      hwtime.h
   102    102      keywordhash.h
          103  +   msvc.h
   103    104      mutex.h
   104    105      opcodes.h
   105    106      os_common.h
   106    107      os_setup.h
   107    108      os_win.h
   108    109      os.h
   109    110      pager.h

Changes to tool/mksqlite3internalh.tcl.

    54     54   #
    55     55   foreach hdr {
    56     56      btree.h
    57     57      btreeInt.h
    58     58      hash.h
    59     59      hwtime.h
    60     60      keywordhash.h
           61  +   msvc.h
    61     62      opcodes.h
    62     63      os_common.h
    63     64      os_setup.h
    64     65      os_win.h
    65     66      os.h
    66     67      pager.h
    67     68      parse.h