/ Check-in [9f1f8b33]
Login

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

Overview
Comment:Merge all recent trunk enhancements and especially the blocking WAL-lock fix into the apple-osx branch.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | apple-osx
Files: files | file ages | folders
SHA1:9f1f8b331e05d88052e6fb6556a88591efaa44bf
User & Date: drh 2015-03-21 17:00:06
Context
2015-03-24
18:49
Merge the latest trunk enhancements into the apple-osx branch. check-in: a2bd81e5 user: drh tags: apple-osx
2015-03-21
17:00
Merge all recent trunk enhancements and especially the blocking WAL-lock fix into the apple-osx branch. check-in: 9f1f8b33 user: drh tags: apple-osx
16:40
Change walblock.test to block an external process for 10 seconds, not 5. 5 seconds is not long enough to tell the difference between a blocking lock and a series of retries. check-in: 717335fc user: dan tags: trunk
2015-03-17
18:35
Merge all recent trunk changes, and in particular the blocking WAL lock change, into the apple-osx branch. check-in: 8abbeadb user: drh tags: apple-osx
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.msc.

    17     17   !ENDIF
    18     18   
    19     19   # Set this non-0 to enable full warnings (-W4, etc) when compiling.
    20     20   #
    21     21   !IFNDEF USE_FULLWARN
    22     22   USE_FULLWARN = 0
    23     23   !ENDIF
           24  +
           25  +# Set this non-0 to use "stdcall" calling convention for the core library
           26  +# and shell executable.
           27  +#
           28  +!IFNDEF USE_STDCALL
           29  +USE_STDCALL = 0
           30  +!ENDIF
           31  +
           32  +# Set this non-0 to have the shell executable link against the core dynamic
           33  +# link library.
           34  +#
           35  +!IFNDEF DYNAMIC_SHELL
           36  +DYNAMIC_SHELL = 0
           37  +!ENDIF
    24     38   
    25     39   # If necessary, create a list of harmless compiler warnings to disable when
    26         -# compiling the build tools.  For the SQLite source code itself, warnings,
           40  +# compiling the various tools.  For the SQLite source code itself, warnings,
    27     41   # if any, will be disabled from within it.
    28     42   #
    29     43   !IFNDEF NO_WARN
    30     44   !IF $(USE_FULLWARN)!=0
    31     45   NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4152 -wd4189 -wd4206 -wd4210
    32     46   NO_WARN = $(NO_WARN) -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706
    33     47   !ENDIF
................................................................................
   252    266   
   253    267   NSDKLIBPATH = $(NSDKLIBPATH:\\=\)
   254    268   
   255    269   # C compiler and options for use in building executables that
   256    270   # will run on the platform that is doing the build.
   257    271   #
   258    272   !IF $(USE_FULLWARN)!=0
   259         -BCC = $(NCC) -W4
          273  +BCC = $(NCC) -nologo -W4
   260    274   !ELSE
   261         -BCC = $(NCC) -W3
          275  +BCC = $(NCC) -nologo -W3
   262    276   !ENDIF
   263    277   
   264    278   # Check if assembly code listings should be generated for the source
   265    279   # code files to be compiled.
   266    280   #
   267    281   !IF $(USE_LISTINGS)!=0
   268    282   BCC = $(BCC) -FAcs
................................................................................
   277    291   !ENDIF
   278    292   
   279    293   # C compiler and options for use in building executables that
   280    294   # will run on the target platform.  (BCC and TCC are usually the
   281    295   # same unless your are cross-compiling.)
   282    296   #
   283    297   !IF $(USE_FULLWARN)!=0
   284         -TCC = $(CC) -W4 -DINCLUDE_MSVC_H=1
          298  +TCC = $(CC) -nologo -W4 -DINCLUDE_MSVC_H=1
   285    299   !ELSE
   286         -TCC = $(CC) -W3
          300  +TCC = $(CC) -nologo -W3
   287    301   !ENDIF
   288    302   
   289    303   TCC = $(TCC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src -fp:precise
   290    304   RCC = $(RC) -DSQLITE_OS_WIN=1 -I$(TOP) -I$(TOP)\src
          305  +
          306  +# Check if we want to use the "stdcall" calling convention when compiling.
          307  +# This is not supported by the compilers for non-x86 platforms.  It should
          308  +# also be noted here that building any target with these "stdcall" options
          309  +# will most likely fail if the Tcl library is also required.  This is due
          310  +# to how the Tcl library functions are declared and exported (i.e. without
          311  +# an explicit calling convention, which results in "cdecl").
          312  +#
          313  +!IF $(USE_STDCALL)!=0
          314  +!IF "$(PLATFORM)"=="x86"
          315  +CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl
          316  +SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl
          317  +!ELSE
          318  +!IFNDEF PLATFORM
          319  +CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl
          320  +SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl
          321  +!ELSE
          322  +CORE_CCONV_OPTS =
          323  +SHELL_CCONV_OPTS =
          324  +!ENDIF
          325  +!ENDIF
          326  +!ELSE
          327  +CORE_CCONV_OPTS =
          328  +SHELL_CCONV_OPTS =
          329  +!ENDIF
          330  +
          331  +# These are additional compiler options used for the core library.
          332  +#
          333  +!IFNDEF CORE_COMPILE_OPTS
          334  +!IF $(USE_STDCALL)!=0
          335  +CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS) -DSQLITE_API=__declspec(dllexport)
          336  +!ELSE
          337  +CORE_COMPILE_OPTS = $(CORE_CCONV_OPTS)
          338  +!ENDIF
          339  +!ENDIF
          340  +
          341  +# These are the additional targets that the core library should depend on
          342  +# when linking.
          343  +#
          344  +!IFNDEF CORE_LINK_DEP
          345  +!IF $(USE_STDCALL)!=0
          346  +CORE_LINK_DEP =
          347  +!ELSE
          348  +CORE_LINK_DEP = sqlite3.def
          349  +!ENDIF
          350  +!ENDIF
          351  +
          352  +# These are additional linker options used for the core library.
          353  +#
          354  +!IFNDEF CORE_LINK_OPTS
          355  +!IF $(USE_STDCALL)!=0
          356  +CORE_LINK_OPTS =
          357  +!ELSE
          358  +CORE_LINK_OPTS = /DEF:sqlite3.def
          359  +!ENDIF
          360  +!ENDIF
          361  +
          362  +# These are additional compiler options used for the shell executable.
          363  +#
          364  +!IFNDEF SHELL_COMPILE_OPTS
          365  +!IF $(DYNAMIC_SHELL)!=0
          366  +SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS) -DSQLITE_API=__declspec(dllimport)
          367  +!ELSE
          368  +SHELL_COMPILE_OPTS = $(SHELL_CCONV_OPTS)
          369  +!ENDIF
          370  +!ENDIF
          371  +
          372  +# This is the core library that the shell executable should depend on.
          373  +#
          374  +!IFNDEF SHELL_CORE_DEP
          375  +!IF $(DYNAMIC_SHELL)!=0
          376  +SHELL_CORE_DEP = sqlite3.dll
          377  +!ELSE
          378  +SHELL_CORE_DEP = libsqlite3.lib
          379  +!ENDIF
          380  +!ENDIF
          381  +
          382  +# This is the core library that the shell executable should link with.
          383  +#
          384  +!IFNDEF SHELL_CORE_LIB
          385  +!IF $(DYNAMIC_SHELL)!=0
          386  +SHELL_CORE_LIB = sqlite3.lib
          387  +!ELSE
          388  +SHELL_CORE_LIB = libsqlite3.lib
          389  +!ENDIF
          390  +!ENDIF
          391  +
          392  +# These are additional linker options used for the shell executable.
          393  +#
          394  +!IFNDEF SHELL_LINK_OPTS
          395  +SHELL_LINK_OPTS = $(SHELL_CORE_LIB)
          396  +!ENDIF
   291    397   
   292    398   # Check if assembly code listings should be generated for the source
   293    399   # code files to be compiled.
   294    400   #
   295    401   !IF $(USE_LISTINGS)!=0
   296    402   TCC = $(TCC) -FAcs
   297    403   !ENDIF
................................................................................
   583    689   !ENDIF
   584    690   
   585    691   # If a platform was set, force the linker to target that.
   586    692   # Note that the vcvars*.bat family of batch files typically
   587    693   # set this for you.  Otherwise, the linker will attempt
   588    694   # to deduce the binary type based on the object files.
   589    695   !IFDEF PLATFORM
   590         -LTLINKOPTS = /MACHINE:$(PLATFORM)
   591         -LTLIBOPTS = /MACHINE:$(PLATFORM)
          696  +LTLINKOPTS = /NOLOGO /MACHINE:$(PLATFORM)
          697  +LTLIBOPTS = /NOLOGO /MACHINE:$(PLATFORM)
          698  +!ELSE
          699  +LTLINKOPTS = /NOLOGO
          700  +LTLIBOPTS = /NOLOGO
   592    701   !ENDIF
   593    702   
   594    703   # When compiling for use in the WinRT environment, the following
   595    704   # linker option must be used to mark the executable as runnable
   596    705   # only in the context of an application container.
   597    706   #
   598    707   !IF $(FOR_WINRT)!=0
................................................................................
  1037   1146   
  1038   1147   libsqlite3.lib:	$(LIBOBJ)
  1039   1148   	$(LTLIB) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS)
  1040   1149   
  1041   1150   libtclsqlite3.lib:	tclsqlite.lo libsqlite3.lib
  1042   1151   	$(LTLIB) $(LTLIBOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCL:tcl=tclstub) $(TLIBS)
  1043   1152   
  1044         -sqlite3.exe:	$(TOP)\src\shell.c libsqlite3.lib $(LIBRESOBJS) sqlite3.h
  1045         -	$(LTLINK) $(READLINE_FLAGS) $(TOP)\src\shell.c \
  1046         -		/link $(LTLINKOPTS) $(LTLIBPATHS) libsqlite3.lib $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
         1153  +sqlite3.exe:	$(TOP)\src\shell.c $(SHELL_CORE_DEP) $(LIBRESOBJS) sqlite3.h
         1154  +	$(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) $(TOP)\src\shell.c \
         1155  +		/link /pdb:sqlite3sh.pdb $(LTLINKOPTS) $(SHELL_LINK_OPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
  1047   1156   
  1048         -mptester.exe:	$(TOP)\mptest\mptest.c libsqlite3.lib $(LIBRESOBJS) sqlite3.h
  1049         -	$(LTLINK) $(TOP)\mptest\mptest.c \
  1050         -		/link $(LTLINKOPTS) $(LTLIBPATHS) libsqlite3.lib $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
         1157  +mptester.exe:	$(TOP)\mptest\mptest.c $(SHELL_CORE_DEP) $(LIBRESOBJS) sqlite3.h
         1158  +	$(LTLINK) $(SHELL_COMPILE_OPTS) $(TOP)\mptest\mptest.c \
         1159  +		/link $(LTLINKOPTS) $(LTLIBPATHS) $(SHELL_LINK_OPTS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
  1051   1160   
  1052   1161   # This target creates a directory named "tsrc" and fills it with
  1053   1162   # copies of all of the C source code and header files needed to
  1054   1163   # build on the target system.  Some of the C source code and header
  1055   1164   # files are automatically generated.  This target takes care of
  1056   1165   # all that automatic generation.
  1057   1166   #
  1058   1167   .target_source:	$(SRC) $(TOP)\tool\vdbe-compress.tcl
  1059         -	-rmdir /S/Q tsrc
         1168  +	-rmdir /Q/S tsrc 2>NUL
  1060   1169   	-mkdir tsrc
  1061   1170   	for %i in ($(SRC1)) do copy /Y %i tsrc
  1062   1171   	for %i in ($(SRC2)) do copy /Y %i tsrc
  1063   1172   	for %i in ($(SRC3)) do copy /Y %i tsrc
  1064   1173   	for %i in ($(SRC4)) do copy /Y %i tsrc
  1065   1174   	for %i in ($(SRC5)) do copy /Y %i tsrc
  1066         -	del /Q tsrc\sqlite.h.in tsrc\parse.y
         1175  +	del /Q tsrc\sqlite.h.in tsrc\parse.y 2>NUL
  1067   1176   	$(TCLSH_CMD) $(TOP)\tool\vdbe-compress.tcl $(OPTS) < tsrc\vdbe.c > vdbe.new
  1068   1177   	move vdbe.new tsrc\vdbe.c
  1069   1178   	echo > .target_source
  1070   1179   
  1071   1180   sqlite3.c:	.target_source $(TOP)\tool\mksqlite3c.tcl
  1072   1181   	$(TCLSH_CMD) $(TOP)\tool\mksqlite3c.tcl $(MKSQLITE3C_ARGS)
  1073   1182   	copy tsrc\shell.c .
................................................................................
  1084   1193   !ELSE
  1085   1194   SQLITE3C = sqlite3.c
  1086   1195   !ENDIF
  1087   1196   
  1088   1197   # Rule to build the amalgamation
  1089   1198   #
  1090   1199   sqlite3.lo:	$(SQLITE3C)
  1091         -	$(LTCOMPILE) -c $(SQLITE3C)
         1200  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(SQLITE3C)
  1092   1201   
  1093   1202   # Rules to build the LEMON compiler generator
  1094   1203   #
  1095   1204   lempar.c:	$(TOP)\src\lempar.c
  1096   1205   	copy $(TOP)\src\lempar.c .
  1097   1206   
  1098   1207   lemon.exe:	$(TOP)\tool\lemon.c lempar.c
................................................................................
  1102   1211   # Rules to build individual *.lo files from generated *.c files. This
  1103   1212   # applies to:
  1104   1213   #
  1105   1214   #     parse.lo
  1106   1215   #     opcodes.lo
  1107   1216   #
  1108   1217   parse.lo:	parse.c $(HDR)
  1109         -	$(LTCOMPILE) -c parse.c
         1218  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c parse.c
  1110   1219   
  1111   1220   opcodes.lo:	opcodes.c
  1112         -	$(LTCOMPILE) -c opcodes.c
         1221  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c opcodes.c
  1113   1222   
  1114   1223   # Rule to build the Win32 resources object file.
  1115   1224   #
  1116   1225   !IF $(USE_RC)!=0
  1117   1226   $(LIBRESOBJS):	$(TOP)\src\sqlite3.rc $(HDR)
  1118   1227   	echo #ifndef SQLITE_RESOURCE_VERSION > sqlite3rc.h
  1119   1228   	for /F %%V in ('type "$(TOP)\VERSION"') do ( \
................................................................................
  1123   1232   	echo #endif >> sqlite3rc.h
  1124   1233   	$(LTRCOMPILE) -fo $(LIBRESOBJS) $(TOP)\src\sqlite3.rc
  1125   1234   !ENDIF
  1126   1235   
  1127   1236   # Rules to build individual *.lo files from files in the src directory.
  1128   1237   #
  1129   1238   alter.lo:	$(TOP)\src\alter.c $(HDR)
  1130         -	$(LTCOMPILE) -c $(TOP)\src\alter.c
         1239  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\alter.c
  1131   1240   
  1132   1241   analyze.lo:	$(TOP)\src\analyze.c $(HDR)
  1133         -	$(LTCOMPILE) -c $(TOP)\src\analyze.c
         1242  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\analyze.c
  1134   1243   
  1135   1244   attach.lo:	$(TOP)\src\attach.c $(HDR)
  1136         -	$(LTCOMPILE) -c $(TOP)\src\attach.c
         1245  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\attach.c
  1137   1246   
  1138   1247   auth.lo:	$(TOP)\src\auth.c $(HDR)
  1139         -	$(LTCOMPILE) -c $(TOP)\src\auth.c
         1248  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\auth.c
  1140   1249   
  1141   1250   backup.lo:	$(TOP)\src\backup.c $(HDR)
  1142         -	$(LTCOMPILE) -c $(TOP)\src\backup.c
         1251  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\backup.c
  1143   1252   
  1144   1253   bitvec.lo:	$(TOP)\src\bitvec.c $(HDR)
  1145         -	$(LTCOMPILE) -c $(TOP)\src\bitvec.c
         1254  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\bitvec.c
  1146   1255   
  1147   1256   btmutex.lo:	$(TOP)\src\btmutex.c $(HDR)
  1148         -	$(LTCOMPILE) -c $(TOP)\src\btmutex.c
         1257  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\btmutex.c
  1149   1258   
  1150   1259   btree.lo:	$(TOP)\src\btree.c $(HDR) $(TOP)\src\pager.h
  1151         -	$(LTCOMPILE) -c $(TOP)\src\btree.c
         1260  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\btree.c
  1152   1261   
  1153   1262   build.lo:	$(TOP)\src\build.c $(HDR)
  1154         -	$(LTCOMPILE) -c $(TOP)\src\build.c
         1263  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\build.c
  1155   1264   
  1156   1265   callback.lo:	$(TOP)\src\callback.c $(HDR)
  1157         -	$(LTCOMPILE) -c $(TOP)\src\callback.c
         1266  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\callback.c
  1158   1267   
  1159   1268   complete.lo:	$(TOP)\src\complete.c $(HDR)
  1160         -	$(LTCOMPILE) -c $(TOP)\src\complete.c
         1269  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\complete.c
  1161   1270   
  1162   1271   ctime.lo:	$(TOP)\src\ctime.c $(HDR)
  1163         -	$(LTCOMPILE) -c $(TOP)\src\ctime.c
         1272  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\ctime.c
  1164   1273   
  1165   1274   date.lo:	$(TOP)\src\date.c $(HDR)
  1166         -	$(LTCOMPILE) -c $(TOP)\src\date.c
         1275  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\date.c
  1167   1276   
  1168   1277   delete.lo:	$(TOP)\src\delete.c $(HDR)
  1169         -	$(LTCOMPILE) -c $(TOP)\src\delete.c
         1278  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\delete.c
  1170   1279   
  1171   1280   expr.lo:	$(TOP)\src\expr.c $(HDR)
  1172         -	$(LTCOMPILE) -c $(TOP)\src\expr.c
         1281  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\expr.c
  1173   1282   
  1174   1283   fault.lo:	$(TOP)\src\fault.c $(HDR)
  1175         -	$(LTCOMPILE) -c $(TOP)\src\fault.c
         1284  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\fault.c
  1176   1285   
  1177   1286   fkey.lo:	$(TOP)\src\fkey.c $(HDR)
  1178         -	$(LTCOMPILE) -c $(TOP)\src\fkey.c
         1287  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\fkey.c
  1179   1288   
  1180   1289   func.lo:	$(TOP)\src\func.c $(HDR)
  1181         -	$(LTCOMPILE) -c $(TOP)\src\func.c
         1290  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\func.c
  1182   1291   
  1183   1292   global.lo:	$(TOP)\src\global.c $(HDR)
  1184         -	$(LTCOMPILE) -c $(TOP)\src\global.c
         1293  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\global.c
  1185   1294   
  1186   1295   hash.lo:	$(TOP)\src\hash.c $(HDR)
  1187         -	$(LTCOMPILE) -c $(TOP)\src\hash.c
         1296  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\hash.c
  1188   1297   
  1189   1298   insert.lo:	$(TOP)\src\insert.c $(HDR)
  1190         -	$(LTCOMPILE) -c $(TOP)\src\insert.c
         1299  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\insert.c
  1191   1300   
  1192   1301   journal.lo:	$(TOP)\src\journal.c $(HDR)
  1193         -	$(LTCOMPILE) -c $(TOP)\src\journal.c
         1302  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\journal.c
  1194   1303   
  1195   1304   legacy.lo:	$(TOP)\src\legacy.c $(HDR)
  1196         -	$(LTCOMPILE) -c $(TOP)\src\legacy.c
         1305  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\legacy.c
  1197   1306   
  1198   1307   loadext.lo:	$(TOP)\src\loadext.c $(HDR)
  1199         -	$(LTCOMPILE) -c $(TOP)\src\loadext.c
         1308  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\loadext.c
  1200   1309   
  1201   1310   main.lo:	$(TOP)\src\main.c $(HDR)
  1202         -	$(LTCOMPILE) -c $(TOP)\src\main.c
         1311  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\main.c
  1203   1312   
  1204   1313   malloc.lo:	$(TOP)\src\malloc.c $(HDR)
  1205         -	$(LTCOMPILE) -c $(TOP)\src\malloc.c
         1314  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\malloc.c
  1206   1315   
  1207   1316   mem0.lo:	$(TOP)\src\mem0.c $(HDR)
  1208         -	$(LTCOMPILE) -c $(TOP)\src\mem0.c
         1317  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem0.c
  1209   1318   
  1210   1319   mem1.lo:	$(TOP)\src\mem1.c $(HDR)
  1211         -	$(LTCOMPILE) -c $(TOP)\src\mem1.c
         1320  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem1.c
  1212   1321   
  1213   1322   mem2.lo:	$(TOP)\src\mem2.c $(HDR)
  1214         -	$(LTCOMPILE) -c $(TOP)\src\mem2.c
         1323  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem2.c
  1215   1324   
  1216   1325   mem3.lo:	$(TOP)\src\mem3.c $(HDR)
  1217         -	$(LTCOMPILE) -c $(TOP)\src\mem3.c
         1326  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem3.c
  1218   1327   
  1219   1328   mem5.lo:	$(TOP)\src\mem5.c $(HDR)
  1220         -	$(LTCOMPILE) -c $(TOP)\src\mem5.c
         1329  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mem5.c
  1221   1330   
  1222   1331   memjournal.lo:	$(TOP)\src\memjournal.c $(HDR)
  1223         -	$(LTCOMPILE) -c $(TOP)\src\memjournal.c
         1332  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\memjournal.c
  1224   1333   
  1225   1334   mutex.lo:	$(TOP)\src\mutex.c $(HDR)
  1226         -	$(LTCOMPILE) -c $(TOP)\src\mutex.c
         1335  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mutex.c
  1227   1336   
  1228   1337   mutex_noop.lo:	$(TOP)\src\mutex_noop.c $(HDR)
  1229         -	$(LTCOMPILE) -c $(TOP)\src\mutex_noop.c
         1338  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mutex_noop.c
  1230   1339   
  1231   1340   mutex_unix.lo:	$(TOP)\src\mutex_unix.c $(HDR)
  1232         -	$(LTCOMPILE) -c $(TOP)\src\mutex_unix.c
         1341  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mutex_unix.c
  1233   1342   
  1234   1343   mutex_w32.lo:	$(TOP)\src\mutex_w32.c $(HDR)
  1235         -	$(LTCOMPILE) -c $(TOP)\src\mutex_w32.c
         1344  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\mutex_w32.c
  1236   1345   
  1237   1346   notify.lo:	$(TOP)\src\notify.c $(HDR)
  1238         -	$(LTCOMPILE) -c $(TOP)\src\notify.c
         1347  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\notify.c
  1239   1348   
  1240   1349   pager.lo:	$(TOP)\src\pager.c $(HDR) $(TOP)\src\pager.h
  1241         -	$(LTCOMPILE) -c $(TOP)\src\pager.c
         1350  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\pager.c
  1242   1351   
  1243   1352   pcache.lo:	$(TOP)\src\pcache.c $(HDR) $(TOP)\src\pcache.h
  1244         -	$(LTCOMPILE) -c $(TOP)\src\pcache.c
         1353  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\pcache.c
  1245   1354   
  1246   1355   pcache1.lo:	$(TOP)\src\pcache1.c $(HDR) $(TOP)\src\pcache.h
  1247         -	$(LTCOMPILE) -c $(TOP)\src\pcache1.c
         1356  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\pcache1.c
  1248   1357   
  1249   1358   os.lo:	$(TOP)\src\os.c $(HDR)
  1250         -	$(LTCOMPILE) -c $(TOP)\src\os.c
         1359  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\os.c
  1251   1360   
  1252   1361   os_unix.lo:	$(TOP)\src\os_unix.c $(HDR)
  1253         -	$(LTCOMPILE) -c $(TOP)\src\os_unix.c
         1362  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\os_unix.c
  1254   1363   
  1255   1364   os_win.lo:	$(TOP)\src\os_win.c $(HDR)
  1256         -	$(LTCOMPILE) -c $(TOP)\src\os_win.c
         1365  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\os_win.c
  1257   1366   
  1258   1367   pragma.lo:	$(TOP)\src\pragma.c $(HDR)
  1259         -	$(LTCOMPILE) -c $(TOP)\src\pragma.c
         1368  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\pragma.c
  1260   1369   
  1261   1370   prepare.lo:	$(TOP)\src\prepare.c $(HDR)
  1262         -	$(LTCOMPILE) -c $(TOP)\src\prepare.c
         1371  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\prepare.c
  1263   1372   
  1264   1373   printf.lo:	$(TOP)\src\printf.c $(HDR)
  1265         -	$(LTCOMPILE) -c $(TOP)\src\printf.c
         1374  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\printf.c
  1266   1375   
  1267   1376   random.lo:	$(TOP)\src\random.c $(HDR)
  1268         -	$(LTCOMPILE) -c $(TOP)\src\random.c
         1377  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\random.c
  1269   1378   
  1270   1379   resolve.lo:	$(TOP)\src\resolve.c $(HDR)
  1271         -	$(LTCOMPILE) -c $(TOP)\src\resolve.c
         1380  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\resolve.c
  1272   1381   
  1273   1382   rowset.lo:	$(TOP)\src\rowset.c $(HDR)
  1274         -	$(LTCOMPILE) -c $(TOP)\src\rowset.c
         1383  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\rowset.c
  1275   1384   
  1276   1385   select.lo:	$(TOP)\src\select.c $(HDR)
  1277         -	$(LTCOMPILE) -c $(TOP)\src\select.c
         1386  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\select.c
  1278   1387   
  1279   1388   status.lo:	$(TOP)\src\status.c $(HDR)
  1280         -	$(LTCOMPILE) -c $(TOP)\src\status.c
         1389  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\status.c
  1281   1390   
  1282   1391   table.lo:	$(TOP)\src\table.c $(HDR)
  1283         -	$(LTCOMPILE) -c $(TOP)\src\table.c
         1392  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\table.c
  1284   1393   
  1285   1394   threads.lo:	$(TOP)\src\threads.c $(HDR)
  1286         -	$(LTCOMPILE) -c $(TOP)\src\threads.c
         1395  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\threads.c
  1287   1396   
  1288   1397   tokenize.lo:	$(TOP)\src\tokenize.c keywordhash.h $(HDR)
  1289         -	$(LTCOMPILE) -c $(TOP)\src\tokenize.c
         1398  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\tokenize.c
  1290   1399   
  1291   1400   trigger.lo:	$(TOP)\src\trigger.c $(HDR)
  1292         -	$(LTCOMPILE) -c $(TOP)\src\trigger.c
         1401  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\trigger.c
  1293   1402   
  1294   1403   update.lo:	$(TOP)\src\update.c $(HDR)
  1295         -	$(LTCOMPILE) -c $(TOP)\src\update.c
         1404  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\update.c
  1296   1405   
  1297   1406   utf.lo:	$(TOP)\src\utf.c $(HDR)
  1298         -	$(LTCOMPILE) -c $(TOP)\src\utf.c
         1407  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\utf.c
  1299   1408   
  1300   1409   util.lo:	$(TOP)\src\util.c $(HDR)
  1301         -	$(LTCOMPILE) -c $(TOP)\src\util.c
         1410  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\util.c
  1302   1411   
  1303   1412   vacuum.lo:	$(TOP)\src\vacuum.c $(HDR)
  1304         -	$(LTCOMPILE) -c $(TOP)\src\vacuum.c
         1413  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vacuum.c
  1305   1414   
  1306   1415   vdbe.lo:	$(TOP)\src\vdbe.c $(HDR)
  1307         -	$(LTCOMPILE) -c $(TOP)\src\vdbe.c
         1416  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbe.c
  1308   1417   
  1309   1418   vdbeapi.lo:	$(TOP)\src\vdbeapi.c $(HDR)
  1310         -	$(LTCOMPILE) -c $(TOP)\src\vdbeapi.c
         1419  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbeapi.c
  1311   1420   
  1312   1421   vdbeaux.lo:	$(TOP)\src\vdbeaux.c $(HDR)
  1313         -	$(LTCOMPILE) -c $(TOP)\src\vdbeaux.c
         1422  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbeaux.c
  1314   1423   
  1315   1424   vdbeblob.lo:	$(TOP)\src\vdbeblob.c $(HDR)
  1316         -	$(LTCOMPILE) -c $(TOP)\src\vdbeblob.c
         1425  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbeblob.c
  1317   1426   
  1318   1427   vdbemem.lo:	$(TOP)\src\vdbemem.c $(HDR)
  1319         -	$(LTCOMPILE) -c $(TOP)\src\vdbemem.c
         1428  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbemem.c
  1320   1429   
  1321   1430   vdbesort.lo:	$(TOP)\src\vdbesort.c $(HDR)
  1322         -	$(LTCOMPILE) -c $(TOP)\src\vdbesort.c
         1431  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbesort.c
  1323   1432   
  1324   1433   vdbetrace.lo:	$(TOP)\src\vdbetrace.c $(HDR)
  1325         -	$(LTCOMPILE) -c $(TOP)\src\vdbetrace.c
         1434  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vdbetrace.c
  1326   1435   
  1327   1436   vtab.lo:	$(TOP)\src\vtab.c $(HDR)
  1328         -	$(LTCOMPILE) -c $(TOP)\src\vtab.c
         1437  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\vtab.c
  1329   1438   
  1330   1439   wal.lo:	$(TOP)\src\wal.c $(HDR)
  1331         -	$(LTCOMPILE) -c $(TOP)\src\wal.c
         1440  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\wal.c
  1332   1441   
  1333   1442   walker.lo:	$(TOP)\src\walker.c $(HDR)
  1334         -	$(LTCOMPILE) -c $(TOP)\src\walker.c
         1443  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\walker.c
  1335   1444   
  1336   1445   where.lo:	$(TOP)\src\where.c $(HDR)
  1337         -	$(LTCOMPILE) -c $(TOP)\src\where.c
         1446  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\where.c
  1338   1447   
  1339   1448   tclsqlite.lo:	$(TOP)\src\tclsqlite.c $(HDR)
  1340         -	$(LTCOMPILE) -DUSE_TCL_STUBS=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
         1449  +	$(LTCOMPILE) $(NO_WARN) -DUSE_TCL_STUBS=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
  1341   1450   
  1342   1451   tclsqlite-shell.lo:	$(TOP)\src\tclsqlite.c $(HDR)
  1343         -	$(LTCOMPILE) -DTCLSH=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
         1452  +	$(LTCOMPILE) $(NO_WARN) -DTCLSH=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
  1344   1453   
  1345         -tclsqlite3.exe:	tclsqlite-shell.lo libsqlite3.lib $(LIBRESOBJS)
  1346         -	$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /OUT:$@ libsqlite3.lib tclsqlite-shell.lo $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
         1454  +tclsqlite3.exe:	tclsqlite-shell.lo $(SQLITE3C) $(LIBRESOBJS)
         1455  +	$(LTLINK) $(SQLITE3C) /link $(LTLINKOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite-shell.lo $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
  1347   1456   
  1348   1457   # Rules to build opcodes.c and opcodes.h
  1349   1458   #
  1350   1459   opcodes.c:	opcodes.h $(TOP)\mkopcodec.awk
  1351   1460   	$(NAWK) -f $(TOP)\mkopcodec.awk opcodes.h > opcodes.c
  1352   1461   
  1353   1462   opcodes.h:	parse.h $(TOP)\src\vdbe.c $(TOP)\mkopcodeh.awk
................................................................................
  1354   1463   	type parse.h $(TOP)\src\vdbe.c | $(NAWK) -f $(TOP)\mkopcodeh.awk > opcodes.h
  1355   1464   
  1356   1465   # Rules to build parse.c and parse.h - the outputs of lemon.
  1357   1466   #
  1358   1467   parse.h:	parse.c
  1359   1468   
  1360   1469   parse.c:	$(TOP)\src\parse.y lemon.exe $(TOP)\addopcodes.awk
  1361         -	del /Q parse.y parse.h parse.h.temp
         1470  +	del /Q parse.y parse.h parse.h.temp 2>NUL
  1362   1471   	copy $(TOP)\src\parse.y .
  1363   1472   	.\lemon.exe $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(OPTS) parse.y
  1364   1473   	move parse.h parse.h.temp
  1365   1474   	$(NAWK) -f $(TOP)\addopcodes.awk parse.h.temp > parse.h
  1366   1475   
  1367   1476   sqlite3.h:	$(TOP)\src\sqlite.h.in $(TOP)\manifest.uuid $(TOP)\VERSION
  1368   1477   	$(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP:\=/) > sqlite3.h
................................................................................
  1375   1484   	.\mkkeywordhash.exe > keywordhash.h
  1376   1485   
  1377   1486   
  1378   1487   
  1379   1488   # Rules to build the extension objects.
  1380   1489   #
  1381   1490   icu.lo:	$(TOP)\ext\icu\icu.c $(HDR) $(EXTHDR)
  1382         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\icu\icu.c
         1491  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\icu\icu.c
  1383   1492   
  1384   1493   fts2.lo:	$(TOP)\ext\fts2\fts2.c $(HDR) $(EXTHDR)
  1385         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2.c
         1494  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2.c
  1386   1495   
  1387   1496   fts2_hash.lo:	$(TOP)\ext\fts2\fts2_hash.c $(HDR) $(EXTHDR)
  1388         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_hash.c
         1497  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_hash.c
  1389   1498   
  1390   1499   fts2_icu.lo:	$(TOP)\ext\fts2\fts2_icu.c $(HDR) $(EXTHDR)
  1391         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_icu.c
         1500  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_icu.c
  1392   1501   
  1393   1502   fts2_porter.lo:	$(TOP)\ext\fts2\fts2_porter.c $(HDR) $(EXTHDR)
  1394         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_porter.c
         1503  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_porter.c
  1395   1504   
  1396   1505   fts2_tokenizer.lo:	$(TOP)\ext\fts2\fts2_tokenizer.c $(HDR) $(EXTHDR)
  1397         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_tokenizer.c
         1506  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_tokenizer.c
  1398   1507   
  1399   1508   fts2_tokenizer1.lo:	$(TOP)\ext\fts2\fts2_tokenizer1.c $(HDR) $(EXTHDR)
  1400         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_tokenizer1.c
         1509  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts2\fts2_tokenizer1.c
  1401   1510   
  1402   1511   fts3.lo:	$(TOP)\ext\fts3\fts3.c $(HDR) $(EXTHDR)
  1403         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3.c
         1512  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3.c
  1404   1513   
  1405   1514   fts3_aux.lo:	$(TOP)\ext\fts3\fts3_aux.c $(HDR) $(EXTHDR)
  1406         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_aux.c
         1515  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_aux.c
  1407   1516   
  1408   1517   fts3_expr.lo:	$(TOP)\ext\fts3\fts3_expr.c $(HDR) $(EXTHDR)
  1409         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_expr.c
         1518  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_expr.c
  1410   1519   
  1411   1520   fts3_hash.lo:	$(TOP)\ext\fts3\fts3_hash.c $(HDR) $(EXTHDR)
  1412         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_hash.c
         1521  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_hash.c
  1413   1522   
  1414   1523   fts3_icu.lo:	$(TOP)\ext\fts3\fts3_icu.c $(HDR) $(EXTHDR)
  1415         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_icu.c
         1524  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_icu.c
  1416   1525   
  1417   1526   fts3_snippet.lo:	$(TOP)\ext\fts3\fts3_snippet.c $(HDR) $(EXTHDR)
  1418         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_snippet.c
         1527  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_snippet.c
  1419   1528   
  1420   1529   fts3_porter.lo:	$(TOP)\ext\fts3\fts3_porter.c $(HDR) $(EXTHDR)
  1421         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_porter.c
         1530  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_porter.c
  1422   1531   
  1423   1532   fts3_tokenizer.lo:	$(TOP)\ext\fts3\fts3_tokenizer.c $(HDR) $(EXTHDR)
  1424         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenizer.c
         1533  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenizer.c
  1425   1534   
  1426   1535   fts3_tokenizer1.lo:	$(TOP)\ext\fts3\fts3_tokenizer1.c $(HDR) $(EXTHDR)
  1427         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenizer1.c
         1536  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenizer1.c
  1428   1537   
  1429   1538   fts3_tokenize_vtab.lo:	$(TOP)\ext\fts3\fts3_tokenize_vtab.c $(HDR) $(EXTHDR)
  1430         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenize_vtab.c
         1539  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_tokenize_vtab.c
  1431   1540   
  1432   1541   fts3_unicode.lo:	$(TOP)\ext\fts3\fts3_unicode.c $(HDR) $(EXTHDR)
  1433         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_unicode.c
         1542  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_unicode.c
  1434   1543   
  1435   1544   fts3_unicode2.lo:	$(TOP)\ext\fts3\fts3_unicode2.c $(HDR) $(EXTHDR)
  1436         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_unicode2.c
         1545  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_unicode2.c
  1437   1546   
  1438   1547   fts3_write.lo:	$(TOP)\ext\fts3\fts3_write.c $(HDR) $(EXTHDR)
  1439         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_write.c
         1548  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_write.c
  1440   1549   
  1441   1550   rtree.lo:	$(TOP)\ext\rtree\rtree.c $(HDR) $(EXTHDR)
  1442         -	$(LTCOMPILE) -DSQLITE_CORE -c $(TOP)\ext\rtree\rtree.c
         1551  +	$(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\rtree\rtree.c
  1443   1552   
  1444   1553   
  1445   1554   # Rules to build the 'testfixture' application.
  1446   1555   #
  1447   1556   # If using the amalgamation, use sqlite3.c directly to build the test
  1448   1557   # fixture.  Otherwise link against libsqlite3.lib.  (This distinction is
  1449   1558   # necessary because the test fixture requires non-API symbols which are
  1450   1559   # hidden when the library is built via the amalgamation).
  1451   1560   #
  1452   1561   TESTFIXTURE_FLAGS = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
  1453   1562   TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_SERVER=1 -DSQLITE_PRIVATE=""
  1454   1563   TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CORE $(NO_WARN)
  1455   1564   
  1456         -TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2) libsqlite3.lib
         1565  +TESTFIXTURE_SRC0 = $(TESTEXT) $(TESTSRC2) $(SHELL_CORE_DEP)
  1457   1566   TESTFIXTURE_SRC1 = $(TESTEXT) $(SQLITE3C)
  1458   1567   !IF $(USE_AMALGAMATION)==0
  1459   1568   TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC0)
  1460   1569   !ELSE
  1461   1570   TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC1)
  1462   1571   !ENDIF
  1463   1572   
................................................................................
  1489   1598   	copy $(SQLITE3C) + $(TOP)\src\test_stat.c + $(TOP)\src\tclsqlite.c $@
  1490   1599   	echo static const char *tclsh_main_loop(void){ >> $@
  1491   1600   	echo static const char *zMainloop = >> $@
  1492   1601   	$(NAWK) -f $(TOP)\tool\tostr.awk $(TOP)\tool\spaceanal.tcl >> $@
  1493   1602   	echo ; return zMainloop; } >> $@
  1494   1603   
  1495   1604   sqlite3_analyzer.exe:	sqlite3_analyzer.c $(LIBRESOBJS)
  1496         -	$(LTLINK) -DBUILD_sqlite -DTCLSH=2 -I$(TCLINCDIR) sqlite3_analyzer.c \
         1605  +	$(LTLINK) $(NO_WARN) -DBUILD_sqlite -DTCLSH=2 -I$(TCLINCDIR) sqlite3_analyzer.c \
  1497   1606   		/link $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
  1498   1607   
  1499   1608   testloadext.lo:	$(TOP)\src\test_loadext.c
  1500         -	$(LTCOMPILE) -c $(TOP)\src\test_loadext.c
         1609  +	$(LTCOMPILE) $(NO_WARN) -c $(TOP)\src\test_loadext.c
  1501   1610   
  1502   1611   testloadext.dll: testloadext.lo
  1503   1612   	$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /OUT:$@ testloadext.lo
  1504   1613   
  1505   1614   showdb.exe:	$(TOP)\tool\showdb.c $(SQLITE3C)
  1506         -	$(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
         1615  +	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
  1507   1616   		$(TOP)\tool\showdb.c $(SQLITE3C)
  1508   1617   
  1509   1618   showstat4.exe:	$(TOP)\tool\showstat4.c $(SQLITE3C)
  1510         -	$(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
         1619  +	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
  1511   1620   		$(TOP)\tool\showstat4.c $(SQLITE3C)
  1512   1621   
  1513   1622   showjournal.exe:	$(TOP)\tool\showjournal.c $(SQLITE3C)
  1514         -	$(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
         1623  +	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
  1515   1624   		$(TOP)\tool\showjournal.c $(SQLITE3C)
  1516   1625   
  1517   1626   showwal.exe:	$(TOP)\tool\showwal.c $(SQLITE3C)
  1518         -	$(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
         1627  +	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
  1519   1628   		$(TOP)\tool\showwal.c $(SQLITE3C)
  1520   1629   
  1521   1630   fts3view.exe:	$(TOP)\ext\fts3\tool\fts3view.c $(SQLITE3C)
  1522         -	$(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
         1631  +	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
  1523   1632   		$(TOP)\ext\fts3\tool\fts3view.c $(SQLITE3C)
  1524   1633   
  1525   1634   rollback-test.exe:	$(TOP)\tool\rollback-test.c $(SQLITE3C)
  1526         -	$(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
         1635  +	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
  1527   1636   		$(TOP)\tool\rollback-test.c $(SQLITE3C)
  1528   1637   
  1529   1638   LogEst.exe:	$(TOP)\tool\logest.c sqlite3.h
  1530         -	$(LTLINK) -Fe$@ $(TOP)\tool\LogEst.c
         1639  +	$(LTLINK) $(NO_WARN) -Fe$@ $(TOP)\tool\LogEst.c
  1531   1640   
  1532   1641   wordcount.exe:	$(TOP)\test\wordcount.c $(SQLITE3C)
  1533         -	$(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
         1642  +	$(LTLINK) $(NO_WARN) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
  1534   1643   		$(TOP)\test\wordcount.c $(SQLITE3C)
  1535   1644   
  1536   1645   speedtest1.exe:	$(TOP)\test\speedtest1.c $(SQLITE3C)
  1537         -	$(LTLINK) -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
         1646  +	$(LTLINK) $(NO_WARN) -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \
  1538   1647   		$(TOP)\test\speedtest1.c $(SQLITE3C)
  1539   1648   
  1540   1649   clean:
  1541         -	del /Q *.lo *.ilk *.lib *.obj *.pdb sqlite3.exe libsqlite3.lib 2>NUL
         1650  +	del /Q *.exp *.lo *.ilk *.lib *.obj *.pdb 2>NUL
  1542   1651   	del /Q *.cod *.da *.bb *.bbg gmon.out 2>NUL
  1543   1652   	del /Q sqlite3.h opcodes.c opcodes.h 2>NUL
  1544   1653   	del /Q lemon.* lempar.c parse.* 2>NUL
  1545   1654   	del /Q mkkeywordhash.* keywordhash.h 2>NUL
  1546   1655   	del /Q notasharedlib.* 2>NUL
  1547   1656   	-rmdir /Q/S .deps 2>NUL
  1548   1657   	-rmdir /Q/S .libs 2>NUL
  1549   1658   	-rmdir /Q/S quota2a 2>NUL
  1550   1659   	-rmdir /Q/S quota2b 2>NUL
  1551   1660   	-rmdir /Q/S quota2c 2>NUL
  1552   1661   	-rmdir /Q/S tsrc 2>NUL
  1553   1662   	del /Q .target_source 2>NUL
  1554         -	del /Q tclsqlite3.exe tclsqlite3.exp 2>NUL
  1555         -	del /Q testloadext.dll testloadext.exp 2>NUL
  1556         -	del /Q testfixture.exe testfixture.exp test.db 2>NUL
         1663  +	del /Q tclsqlite3.exe 2>NUL
         1664  +	del /Q testloadext.dll 2>NUL
         1665  +	del /Q testfixture.exe test.db 2>NUL
  1557   1666   	del /Q LogEst.exe fts3view.exe rollback-test.exe showdb.exe 2>NUL
  1558   1667   	del /Q showjournal.exe showstat4.exe showwal.exe speedtest1.exe 2>NUL
  1559         -	del /Q wordcount.exe 2>NUL
  1560         -	del /Q sqlite3.dll sqlite3.lib sqlite3.exp sqlite3.def 2>NUL
         1668  +	del /Q mptester.exe wordcount.exe 2>NUL
         1669  +	del /Q sqlite3.exe sqlite3.dll sqlite3.def 2>NUL
  1561   1670   	del /Q sqlite3.c sqlite3-*.c 2>NUL
  1562   1671   	del /Q sqlite3rc.h 2>NUL
  1563   1672   	del /Q shell.c sqlite3ext.h 2>NUL
  1564         -	del /Q sqlite3_analyzer.exe sqlite3_analyzer.exp sqlite3_analyzer.c 2>NUL
         1673  +	del /Q sqlite3_analyzer.exe sqlite3_analyzer.c 2>NUL
  1565   1674   	del /Q sqlite-*-output.vsix 2>NUL
  1566         -	del /Q mptester.exe 2>NUL
  1567   1675   
  1568   1676   # Dynamic link library section.
  1569   1677   #
  1570   1678   dll: sqlite3.dll
  1571   1679   
  1572   1680   sqlite3.def: libsqlite3.lib
  1573   1681   	echo EXPORTS > sqlite3.def
  1574   1682   	dumpbin /all libsqlite3.lib \
  1575   1683   		| $(NAWK) "/ 1 _?sqlite3_/ { sub(/^.* _?/,\"\");print }" \
  1576   1684   		| sort >> sqlite3.def
  1577   1685   
  1578         -sqlite3.dll: $(LIBOBJ) $(LIBRESOBJS) sqlite3.def
  1579         -	$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /DEF:sqlite3.def /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
         1686  +sqlite3.dll: $(LIBOBJ) $(LIBRESOBJS) $(CORE_LINK_DEP)
         1687  +	$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL $(CORE_LINK_OPTS) /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)

Changes to ext/fts3/fts3.c.

   906    906   **
   907    907   ** If *pp does not being with a decimal digit SQLITE_ERROR is returned and
   908    908   ** the output value undefined. Otherwise SQLITE_OK is returned.
   909    909   **
   910    910   ** This function is used when parsing the "prefix=" FTS4 parameter.
   911    911   */
   912    912   static int fts3GobbleInt(const char **pp, int *pnOut){
          913  +  const MAX_NPREFIX = 10000000;
   913    914     const char *p;                  /* Iterator pointer */
   914    915     int nInt = 0;                   /* Output value */
   915    916   
   916    917     for(p=*pp; p[0]>='0' && p[0]<='9'; p++){
   917    918       nInt = nInt * 10 + (p[0] - '0');
          919  +    if( nInt>MAX_NPREFIX ){
          920  +      nInt = 0;
          921  +      break;
          922  +    }
   918    923     }
   919    924     if( p==*pp ) return SQLITE_ERROR;
   920    925     *pnOut = nInt;
   921    926     *pp = p;
   922    927     return SQLITE_OK;
   923    928   }
   924    929   
................................................................................
   953    958       for(p=zParam; *p; p++){
   954    959         if( *p==',' ) nIndex++;
   955    960       }
   956    961     }
   957    962   
   958    963     aIndex = sqlite3_malloc(sizeof(struct Fts3Index) * nIndex);
   959    964     *apIndex = aIndex;
   960         -  *pnIndex = nIndex;
   961    965     if( !aIndex ){
   962    966       return SQLITE_NOMEM;
   963    967     }
   964    968   
   965    969     memset(aIndex, 0, sizeof(struct Fts3Index) * nIndex);
   966    970     if( zParam ){
   967    971       const char *p = zParam;
   968    972       int i;
   969    973       for(i=1; i<nIndex; i++){
   970         -      int nPrefix;
          974  +      int nPrefix = 0;
   971    975         if( fts3GobbleInt(&p, &nPrefix) ) return SQLITE_ERROR;
   972         -      aIndex[i].nPrefix = nPrefix;
          976  +      assert( nPrefix>=0 );
          977  +      if( nPrefix==0 ){
          978  +        nIndex--;
          979  +        i--;
          980  +      }else{
          981  +        aIndex[i].nPrefix = nPrefix;
          982  +      }
   973    983         p++;
   974    984       }
   975    985     }
   976    986   
          987  +  *pnIndex = nIndex;
   977    988     return SQLITE_OK;
   978    989   }
   979    990   
   980    991   /*
   981    992   ** This function is called when initializing an FTS4 table that uses the
   982    993   ** content=xxx option. It determines the number of and names of the columns
   983    994   ** of the new FTS4 table.

Changes to ext/fts3/fts3_tokenizer.c.

   157    157     sqlite3_tokenizer_module *m;
   158    158   
   159    159     zCopy = sqlite3_mprintf("%s", zArg);
   160    160     if( !zCopy ) return SQLITE_NOMEM;
   161    161     zEnd = &zCopy[strlen(zCopy)];
   162    162   
   163    163     z = (char *)sqlite3Fts3NextToken(zCopy, &n);
          164  +  if( z==0 ){
          165  +    assert( n==0 );
          166  +    z = zCopy;
          167  +  }
   164    168     z[n] = '\0';
   165    169     sqlite3Fts3Dequote(z);
   166    170   
   167    171     m = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash,z,(int)strlen(z)+1);
   168    172     if( !m ){
   169    173       *pzErr = sqlite3_mprintf("unknown tokenizer: %s", z);
   170    174       rc = SQLITE_ERROR;

Changes to ext/fts3/fts3_write.c.

  1621   1621   }
  1622   1622   
  1623   1623   /*
  1624   1624   ** This is a comparison function used as a qsort() callback when sorting
  1625   1625   ** an array of pending terms by term. This occurs as part of flushing
  1626   1626   ** the contents of the pending-terms hash table to the database.
  1627   1627   */
  1628         -static int fts3CompareElemByTerm(const void *lhs, const void *rhs){
         1628  +static int SQLITE_CDECL fts3CompareElemByTerm(
         1629  +  const void *lhs,
         1630  +  const void *rhs
         1631  +){
  1629   1632     char *z1 = fts3HashKey(*(Fts3HashElem **)lhs);
  1630   1633     char *z2 = fts3HashKey(*(Fts3HashElem **)rhs);
  1631   1634     int n1 = fts3HashKeysize(*(Fts3HashElem **)lhs);
  1632   1635     int n2 = fts3HashKeysize(*(Fts3HashElem **)rhs);
  1633   1636   
  1634   1637     int n = (n1<n2 ? n1 : n2);
  1635   1638     int c = memcmp(z1, z2, n);

Changes to ext/fts3/tool/fts3view.c.

   500    500         }else{
   501    501           printf("         idx %2d", iIdx);
   502    502         }
   503    503         sqlite3_snprintf(sizeof(rtag), rtag, "r%lld",
   504    504                          sqlite3_column_int64(pStmt,5));
   505    505         printf("  root   %9s\n", rtag);
   506    506         if( iLEnd>iStart ){
   507         -        sqlite3_int64 iLower, iPrev, iX;
          507  +        sqlite3_int64 iLower, iPrev = 0, iX;
   508    508           if( iLEnd+1<=iEnd ){
   509    509             sqlite3_bind_int64(pStmt2, 1, iLEnd+1);
   510    510             sqlite3_bind_int64(pStmt2, 2, iEnd);
   511    511             iLower = -1;        
   512    512             while( sqlite3_step(pStmt2)==SQLITE_ROW ){
   513    513               iX = sqlite3_column_int64(pStmt2, 0);
   514    514               if( iLower<0 ){
................................................................................
   544    544   /*
   545    545   ** Decode a single segment block and display the results on stdout.
   546    546   */
   547    547   static void decodeSegment(
   548    548     const unsigned char *aData,   /* Content to print */
   549    549     int nData                     /* Number of bytes of content */
   550    550   ){
   551         -  sqlite3_int64 iChild;
          551  +  sqlite3_int64 iChild = 0;
   552    552     sqlite3_int64 iPrefix;
   553    553     sqlite3_int64 nTerm;
   554    554     sqlite3_int64 n;
   555    555     sqlite3_int64 iDocsz;
   556    556     int iHeight;
   557    557     sqlite3_int64 i = 0;
   558    558     int cnt = 0;

Changes to mptest/mptest.c.

  1248   1248     for(i=0; i<nArg; i++){
  1249   1249       fprintf(stderr," %s", azArg[i]);
  1250   1250     }
  1251   1251     fprintf(stderr,"\n");
  1252   1252     exit(1);
  1253   1253   }
  1254   1254   
  1255         -int main(int argc, char **argv){
         1255  +int SQLITE_CDECL main(int argc, char **argv){
  1256   1256     const char *zClient;
  1257   1257     int iClient;
  1258   1258     int n, i;
  1259   1259     int openFlags = SQLITE_OPEN_READWRITE;
  1260   1260     int rc;
  1261   1261     char *zScript;
  1262   1262     int taskId;

Changes to src/btmutex.c.

   137    137   }
   138    138   
   139    139   
   140    140   /*
   141    141   ** Exit the recursive mutex on a Btree.
   142    142   */
   143    143   void sqlite3BtreeLeave(Btree *p){
          144  +  assert( sqlite3_mutex_held(p->db->mutex) );
   144    145     if( p->sharable ){
   145    146       assert( p->wantToLock>0 );
   146    147       p->wantToLock--;
   147    148       if( p->wantToLock==0 ){
   148    149         unlockBtreeMutex(p);
   149    150       }
   150    151     }

Changes to src/btree.c.

  7503   7503             ** different page). Once this subsequent call to balance_nonroot() 
  7504   7504             ** has completed, it is safe to release the pSpace buffer used by
  7505   7505             ** the previous call, as the overflow cell data will have been 
  7506   7506             ** copied either into the body of a database page or into the new
  7507   7507             ** pSpace buffer passed to the latter call to balance_nonroot().
  7508   7508             */
  7509   7509             u8 *pSpace = sqlite3PageMalloc(pCur->pBt->pageSize);
  7510         -          rc = balance_nonroot(pParent, iIdx, pSpace, iPage==1, pCur->hints);
         7510  +          rc = balance_nonroot(pParent, iIdx, pSpace, iPage==1,
         7511  +                               pCur->hints&BTREE_BULKLOAD);
  7511   7512             if( pFree ){
  7512   7513               /* If pFree is not NULL, it points to the pSpace buffer used 
  7513   7514               ** by a previous call to balance_nonroot(). Its contents are
  7514   7515               ** now stored either on real database pages or within the 
  7515   7516               ** new pSpace buffer, so it may be safely freed here. */
  7516   7517               sqlite3PageFree(pFree);
  7517   7518             }
................................................................................
  9166   9167     }
  9167   9168   
  9168   9169     pBt->btsFlags &= ~BTS_NO_WAL;
  9169   9170     return rc;
  9170   9171   }
  9171   9172   
  9172   9173   /*
  9173         -** set the mask of hint flags for cursor pCsr. Currently the only valid
  9174         -** values are 0 and BTREE_BULKLOAD.
         9174  +** set the mask of hint flags for cursor pCsr.
  9175   9175   */
  9176   9176   void sqlite3BtreeCursorHints(BtCursor *pCsr, unsigned int mask){
  9177         -  assert( mask==BTREE_BULKLOAD || mask==0 );
         9177  +  assert( mask==BTREE_BULKLOAD || mask==BTREE_SEEK_EQ || mask==0 );
  9178   9178     pCsr->hints = mask;
  9179   9179   }
         9180  +
         9181  +#ifdef SQLITE_DEBUG
         9182  +/*
         9183  +** Return true if the cursor has a hint specified.  This routine is
         9184  +** only used from within assert() statements
         9185  +*/
         9186  +int sqlite3BtreeCursorHasHint(BtCursor *pCsr, unsigned int mask){
         9187  +  return (pCsr->hints & mask)!=0;
         9188  +}
         9189  +#endif
  9180   9190   
  9181   9191   /*
  9182   9192   ** Return true if the given Btree is read-only.
  9183   9193   */
  9184   9194   int sqlite3BtreeIsReadonly(Btree *p){
  9185   9195     return (p->pBt->btsFlags & BTS_READ_ONLY)!=0;
  9186   9196   }
  9187   9197   
  9188   9198   /*
  9189   9199   ** Return the size of the header added to each page by this module.
  9190   9200   */
  9191   9201   int sqlite3HeaderSizeBtree(void){ return ROUND8(sizeof(MemPage)); }

Changes to src/btree.h.

   148    148   #define BTREE_INCR_VACUUM         7
   149    149   #define BTREE_APPLICATION_ID      8
   150    150   #define BTREE_DATA_VERSION        15  /* A virtual meta-value */
   151    151   
   152    152   /*
   153    153   ** Values that may be OR'd together to form the second argument of an
   154    154   ** sqlite3BtreeCursorHints() call.
          155  +**
          156  +** The BTREE_BULKLOAD flag is set on index cursors when the index is going
          157  +** to be filled with content that is already in sorted order.
          158  +**
          159  +** The BTREE_SEEK_EQ flag is set on cursors that will get OP_SeekGE or
          160  +** OP_SeekLE opcodes for a range search, but where the range of entries
          161  +** selected will all have the same key.  In other words, the cursor will
          162  +** be used only for equality key searches.
          163  +**
   155    164   */
   156         -#define BTREE_BULKLOAD 0x00000001
          165  +#define BTREE_BULKLOAD 0x00000001  /* Used to full index in sorted order */
          166  +#define BTREE_SEEK_EQ  0x00000002  /* EQ seeks only - no range seeks */
   157    167   
   158    168   int sqlite3BtreeCursor(
   159    169     Btree*,                              /* BTree containing table to open */
   160    170     int iTable,                          /* Index of root page */
   161    171     int wrFlag,                          /* 1 for writing.  0 for read-only */
   162    172     struct KeyInfo*,                     /* First argument to compare function */
   163    173     BtCursor *pCursor                    /* Space to write cursor structure */
................................................................................
   195    205   struct Pager *sqlite3BtreePager(Btree*);
   196    206   
   197    207   int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*);
   198    208   void sqlite3BtreeIncrblobCursor(BtCursor *);
   199    209   void sqlite3BtreeClearCursor(BtCursor *);
   200    210   int sqlite3BtreeSetVersion(Btree *pBt, int iVersion);
   201    211   void sqlite3BtreeCursorHints(BtCursor *, unsigned int mask);
          212  +#ifdef SQLITE_DEBUG
          213  +int sqlite3BtreeCursorHasHint(BtCursor*, unsigned int mask);
          214  +#endif
   202    215   int sqlite3BtreeIsReadonly(Btree *pBt);
   203    216   int sqlite3HeaderSizeBtree(void);
   204    217   
   205    218   #ifndef NDEBUG
   206    219   int sqlite3BtreeCursorIsValid(BtCursor*);
   207    220   #endif
   208    221   

Changes to src/build.c.

  3179   3179               sqlite3ErrorMsg(pParse, 
  3180   3180                   "conflicting ON CONFLICT clauses specified", 0);
  3181   3181             }
  3182   3182             if( pIdx->onError==OE_Default ){
  3183   3183               pIdx->onError = pIndex->onError;
  3184   3184             }
  3185   3185           }
         3186  +        pRet = pIdx;
  3186   3187           goto exit_create_index;
  3187   3188         }
  3188   3189       }
  3189   3190     }
  3190   3191   
  3191   3192     /* Link the new Index structure to its table and to the other
  3192   3193     ** in-memory database structures. 

Changes to src/expr.c.

    65     65   **
    66     66   ** If a memory allocation error occurs, that fact is recorded in pParse->db
    67     67   ** and the pExpr parameter is returned unchanged.
    68     68   */
    69     69   Expr *sqlite3ExprAddCollateToken(
    70     70     Parse *pParse,           /* Parsing context */
    71     71     Expr *pExpr,             /* Add the "COLLATE" clause to this expression */
    72         -  const Token *pCollName   /* Name of collating sequence */
           72  +  const Token *pCollName,  /* Name of collating sequence */
           73  +  int dequote              /* True to dequote pCollName */
    73     74   ){
    74     75     if( pCollName->n>0 ){
    75         -    Expr *pNew = sqlite3ExprAlloc(pParse->db, TK_COLLATE, pCollName, 1);
           76  +    Expr *pNew = sqlite3ExprAlloc(pParse->db, TK_COLLATE, pCollName, dequote);
    76     77       if( pNew ){
    77     78         pNew->pLeft = pExpr;
    78     79         pNew->flags |= EP_Collate|EP_Skip;
    79     80         pExpr = pNew;
    80     81       }
    81     82     }
    82     83     return pExpr;
    83     84   }
    84     85   Expr *sqlite3ExprAddCollateString(Parse *pParse, Expr *pExpr, const char *zC){
    85     86     Token s;
    86     87     assert( zC!=0 );
    87     88     s.z = zC;
    88     89     s.n = sqlite3Strlen30(s.z);
    89         -  return sqlite3ExprAddCollateToken(pParse, pExpr, &s);
           90  +  return sqlite3ExprAddCollateToken(pParse, pExpr, &s, 0);
    90     91   }
    91     92   
    92     93   /*
    93     94   ** Skip over any TK_COLLATE or TK_AS operators and any unlikely()
    94     95   ** or likelihood() function at the root of an expression.
    95     96   */
    96     97   Expr *sqlite3ExprSkipCollate(Expr *pExpr){

Changes to src/os_unix.c.

  4486   4486   
  4487   4487   /*
  4488   4488   ** Information and control of an open file handle.
  4489   4489   */
  4490   4490   static int unixFileControl(sqlite3_file *id, int op, void *pArg){
  4491   4491     unixFile *pFile = (unixFile*)id;
  4492   4492     switch( op ){
         4493  +    case SQLITE_FCNTL_WAL_BLOCK: {
         4494  +      pFile->ctrlFlags |= UNIXFILE_BLOCK;
         4495  +      return SQLITE_OK;
         4496  +    }
  4493   4497       case SQLITE_FCNTL_LOCKSTATE: {
  4494   4498         *(int*)pArg = pFile->eFileLock;
  4495   4499         return SQLITE_OK;
  4496   4500       }
  4497   4501       case SQLITE_FCNTL_LAST_ERRNO: {
  4498   4502         *(int*)pArg = pFile->lastErrno;
  4499   4503         return SQLITE_OK;
................................................................................
  8474   8478   
  8475   8479   /*
  8476   8480   ** This routine handles sqlite3_file_control() calls that are specific
  8477   8481   ** to proxy locking.
  8478   8482   */
  8479   8483   static int proxyFileControl(sqlite3_file *id, int op, void *pArg){
  8480   8484     switch( op ){
  8481         -    case SQLITE_FCNTL_WAL_BLOCK: {
  8482         -      id->ctrlFlags |= UNIXFILE_BLOCK;
  8483         -      return SQLITE_OK;
  8484         -    }
  8485   8485       case SQLITE_FCNTL_GET_LOCKPROXYFILE: {
  8486   8486         unixFile *pFile = (unixFile*)id;
  8487   8487         if( isProxyLockingMode(pFile) ){
  8488   8488           proxyLockingContext *pCtx = (proxyLockingContext*)pFile->lockingContext;
  8489   8489           proxyTakeConch(pFile);
  8490   8490           if( pCtx->lockProxyPath ){
  8491   8491             *(const char **)pArg = pCtx->lockProxyPath;

Changes to src/parse.y.

   856    856     }else{
   857    857       spanExpr(&A, pParse, TK_VARIABLE, &X);
   858    858       sqlite3ExprAssignVarNumber(pParse, A.pExpr);
   859    859     }
   860    860     spanSet(&A, &X, &X);
   861    861   }
   862    862   expr(A) ::= expr(E) COLLATE ids(C). {
   863         -  A.pExpr = sqlite3ExprAddCollateToken(pParse, E.pExpr, &C);
          863  +  A.pExpr = sqlite3ExprAddCollateToken(pParse, E.pExpr, &C, 1);
   864    864     A.zStart = E.zStart;
   865    865     A.zEnd = &C.z[C.n];
   866    866   }
   867    867   %ifndef SQLITE_OMIT_CAST
   868    868   expr(A) ::= CAST(X) LP expr(E) AS typetoken(T) RP(Y). {
   869    869     A.pExpr = sqlite3PExpr(pParse, TK_CAST, E.pExpr, 0, &T);
   870    870     spanSet(&A,&X,&Y);
................................................................................
  1202   1202   %destructor idxlist {sqlite3ExprListDelete(pParse->db, $$);}
  1203   1203   %type idxlist_opt {ExprList*}
  1204   1204   %destructor idxlist_opt {sqlite3ExprListDelete(pParse->db, $$);}
  1205   1205   
  1206   1206   idxlist_opt(A) ::= .                         {A = 0;}
  1207   1207   idxlist_opt(A) ::= LP idxlist(X) RP.         {A = X;}
  1208   1208   idxlist(A) ::= idxlist(X) COMMA nm(Y) collate(C) sortorder(Z).  {
  1209         -  Expr *p = sqlite3ExprAddCollateToken(pParse, 0, &C);
         1209  +  Expr *p = sqlite3ExprAddCollateToken(pParse, 0, &C, 1);
  1210   1210     A = sqlite3ExprListAppend(pParse,X, p);
  1211   1211     sqlite3ExprListSetName(pParse,A,&Y,1);
  1212   1212     sqlite3ExprListCheckLength(pParse, A, "index");
  1213   1213     if( A ) A->a[A->nExpr-1].sortOrder = (u8)Z;
  1214   1214   }
  1215   1215   idxlist(A) ::= nm(Y) collate(C) sortorder(Z). {
  1216         -  Expr *p = sqlite3ExprAddCollateToken(pParse, 0, &C);
         1216  +  Expr *p = sqlite3ExprAddCollateToken(pParse, 0, &C, 1);
  1217   1217     A = sqlite3ExprListAppend(pParse,0, p);
  1218   1218     sqlite3ExprListSetName(pParse, A, &Y, 1);
  1219   1219     sqlite3ExprListCheckLength(pParse, A, "index");
  1220   1220     if( A ) A->a[A->nExpr-1].sortOrder = (u8)Z;
  1221   1221   }
  1222   1222   
  1223   1223   %type collate {Token}

Changes to src/select.c.

  4031   4031       pSavedWith = pParse->pWith;
  4032   4032       pParse->pWith = pWith;
  4033   4033       sqlite3WalkSelect(pWalker, bMayRecursive ? pSel->pPrior : pSel);
  4034   4034   
  4035   4035       for(pLeft=pSel; pLeft->pPrior; pLeft=pLeft->pPrior);
  4036   4036       pEList = pLeft->pEList;
  4037   4037       if( pCte->pCols ){
  4038         -      if( pEList->nExpr!=pCte->pCols->nExpr ){
         4038  +      if( pEList && pEList->nExpr!=pCte->pCols->nExpr ){
  4039   4039           sqlite3ErrorMsg(pParse, "table %s has %d values for %d columns",
  4040   4040               pCte->zName, pEList->nExpr, pCte->pCols->nExpr
  4041   4041           );
  4042   4042           pParse->pWith = pSavedWith;
  4043   4043           return SQLITE_ERROR;
  4044   4044         }
  4045   4045         pEList = pCte->pCols;

Changes to src/shell.c.

  2139   2139   **   +  Use p->cSep as the column separator.  The default is ",".
  2140   2140   **   +  Use p->rSep as the row separator.  The default is "\n".
  2141   2141   **   +  Keep track of the line number in p->nLine.
  2142   2142   **   +  Store the character that terminates the field in p->cTerm.  Store
  2143   2143   **      EOF on end-of-file.
  2144   2144   **   +  Report syntax errors on stderr
  2145   2145   */
  2146         -static char *csv_read_one_field(ImportCtx *p){
         2146  +static char *SQLITE_CDECL csv_read_one_field(ImportCtx *p){
  2147   2147     int c;
  2148   2148     int cSep = p->cColSep;
  2149   2149     int rSep = p->cRowSep;
  2150   2150     p->n = 0;
  2151   2151     c = fgetc(p->in);
  2152   2152     if( c==EOF || seenInterrupt ){
  2153   2153       p->cTerm = EOF;
................................................................................
  2213   2213   **   +  Use p->cSep as the column separator.  The default is "\x1F".
  2214   2214   **   +  Use p->rSep as the row separator.  The default is "\x1E".
  2215   2215   **   +  Keep track of the row number in p->nLine.
  2216   2216   **   +  Store the character that terminates the field in p->cTerm.  Store
  2217   2217   **      EOF on end-of-file.
  2218   2218   **   +  Report syntax errors on stderr
  2219   2219   */
  2220         -static char *ascii_read_one_field(ImportCtx *p){
         2220  +static char *SQLITE_CDECL ascii_read_one_field(ImportCtx *p){
  2221   2221     int c;
  2222   2222     int cSep = p->cColSep;
  2223   2223     int rSep = p->cRowSep;
  2224   2224     p->n = 0;
  2225   2225     c = fgetc(p->in);
  2226   2226     if( c==EOF || seenInterrupt ){
  2227   2227       p->cTerm = EOF;
................................................................................
  2907   2907       int nCol;                   /* Number of columns in the table */
  2908   2908       int nByte;                  /* Number of bytes in an SQL string */
  2909   2909       int i, j;                   /* Loop counters */
  2910   2910       int needCommit;             /* True to COMMIT or ROLLBACK at end */
  2911   2911       int nSep;                   /* Number of bytes in p->colSeparator[] */
  2912   2912       char *zSql;                 /* An SQL statement */
  2913   2913       ImportCtx sCtx;             /* Reader context */
  2914         -    char *(*xRead)(ImportCtx*); /* Procedure to read one value */
  2915         -    int (*xCloser)(FILE*);      /* Procedure to close th3 connection */
         2914  +    char *(SQLITE_CDECL *xRead)(ImportCtx*); /* Func to read one value */
         2915  +    int (SQLITE_CDECL *xCloser)(FILE*);      /* Func to close file */
  2916   2916   
  2917   2917       if( nArg!=3 ){
  2918   2918         fprintf(stderr, "Usage: .import FILE TABLE\n");
  2919   2919         goto meta_command_exit;
  2920   2920       }
  2921   2921       zFile = azArg[1];
  2922   2922       zTable = azArg[2];
................................................................................
  2951   2951                         " for import\n");
  2952   2952         return 1;
  2953   2953       }
  2954   2954       sCtx.zFile = zFile;
  2955   2955       sCtx.nLine = 1;
  2956   2956       if( sCtx.zFile[0]=='|' ){
  2957   2957   #ifdef SQLITE_OMIT_POPEN
  2958         -      fprintf(stderr, "Error: pipes are not supporte in this OS\n");
         2958  +      fprintf(stderr, "Error: pipes are not supported in this OS\n");
  2959   2959         return 1;
  2960   2960   #else
  2961   2961         sCtx.in = popen(sCtx.zFile+1, "r");
  2962   2962         sCtx.zFile = "<pipe>";
  2963   2963         xCloser = pclose;
  2964   2964   #endif
  2965   2965       }else{
................................................................................
  3837   3837         fprintf(stderr, "Usage: .timer on|off\n");
  3838   3838         rc = 1;
  3839   3839       }
  3840   3840     }else
  3841   3841     
  3842   3842     if( c=='t' && strncmp(azArg[0], "trace", n)==0 ){
  3843   3843       open_db(p, 0);
  3844         -    output_file_close(p->traceOut);
  3845   3844       if( nArg!=2 ){
  3846   3845         fprintf(stderr, "Usage: .trace FILE|off\n");
  3847   3846         rc = 1;
  3848   3847         goto meta_command_exit;
  3849   3848       }
         3849  +    output_file_close(p->traceOut);
  3850   3850       p->traceOut = output_file_open(azArg[1]);
  3851   3851   #if !defined(SQLITE_OMIT_TRACE) && !defined(SQLITE_OMIT_FLOATING_POINT)
  3852   3852       if( p->traceOut==0 ){
  3853   3853         sqlite3_trace(p->db, 0, 0);
  3854   3854       }else{
  3855   3855         sqlite3_trace(p->db, sql_trace_callback, p->traceOut);
  3856   3856       }
................................................................................
  4350   4350       fprintf(stderr, "%s: Error: missing argument to %s\n",
  4351   4351               argv[0], argv[argc-1]);
  4352   4352       exit(1);
  4353   4353     }
  4354   4354     return argv[i];
  4355   4355   }
  4356   4356   
  4357         -int main(int argc, char **argv){
         4357  +int SQLITE_CDECL main(int argc, char **argv){
  4358   4358     char *zErrMsg = 0;
  4359   4359     ShellState data;
  4360   4360     const char *zInitFile = 0;
  4361   4361     int i;
  4362   4362     int rc = 0;
  4363   4363     int warnInmemoryDb = 0;
  4364   4364     int readStdin = 1;

Changes to src/sqlite.h.in.

    45     45   /*
    46     46   ** Add the ability to override 'extern'
    47     47   */
    48     48   #ifndef SQLITE_EXTERN
    49     49   # define SQLITE_EXTERN extern
    50     50   #endif
    51     51   
           52  +/*
           53  +** Add the ability to override 'cdecl'
           54  +*/
           55  +#ifndef SQLITE_CDECL
           56  +# define SQLITE_CDECL
           57  +#endif
           58  +
    52     59   /*
    53     60   ** These no-op macros are used in front of interfaces to mark those
    54     61   ** interfaces as either deprecated or experimental.  New applications
    55     62   ** should not use deprecated interfaces - they are supported for backwards
    56     63   ** compatibility only.  Application writers should be aware that
    57     64   ** experimental interfaces are subject to change in point releases.
    58     65   **
................................................................................
  2997   3004   int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
  2998   3005   sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
  2999   3006   
  3000   3007   
  3001   3008   /*
  3002   3009   ** CAPI3REF: Error Codes And Messages
  3003   3010   **
  3004         -** ^The sqlite3_errcode() interface returns the numeric [result code] or
  3005         -** [extended result code] for the most recent failed sqlite3_* API call
  3006         -** associated with a [database connection]. If a prior API call failed
  3007         -** but the most recent API call succeeded, the return value from
  3008         -** sqlite3_errcode() is undefined.  ^The sqlite3_extended_errcode()
         3011  +** ^If the most recent sqlite3_* API call associated with 
         3012  +** [database connection] D failed, then the sqlite3_errcode(D) interface
         3013  +** returns the numeric [result code] or [extended result code] for that
         3014  +** API call.
         3015  +** If the most recent API call was successful,
         3016  +** then the return value from sqlite3_errcode() is undefined.
         3017  +** ^The sqlite3_extended_errcode()
  3009   3018   ** interface is the same except that it always returns the 
  3010   3019   ** [extended result code] even when extended result codes are
  3011   3020   ** disabled.
  3012   3021   **
  3013   3022   ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
  3014   3023   ** text that describes the error, as either UTF-8 or UTF-16 respectively.
  3015   3024   ** ^(Memory to hold the error message string is managed internally.

Changes to src/sqliteInt.h.

  2698   2698   #define OPFLAG_LASTROWID     0x02    /* Set to update db->lastRowid */
  2699   2699   #define OPFLAG_ISUPDATE      0x04    /* This OP_Insert is an sql UPDATE */
  2700   2700   #define OPFLAG_APPEND        0x08    /* This is likely to be an append */
  2701   2701   #define OPFLAG_USESEEKRESULT 0x10    /* Try to avoid a seek in BtreeInsert() */
  2702   2702   #define OPFLAG_LENGTHARG     0x40    /* OP_Column only used for length() */
  2703   2703   #define OPFLAG_TYPEOFARG     0x80    /* OP_Column only used for typeof() */
  2704   2704   #define OPFLAG_BULKCSR       0x01    /* OP_Open** used to open bulk cursor */
  2705         -#define OPFLAG_P2ISREG       0x02    /* P2 to OP_Open** is a register number */
         2705  +#define OPFLAG_SEEKEQ        0x02    /* OP_Open** cursor uses EQ seek only */
         2706  +#define OPFLAG_P2ISREG       0x04    /* P2 to OP_Open** is a register number */
  2706   2707   #define OPFLAG_PERMUTE       0x01    /* OP_Compare: use the permutation */
  2707   2708   
  2708   2709   /*
  2709   2710    * Each trigger present in the database schema is stored as an instance of
  2710   2711    * struct Trigger. 
  2711   2712    *
  2712   2713    * Pointers to instances of struct Trigger are stored in two ways.
................................................................................
  3485   3486   #endif
  3486   3487   
  3487   3488   const char *sqlite3ErrStr(int);
  3488   3489   int sqlite3ReadSchema(Parse *pParse);
  3489   3490   CollSeq *sqlite3FindCollSeq(sqlite3*,u8 enc, const char*,int);
  3490   3491   CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char*zName);
  3491   3492   CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr);
  3492         -Expr *sqlite3ExprAddCollateToken(Parse *pParse, Expr*, const Token*);
         3493  +Expr *sqlite3ExprAddCollateToken(Parse *pParse, Expr*, const Token*, int);
  3493   3494   Expr *sqlite3ExprAddCollateString(Parse*,Expr*,const char*);
  3494   3495   Expr *sqlite3ExprSkipCollate(Expr*);
  3495   3496   int sqlite3CheckCollSeq(Parse *, CollSeq *);
  3496   3497   int sqlite3CheckObjectName(Parse *, const char *);
  3497   3498   void sqlite3VdbeSetChanges(sqlite3 *, int);
  3498   3499   int sqlite3AddInt64(i64*,i64);
  3499   3500   int sqlite3SubInt64(i64*,i64);

Changes to src/vdbe.c.

  3231   3231   ** This instruction works just like OpenRead except that it opens the cursor
  3232   3232   ** in read/write mode.  For a given table, there can be one or more read-only
  3233   3233   ** cursors or a single read/write cursor but not both.
  3234   3234   **
  3235   3235   ** See also OpenRead.
  3236   3236   */
  3237   3237   case OP_ReopenIdx: {
  3238         -  VdbeCursor *pCur;
  3239         -
  3240         -  assert( pOp->p5==0 );
  3241         -  assert( pOp->p4type==P4_KEYINFO );
  3242         -  pCur = p->apCsr[pOp->p1];
  3243         -  if( pCur && pCur->pgnoRoot==(u32)pOp->p2 ){
  3244         -    assert( pCur->iDb==pOp->p3 );      /* Guaranteed by the code generator */
  3245         -    break;
  3246         -  }
  3247         -  /* If the cursor is not currently open or is open on a different
  3248         -  ** index, then fall through into OP_OpenRead to force a reopen */
  3249         -}
  3250         -case OP_OpenRead:
  3251         -case OP_OpenWrite: {
  3252   3238     int nField;
  3253   3239     KeyInfo *pKeyInfo;
  3254   3240     int p2;
  3255   3241     int iDb;
  3256   3242     int wrFlag;
  3257   3243     Btree *pX;
  3258   3244     VdbeCursor *pCur;
  3259   3245     Db *pDb;
  3260   3246   
  3261         -  assert( (pOp->p5&(OPFLAG_P2ISREG|OPFLAG_BULKCSR))==pOp->p5 );
  3262         -  assert( pOp->opcode==OP_OpenWrite || pOp->p5==0 );
         3247  +  assert( pOp->p5==0 || pOp->p5==OPFLAG_SEEKEQ );
         3248  +  assert( pOp->p4type==P4_KEYINFO );
         3249  +  pCur = p->apCsr[pOp->p1];
         3250  +  if( pCur && pCur->pgnoRoot==(u32)pOp->p2 ){
         3251  +    assert( pCur->iDb==pOp->p3 );      /* Guaranteed by the code generator */
         3252  +    goto open_cursor_set_hints;
         3253  +  }
         3254  +  /* If the cursor is not currently open or is open on a different
         3255  +  ** index, then fall through into OP_OpenRead to force a reopen */
         3256  +case OP_OpenRead:
         3257  +case OP_OpenWrite:
         3258  +
         3259  +  assert( (pOp->p5&(OPFLAG_P2ISREG|OPFLAG_BULKCSR|OPFLAG_SEEKEQ))==pOp->p5 );
         3260  +  assert( pOp->opcode==OP_OpenWrite || pOp->p5==0 || pOp->p5==OPFLAG_SEEKEQ );
  3263   3261     assert( p->bIsReader );
  3264   3262     assert( pOp->opcode==OP_OpenRead || pOp->opcode==OP_ReopenIdx
  3265   3263             || p->readOnly==0 );
  3266   3264   
  3267   3265     if( p->expired ){
  3268   3266       rc = SQLITE_ABORT_ROLLBACK;
  3269   3267       break;
................................................................................
  3318   3316     pCur = allocateCursor(p, pOp->p1, nField, iDb, 1);
  3319   3317     if( pCur==0 ) goto no_mem;
  3320   3318     pCur->nullRow = 1;
  3321   3319     pCur->isOrdered = 1;
  3322   3320     pCur->pgnoRoot = p2;
  3323   3321     rc = sqlite3BtreeCursor(pX, p2, wrFlag, pKeyInfo, pCur->pCursor);
  3324   3322     pCur->pKeyInfo = pKeyInfo;
  3325         -  assert( OPFLAG_BULKCSR==BTREE_BULKLOAD );
  3326         -  sqlite3BtreeCursorHints(pCur->pCursor, (pOp->p5 & OPFLAG_BULKCSR));
  3327         -
  3328   3323     /* Set the VdbeCursor.isTable variable. Previous versions of
  3329   3324     ** SQLite used to check if the root-page flags were sane at this point
  3330   3325     ** and report database corruption if they were not, but this check has
  3331   3326     ** since moved into the btree layer.  */  
  3332   3327     pCur->isTable = pOp->p4type!=P4_KEYINFO;
         3328  +
         3329  +open_cursor_set_hints:
         3330  +  assert( OPFLAG_BULKCSR==BTREE_BULKLOAD );
         3331  +  assert( OPFLAG_SEEKEQ==BTREE_SEEK_EQ );
         3332  +  sqlite3BtreeCursorHints(pCur->pCursor,
         3333  +                          (pOp->p5 & (OPFLAG_BULKCSR|OPFLAG_SEEKEQ)));
  3333   3334     break;
  3334   3335   }
  3335   3336   
  3336   3337   /* Opcode: OpenEphemeral P1 P2 * P4 P5
  3337   3338   ** Synopsis: nColumn=P2
  3338   3339   **
  3339   3340   ** Open a new cursor P1 to a transient table.
................................................................................
  3586   3587     assert( pC->isOrdered );
  3587   3588     assert( pC->pCursor!=0 );
  3588   3589     oc = pOp->opcode;
  3589   3590     pC->nullRow = 0;
  3590   3591   #ifdef SQLITE_DEBUG
  3591   3592     pC->seekOp = pOp->opcode;
  3592   3593   #endif
         3594  +
         3595  +  /* For a cursor with the BTREE_SEEK_EQ hint, only the OP_SeekGE and
         3596  +  ** OP_SeekLE opcodes are allowed, and these must be immediately followed
         3597  +  ** by an OP_IdxGT or OP_IdxLT opcode, respectively, with the same key.
         3598  +  */
         3599  +#ifdef SQLITE_DEBUG
         3600  +  if( sqlite3BtreeCursorHasHint(pC->pCursor, BTREE_SEEK_EQ) ){
         3601  +    assert( pOp->opcode==OP_SeekGE || pOp->opcode==OP_SeekLE );
         3602  +    assert( pOp[1].opcode==OP_IdxLT || pOp[1].opcode==OP_IdxGT );
         3603  +    assert( pOp[1].p1==pOp[0].p1 );
         3604  +    assert( pOp[1].p2==pOp[0].p2 );
         3605  +    assert( pOp[1].p3==pOp[0].p3 );
         3606  +    assert( pOp[1].p4.i==pOp[0].p4.i );
         3607  +  }
         3608  +#endif
         3609  + 
  3593   3610     if( pC->isTable ){
  3594   3611       /* The input value in P3 might be of any type: integer, real, string,
  3595   3612       ** blob, or NULL.  But it needs to be an integer before we can do
  3596   3613       ** the seek, so convert it. */
  3597   3614       pIn3 = &aMem[pOp->p3];
  3598   3615       if( (pIn3->flags & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
  3599   3616         applyNumericAffinity(pIn3, 0);
................................................................................
  6005   6022     rc = sqlite3VtabBegin(db, pVTab);
  6006   6023     if( pVTab ) sqlite3VtabImportErrmsg(p, pVTab->pVtab);
  6007   6024     break;
  6008   6025   }
  6009   6026   #endif /* SQLITE_OMIT_VIRTUALTABLE */
  6010   6027   
  6011   6028   #ifndef SQLITE_OMIT_VIRTUALTABLE
  6012         -/* Opcode: VCreate P1 * * P4 *
         6029  +/* Opcode: VCreate P1 P2 * * *
  6013   6030   **
  6014         -** P4 is the name of a virtual table in database P1. Call the xCreate method
  6015         -** for that table.
         6031  +** P2 is a register that holds the name of a virtual table in database 
         6032  +** P1. Call the xCreate method for that table.
  6016   6033   */
  6017   6034   case OP_VCreate: {
  6018         -  rc = sqlite3VtabCallCreate(db, pOp->p1, pOp->p4.z, &p->zErrMsg);
         6035  +  Mem sMem;          /* For storing the record being decoded */
         6036  +  const char *zTab;  /* Name of the virtual table */
         6037  +
         6038  +  memset(&sMem, 0, sizeof(sMem));
         6039  +  sMem.db = db;
         6040  +  /* Because P2 is always a static string, it is impossible for the
         6041  +  ** sqlite3VdbeMemCopy() to fail */
         6042  +  assert( (aMem[pOp->p2].flags & MEM_Str)!=0 );
         6043  +  assert( (aMem[pOp->p2].flags & MEM_Static)!=0 );
         6044  +  rc = sqlite3VdbeMemCopy(&sMem, &aMem[pOp->p2]);
         6045  +  assert( rc==SQLITE_OK );
         6046  +  zTab = (const char*)sqlite3_value_text(&sMem);
         6047  +  assert( zTab || db->mallocFailed );
         6048  +  if( zTab ){
         6049  +    rc = sqlite3VtabCallCreate(db, pOp->p1, zTab, &p->zErrMsg);
         6050  +  }
         6051  +  sqlite3VdbeMemRelease(&sMem);
  6019   6052     break;
  6020   6053   }
  6021   6054   #endif /* SQLITE_OMIT_VIRTUALTABLE */
  6022   6055   
  6023   6056   #ifndef SQLITE_OMIT_VIRTUALTABLE
  6024   6057   /* Opcode: VDestroy P1 * * P4 *
  6025   6058   **

Changes to src/vdbesort.c.

  1147   1147   */
  1148   1148   static int vdbeSorterOpenTempFile(
  1149   1149     sqlite3 *db,                    /* Database handle doing sort */
  1150   1150     i64 nExtend,                    /* Attempt to extend file to this size */
  1151   1151     sqlite3_file **ppFd
  1152   1152   ){
  1153   1153     int rc;
         1154  +  if( sqlite3FaultSim(202) ) return SQLITE_IOERR_ACCESS;
  1154   1155     rc = sqlite3OsOpenMalloc(db->pVfs, 0, ppFd,
  1155   1156         SQLITE_OPEN_TEMP_JOURNAL |
  1156   1157         SQLITE_OPEN_READWRITE    | SQLITE_OPEN_CREATE |
  1157   1158         SQLITE_OPEN_EXCLUSIVE    | SQLITE_OPEN_DELETEONCLOSE, &rc
  1158   1159     );
  1159   1160     if( rc==SQLITE_OK ){
  1160   1161       i64 max = SQLITE_MAX_MMAP_SIZE;

Changes to src/vtab.c.

   385    385     ** do additional initialization work and store the statement text
   386    386     ** in the sqlite_master table.
   387    387     */
   388    388     if( !db->init.busy ){
   389    389       char *zStmt;
   390    390       char *zWhere;
   391    391       int iDb;
          392  +    int iReg;
   392    393       Vdbe *v;
   393    394   
   394    395       /* Compute the complete text of the CREATE VIRTUAL TABLE statement */
   395    396       if( pEnd ){
   396    397         pParse->sNameToken.n = (int)(pEnd->z - pParse->sNameToken.z) + pEnd->n;
   397    398       }
   398    399       zStmt = sqlite3MPrintf(db, "CREATE VIRTUAL TABLE %T", &pParse->sNameToken);
................................................................................
   419    420       sqlite3DbFree(db, zStmt);
   420    421       v = sqlite3GetVdbe(pParse);
   421    422       sqlite3ChangeCookie(pParse, iDb);
   422    423   
   423    424       sqlite3VdbeAddOp2(v, OP_Expire, 0, 0);
   424    425       zWhere = sqlite3MPrintf(db, "name='%q' AND type='table'", pTab->zName);
   425    426       sqlite3VdbeAddParseSchemaOp(v, iDb, zWhere);
   426         -    sqlite3VdbeAddOp4(v, OP_VCreate, iDb, 0, 0, 
   427         -                         pTab->zName, sqlite3Strlen30(pTab->zName) + 1);
          427  +
          428  +    iReg = ++pParse->nMem;
          429  +    sqlite3VdbeAddOp4(v, OP_String8, 0, iReg, 0, pTab->zName, 0);
          430  +    sqlite3VdbeAddOp2(v, OP_VCreate, iDb, iReg);
   428    431     }
   429    432   
   430    433     /* If we are rereading the sqlite_master table create the in-memory
   431    434     ** record of the table. The xConnect() method is not called until
   432    435     ** the first time the virtual table is used in an SQL statement. This
   433    436     ** allows a schema that contains virtual tables to be loaded before
   434    437     ** the required virtual table implementations are registered.  */

Changes to src/where.c.

  1360   1360     ){
  1361   1361       Expr *pLeft;       /* LHS of LIKE/GLOB operator */
  1362   1362       Expr *pStr2;       /* Copy of pStr1 - RHS of LIKE/GLOB operator */
  1363   1363       Expr *pNewExpr1;
  1364   1364       Expr *pNewExpr2;
  1365   1365       int idxNew1;
  1366   1366       int idxNew2;
  1367         -    Token sCollSeqName;  /* Name of collating sequence */
         1367  +    const char *zCollSeqName;     /* Name of collating sequence */
  1368   1368       const u16 wtFlags = TERM_LIKEOPT | TERM_VIRTUAL | TERM_DYNAMIC;
  1369   1369   
  1370   1370       pLeft = pExpr->x.pList->a[1].pExpr;
  1371   1371       pStr2 = sqlite3ExprDup(db, pStr1, 0);
  1372   1372   
  1373   1373       /* Convert the lower bound to upper-case and the upper bound to
  1374   1374       ** lower-case (upper-case is less than lower-case in ASCII) so that
................................................................................
  1396   1396           ** LIKE on all candidate expressions by clearing the isComplete flag
  1397   1397           */
  1398   1398           if( c=='A'-1 ) isComplete = 0;
  1399   1399           c = sqlite3UpperToLower[c];
  1400   1400         }
  1401   1401         *pC = c + 1;
  1402   1402       }
  1403         -    sCollSeqName.z = noCase ? "NOCASE" : "BINARY";
  1404         -    sCollSeqName.n = 6;
         1403  +    zCollSeqName = noCase ? "NOCASE" : "BINARY";
  1405   1404       pNewExpr1 = sqlite3ExprDup(db, pLeft, 0);
  1406   1405       pNewExpr1 = sqlite3PExpr(pParse, TK_GE,
  1407         -           sqlite3ExprAddCollateToken(pParse,pNewExpr1,&sCollSeqName),
         1406  +           sqlite3ExprAddCollateString(pParse,pNewExpr1,zCollSeqName),
  1408   1407              pStr1, 0);
  1409   1408       transferJoinMarkings(pNewExpr1, pExpr);
  1410   1409       idxNew1 = whereClauseInsert(pWC, pNewExpr1, wtFlags);
  1411   1410       testcase( idxNew1==0 );
  1412   1411       exprAnalyze(pSrc, pWC, idxNew1);
  1413   1412       pNewExpr2 = sqlite3ExprDup(db, pLeft, 0);
  1414   1413       pNewExpr2 = sqlite3PExpr(pParse, TK_LT,
  1415         -           sqlite3ExprAddCollateToken(pParse,pNewExpr2,&sCollSeqName),
         1414  +           sqlite3ExprAddCollateString(pParse,pNewExpr2,zCollSeqName),
  1416   1415              pStr2, 0);
  1417   1416       transferJoinMarkings(pNewExpr2, pExpr);
  1418   1417       idxNew2 = whereClauseInsert(pWC, pNewExpr2, wtFlags);
  1419   1418       testcase( idxNew2==0 );
  1420   1419       exprAnalyze(pSrc, pWC, idxNew2);
  1421   1420       pTerm = &pWC->a[idxTerm];
  1422   1421       if( isComplete ){
................................................................................
  6798   6797         }
  6799   6798         pLevel->iIdxCur = iIndexCur;
  6800   6799         assert( pIx->pSchema==pTab->pSchema );
  6801   6800         assert( iIndexCur>=0 );
  6802   6801         if( op ){
  6803   6802           sqlite3VdbeAddOp3(v, op, iIndexCur, pIx->tnum, iDb);
  6804   6803           sqlite3VdbeSetP4KeyInfo(pParse, pIx);
         6804  +        if( (pLoop->wsFlags & WHERE_CONSTRAINT)!=0
         6805  +         && (pLoop->wsFlags & (WHERE_COLUMN_RANGE|WHERE_SKIPSCAN))==0
         6806  +         && (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)==0
         6807  +        ){
         6808  +          sqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ); /* Hint to COMDB2 */
         6809  +        }
  6805   6810           VdbeComment((v, "%s", pIx->zName));
  6806   6811         }
  6807   6812       }
  6808   6813       if( iDb>=0 ) sqlite3CodeVerifySchema(pParse, iDb);
  6809   6814       notReady &= ~getMask(&pWInfo->sMaskSet, pTabItem->iCursor);
  6810   6815     }
  6811   6816     pWInfo->iTop = sqlite3VdbeCurrentAddr(v);

Changes to test/collate1.test.

     6      6   #
     7      7   #    May you do good and not evil.
     8      8   #    May you find forgiveness for yourself and forgive others.
     9      9   #    May you share freely, never taking more than you give.
    10     10   #
    11     11   #***********************************************************************
    12     12   # This file implements regression tests for SQLite library.  The
    13         -# focus of this script is page cache subsystem.
           13  +# focus of this script is testing collation sequences.
    14     14   #
    15         -# $Id: collate1.test,v 1.5 2007/02/01 23:02:46 drh Exp $
    16     15   
    17     16   set testdir [file dirname $argv0]
    18     17   source $testdir/tester.tcl
           18  +set testprefix collate1
    19     19   
    20     20   #
    21     21   # Tests are roughly organised as follows:
    22     22   #
    23     23   # collate1-1.* - Single-field ORDER BY with an explicit COLLATE clause.
    24     24   # collate1-2.* - Multi-field ORDER BY with an explicit COLLATE clause.
    25     25   # collate1-3.* - ORDER BY using a default collation type. Also that an 
................................................................................
   329    329   } {1}
   330    330   do_test collate1-5.3 {
   331    331     execsql {
   332    332       SELECT id FROM c5 WHERE c='abc' ORDER BY id;
   333    333     }
   334    334   } {1 2}
   335    335   
          336  +
          337  +
          338  +#-------------------------------------------------------------------------
          339  +# Fix problems with handling collation sequences named '"""'.
          340  +#
          341  +do_execsql_test 6.1 {
          342  +  SELECT """""""";
          343  +} {\"\"\"}
          344  +
          345  +do_catchsql_test 6.2 {
          346  +  CREATE TABLE x1(a);
          347  +  SELECT a FROM x1 ORDER BY a COLLATE """""""";
          348  +} {1 {no such collation sequence: """}}
          349  +
          350  +do_catchsql_test 6.3 {
          351  +  SELECT a FROM x1 ORDER BY 1 COLLATE """""""";
          352  +} {1 {no such collation sequence: """}}
          353  +
          354  +do_catchsql_test 6.4 {
          355  +  SELECT 0 UNION SELECT 0 ORDER BY 1 COLLATE """""""";
          356  +} {1 {no such collation sequence: """}}
          357  +
          358  +db collate {"""} [list string compare -nocase]
          359  +
          360  +do_execsql_test 6.5 {
          361  +  PRAGMA foreign_keys = ON;
          362  +  CREATE TABLE p1(a PRIMARY KEY COLLATE '"""');
          363  +  CREATE TABLE c1(x, y REFERENCES p1);
          364  +} {}
          365  +
          366  +do_execsql_test 6.6 { 
          367  +  INSERT INTO p1 VALUES('abc'); 
          368  +  INSERT INTO c1 VALUES(1, 'ABC'); 
          369  +}
          370  +
          371  +ifcapable foreignkey {
          372  +  do_catchsql_test 6.7 { 
          373  +    DELETE FROM p1 WHERE rowid = 1 
          374  +  } {1 {FOREIGN KEY constraint failed}}
          375  +}
          376  +
          377  +do_execsql_test 6.8 { 
          378  +  INSERT INTO p1 VALUES('abb');
          379  +  INSERT INTO p1 VALUES('wxz');
          380  +  INSERT INTO p1 VALUES('wxy');
          381  +
          382  +  INSERT INTO c1 VALUES(2, 'abb');
          383  +  INSERT INTO c1 VALUES(3, 'wxz');
          384  +  INSERT INTO c1 VALUES(4, 'WXY');
          385  +  SELECT x, y FROM c1 ORDER BY y COLLATE """""""";
          386  +} {2 abb 1 ABC 4 WXY 3 wxz}
          387  +
   336    388   finish_test
          389  +
          390  +

Changes to test/fts3atoken.test.

   182    182   
   183    183     do_test 5.2 {
   184    184       set str [cp_to_str {19968 26085 32822 32645 27874 23433 20986}]
   185    185       execsql { INSERT INTO x1 VALUES($str) }
   186    186     } {}
   187    187   }
   188    188   
   189         -
   190    189   do_test fts3token-internal {
   191    190     execsql { SELECT fts3_tokenizer_internal_test() }
   192    191   } {ok}
          192  +
          193  +#-------------------------------------------------------------------------
          194  +# Test empty tokenizer names.
          195  +#
          196  +do_catchsql_test 6.1.1 {
          197  +  CREATE VIRTUAL TABLE t3 USING fts4(tokenize="");
          198  +} {1 {unknown tokenizer: }}
          199  +do_catchsql_test 6.1.2 {
          200  +  CREATE VIRTUAL TABLE t3 USING fts4(tokenize=);
          201  +} {1 {unknown tokenizer: }}
          202  +do_catchsql_test 6.1.3 {
          203  +  CREATE VIRTUAL TABLE t3 USING fts4(tokenize="   ");
          204  +} {1 {unknown tokenizer:    }}
   193    205   
   194    206   
   195    207   finish_test

Changes to test/fts3prefix.test.

   205    205   #
   206    206   do_catchsql_test 5.1 {
   207    207     CREATE VIRTUAL TABLE t4 USING fts4(prefix="abc");
   208    208   } {1 {error parsing prefix parameter: abc}}
   209    209   do_catchsql_test 5.2 {
   210    210     CREATE VIRTUAL TABLE t4 USING fts4(prefix="");
   211    211   } {0 {}}
          212  +do_catchsql_test 5.3 {
          213  +  CREATE VIRTUAL TABLE t5 USING fts4(prefix="-1");
          214  +} {1 {error parsing prefix parameter: -1}}
          215  +
          216  +#-------------------------------------------------------------------------
          217  +# Prefix indexes of size 0 are ignored. Demonstrate this by showing that
          218  +# adding prefix=0 does not change the contents of the %_segdir table.
          219  +#
          220  +reset_db
          221  +do_execsql_test 6.1.1 {
          222  +  CREATE VIRTUAL TABLE t1 USING fts4(prefix=0);
          223  +  CREATE VIRTUAL TABLE t2 USING fts4;
          224  +  INSERT INTO t1 VALUES('Twas Mulga Bill, from Eaglehawk, ');
          225  +  INSERT INTO t2 VALUES('Twas Mulga Bill, from Eaglehawk, ');
          226  +} {}
          227  +do_execsql_test 6.1.2 {
          228  +  SELECT md5sum(quote(root)) FROM t1_segdir;
          229  +} [db eval {SELECT md5sum(quote(root)) FROM t2_segdir}]
          230  +
          231  +reset_db
          232  +do_execsql_test 6.2.1 {
          233  +  CREATE VIRTUAL TABLE t1 USING fts4(prefix="1,0,2");
          234  +  CREATE VIRTUAL TABLE t2 USING fts4(prefix="1,2");
          235  +  INSERT INTO t1 VALUES('that caught the cycling craze;');
          236  +  INSERT INTO t2 VALUES('that caught the cycling craze;');
          237  +} {}
          238  +do_execsql_test 6.2.2 {
          239  +  SELECT md5sum(quote(root)) FROM t1_segdir;
          240  +} [db eval {SELECT md5sum(quote(root)) FROM t2_segdir}]
          241  +
          242  +reset_db
          243  +do_execsql_test 6.3.1 {
          244  +  CREATE VIRTUAL TABLE t1 USING fts4(prefix="1,3,2");
          245  +  CREATE VIRTUAL TABLE t2 USING fts4(prefix="1,2");
          246  +  INSERT INTO t1 VALUES('He turned away the good old horse');
          247  +  INSERT INTO t2 VALUES('He turned away the good old horse');
          248  +} {}
          249  +do_test 6.3.2 {
          250  +  set one [db eval {SELECT md5sum(quote(root)) FROM t1_segdir}]
          251  +  set two [db eval {SELECT md5sum(quote(root)) FROM t2_segdir}]
          252  +  expr {$one == $two}
          253  +} 0
          254  +
          255  +reset_db
          256  +do_execsql_test 6.4.1 {
          257  +  CREATE VIRTUAL TABLE t1 USING fts4(prefix="1,600,2");
          258  +  CREATE VIRTUAL TABLE t2 USING fts4(prefix="1,2");
          259  +  INSERT INTO t1 VALUES('that served him many days;');
          260  +  INSERT INTO t2 VALUES('that served him many days;');
          261  +} {}
          262  +do_execsql_test 6.4.2 {
          263  +  SELECT md5sum(quote(root)) FROM t1_segdir;
          264  +} [db eval {SELECT md5sum(quote(root)) FROM t2_segdir}]
          265  +
          266  +reset_db
          267  +do_execsql_test 6.5.1 {
          268  +  CREATE VIRTUAL TABLE t1 USING fts4(prefix="2147483647,2147483648,2147483649");
          269  +  CREATE VIRTUAL TABLE t2 USING fts4(prefix=);
          270  +  INSERT INTO t1 VALUES('He dressed himself in cycling clothes');
          271  +  INSERT INTO t2 VALUES('He dressed himself in cycling clothes');
          272  +} {}
          273  +do_execsql_test 6.5.2 {
          274  +  SELECT md5sum(quote(root)) FROM t1_segdir;
          275  +} [db eval {SELECT md5sum(quote(root)) FROM t2_segdir}]
   212    276   
   213    277   finish_test

Changes to test/shell4.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   #
    12     12   # The focus of this file is testing the CLI shell tool.
    13     13   # These tests are specific to the .stats command.
    14     14   #
    15         -# $Id: shell4.test,v 1.7 2009/07/17 16:54:48 shaneh Exp $
    16         -#
           15  +# 2015-03-19:  Added tests for .trace
    17     16   
    18     17   # Test plan:
    19     18   #
    20     19   #   shell4-1.*: Basic tests specific to the "stats" command.
           20  +#   shell4-2.*: Basic tests for ".trace"
    21     21   #
    22     22   set testdir [file dirname $argv0]
    23     23   source $testdir/tester.tcl
    24     24   if {$tcl_platform(platform)=="windows"} {
    25     25     set CLI "sqlite3.exe"
    26     26   } else {
    27     27     set CLI "./sqlite3"
................................................................................
   108    108     set res [catchcmd "test.db" {.stats ON
   109    109   SELECT 1;
   110    110   }]
   111    111     list [regexp {Memory Used} $res] \
   112    112          [regexp {Heap Usage} $res] \
   113    113          [regexp {Autoindex Inserts} $res]
   114    114   } {1 1 1}
          115  +
          116  +do_test shell4-2.1 {
          117  +  catchcmd ":memory:" "CREATE TABLE t1(x);\n.trace"
          118  +} {1 {Usage: .trace FILE|off}}
          119  +do_test shell4-2.2 {
          120  +  catchcmd ":memory:" "CREATE TABLE t1(x);\n.trace off\n.trace off\n"
          121  +} {0 {}}
          122  +do_test shell4-2.3 {
          123  +  catchcmd ":memory:" ".trace stdout\n.trace\n.trace off\n.dump\n"
          124  +} {/^1 {PRAGMA.*Usage:.*}$/}
          125  +ifcapable trace {
          126  +do_test shell4-2.4 {
          127  +  catchcmd ":memory:" ".trace stdout\nCREATE TABLE t1(x);SELECT * FROM t1;"
          128  +} {0 {CREATE TABLE t1(x);
          129  +SELECT * FROM t1;}}
          130  +do_test shell4-2.5 {
          131  +  catchcmd ":memory:" "CREATE TABLE t1(x);\n.trace stdout\nSELECT * FROM t1;"
          132  +} {0 {SELECT * FROM t1;}}
          133  +}
          134  +
   115    135   
   116    136   finish_test

Changes to test/vtab2.test.

     6      6   #    May you do good and not evil.
     7      7   #    May you find forgiveness for yourself and forgive others.
     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         -# $Id: vtab2.test,v 1.9 2008/10/13 10:37:50 danielk1977 Exp $
    14     13   
    15     14   set testdir [file dirname $argv0]
    16     15   source $testdir/tester.tcl
           16  +set testprefix vtab2
    17     17   
    18     18   ifcapable !vtab||!schema_pragmas {
    19     19     finish_test
    20     20     return
    21     21   }
    22     22   
    23     23   register_schema_module [sqlite3_connection_pointer db]
................................................................................
   128    128       UPDATE fkey 
   129    129       SET to_col = (SELECT name FROM v_col WHERE tablename = 't1' AND pk);
   130    130     }
   131    131   } {}
   132    132   do_test vtab2-4.5 {
   133    133     execsql { SELECT * FROM fkey }
   134    134   } {t1 a}
          135  +
          136  +#-------------------------------------------------------------------------
          137  +#
          138  +ifcapable fts3 {
          139  +  reset_db
          140  +  do_execsql_test 5.1 {
          141  +    PRAGMA encoding='UTF16';
          142  +  }
          143  +
          144  +  do_test 5.2 {
          145  +    sqlite3_exec_hex db { CREATE VIRTUAL TABLE %C8 USING fts3 }
          146  +  } {0 {}}
          147  +
          148  +  do_test 5.3 {
          149  +    sqlite3_exec_hex db { CREATE VIRTUAL TABLE %C9 USING s }
          150  +  } {/1 {malformed database schema.* already exists}/}
          151  +}
          152  +
          153  +
   135    154   
   136    155   finish_test
          156  +

Changes to test/walblock.test.

    88     88   
    89     89   tvfs script barrier_callback
    90     90   tvfs filter xShmBarrier
    91     91   proc barrier_callback {method args} {
    92     92     set ::out ""
    93     93     testfixture $::C { db eval { SELECT * FROM t1 } } {set ::out}
    94     94   
    95         -  do_test "1.2.2.(blocking 5 seconds)" { 
           95  +  do_test "1.2.2.(blocking 10 seconds)" { 
    96     96       set ::continue 0
    97         -    after 5000 {set ::continue 1}
           97  +    after 10000 {set ::continue 1}
    98     98       vwait ::continue
    99     99       set ::out 
   100    100     } {}
   101    101   }
   102    102   
   103    103   execsql COMMIT
   104    104   

Changes to test/with1.test.

   823    823   do_execsql_test 12.1 {
   824    824   WITH RECURSIVE
   825    825     t1(x) AS (VALUES(2) UNION ALL SELECT x+2 FROM t1 WHERE x<20),
   826    826     t2(y) AS (VALUES(3) UNION ALL SELECT y+3 FROM t2 WHERE y<20)
   827    827   SELECT x FROM t1 EXCEPT SELECT y FROM t2 ORDER BY 1;
   828    828   } {2 4 8 10 14 16 20}
   829    829   
          830  +# 2015-03-21
          831  +# Column wildcards on the LHS of a recursive table expression
          832  +#
          833  +do_catchsql_test 13.1 {
          834  +  WITH RECURSIVE c(i) AS (SELECT * UNION ALL SELECT i+1 FROM c WHERE i<10)
          835  +  SELECT i FROM c;
          836  +} {1 {no tables specified}}
          837  +do_catchsql_test 13.2 {
          838  +  WITH RECURSIVE c(i) AS (SELECT 5,* UNION ALL SELECT i+1 FROM c WHERE i<10)
          839  +  SELECT i FROM c;
          840  +} {1 {no tables specified}}
          841  +do_catchsql_test 13.3 {
          842  +  WITH RECURSIVE c(i,j) AS (SELECT 5,* UNION ALL SELECT i+1,11 FROM c WHERE i<10)
          843  +  SELECT i FROM c;
          844  +} {1 {table c has 1 values for 2 columns}}
   830    845   
   831    846   finish_test

Changes to test/without_rowid6.test.

    32     32   } {x123y}
    33     33   do_execsql_test without_rowid6-130 {
    34     34     SELECT c FROM t1 ORDER BY a DESC LIMIT 5;
    35     35   } {x1000y x999y x998y x997y x996y}
    36     36   do_execsql_test without_rowid6-140 {
    37     37     SELECT c FROM t1 ORDER BY b LIMIT 5;
    38     38   } {x1y x2y x3y x4y x5y}
           39  +
           40  +# Column t1.b starts out as a unique index, but that index is
           41  +# subsequently converted into a PRIMARY KEY.
           42  +#
           43  +do_execsql_test without_rowid6-200 {
           44  +  DROP TABLE IF EXISTS t1;
           45  +  CREATE TABLE t1(
           46  +    a UNIQUE,
           47  +    b UNIQUE,
           48  +    c UNIQUE,
           49  +    PRIMARY KEY(b)
           50  +  ) WITHOUT ROWID;
           51  +  INSERT INTO t1(a,b,c) VALUES(1,8,3),(4,5,6),(7,2,9);
           52  +  SELECT a FROM t1 WHERE b>3 ORDER BY b;
           53  +} {4 1}
           54  +do_execsql_test without_rowid6-210 {
           55  +  EXPLAIN QUERY PLAN
           56  +  SELECT a FROM t1 WHERE b>3 ORDER BY b;
           57  +} {/SEARCH TABLE t1 USING PRIMARY KEY .b>../}
           58  +do_execsql_test without_rowid6-220 {
           59  +  PRAGMA index_list(t1);
           60  +} {/sqlite_autoindex_t1_2 1 pk/}
           61  +
           62  +do_execsql_test without_rowid6-300 {
           63  +  DROP TABLE IF EXISTS t1;
           64  +  CREATE TABLE t1(
           65  +    a UNIQUE,
           66  +    b PRIMARY KEY,
           67  +    c UNIQUE,
           68  +    UNIQUE(b)
           69  +  ) WITHOUT ROWID;
           70  +  INSERT INTO t1(a,b,c) VALUES(1,8,3),(4,5,6),(7,2,9);
           71  +  SELECT a FROM t1 WHERE b>3 ORDER BY b;
           72  +} {4 1}
           73  +do_execsql_test without_rowid6-310 {
           74  +  EXPLAIN QUERY PLAN
           75  +  SELECT a FROM t1 WHERE b>3 ORDER BY b;
           76  +} {/SEARCH TABLE t1 USING PRIMARY KEY .b>../}
           77  +do_execsql_test without_rowid6-320 {
           78  +  PRAGMA index_list(t1);
           79  +} {/sqlite_autoindex_t1_2 1 pk/}
           80  +
           81  +do_execsql_test without_rowid6-400 {
           82  +  DROP TABLE IF EXISTS t1;
           83  +  CREATE TABLE t1(
           84  +    a UNIQUE,
           85  +    b UNIQUE PRIMARY KEY,
           86  +    c UNIQUE
           87  +  ) WITHOUT ROWID;
           88  +  INSERT INTO t1(a,b,c) VALUES(1,8,3),(4,5,6),(7,2,9);
           89  +  SELECT a FROM t1 WHERE b>3 ORDER BY b;
           90  +} {4 1}
           91  +do_execsql_test without_rowid6-410 {
           92  +  EXPLAIN QUERY PLAN
           93  +  SELECT a FROM t1 WHERE b>3 ORDER BY b;
           94  +} {/SEARCH TABLE t1 USING PRIMARY KEY .b>../}
           95  +do_execsql_test without_rowid6-420 {
           96  +  PRAGMA index_list(t1);
           97  +} {/sqlite_autoindex_t1_2 1 pk/}
           98  +
           99  +do_execsql_test without_rowid6-500 {
          100  +  DROP TABLE IF EXISTS t1;
          101  +  CREATE TABLE t1(a,b,c,
          102  +    UNIQUE(b,c),
          103  +    PRIMARY KEY(b,c)
          104  +  ) WITHOUT ROWID;
          105  +  INSERT INTO t1(a,b,c) VALUES(1,8,3),(4,5,6),(7,2,9);
          106  +  SELECT a FROM t1 WHERE b>3 ORDER BY b;
          107  +} {4 1}
          108  +do_execsql_test without_rowid6-510 {
          109  +  EXPLAIN QUERY PLAN
          110  +  SELECT a FROM t1 WHERE b>3 ORDER BY b;
          111  +} {/SEARCH TABLE t1 USING PRIMARY KEY .b>../}
          112  +do_execsql_test without_rowid6-520 {
          113  +  PRAGMA index_list(t1);
          114  +} {/sqlite_autoindex_t1_1 1 pk/}
    39    115   
    40    116   
    41    117   finish_test

Changes to tool/build-all-msvc.bat.

    54     54   REM SET __ECHO=ECHO
    55     55   REM SET __ECHO2=ECHO
    56     56   REM SET __ECHO3=ECHO
    57     57   IF NOT DEFINED _AECHO (SET _AECHO=REM)
    58     58   IF NOT DEFINED _CECHO (SET _CECHO=REM)
    59     59   IF NOT DEFINED _VECHO (SET _VECHO=REM)
    60     60   
           61  +SET REDIRECT=^>
           62  +IF DEFINED __ECHO SET REDIRECT=^^^>
           63  +
    61     64   %_AECHO% Running %0 %*
    62     65   
    63     66   REM SET DFLAGS=/L
    64     67   
    65     68   %_VECHO% DFlags = '%DFLAGS%'
    66     69   
    67     70   SET FFLAGS=/V /F /G /H /I /R /Y /Z
................................................................................
   416    419             IF ERRORLEVEL 1 (
   417    420               ECHO Failed to clean for platform %%P.
   418    421               GOTO errors
   419    422             )
   420    423           ) ELSE (
   421    424             REM
   422    425             REM NOTE: Even when the cleaning step has been disabled, we still
   423         -          REM       need to remove the build output for the files we are
          426  +          REM       need to remove the build output for all the files we are
   424    427             REM       specifically wanting to build for each platform.
   425    428             REM
   426         -          %_AECHO% Cleaning final output files only...
   427         -          %__ECHO% DEL /Q *.lo sqlite3.dll sqlite3.lib sqlite3.pdb
          429  +          %_AECHO% Cleaning final core library output files only...
          430  +          %__ECHO% DEL /Q *.lo sqlite3.dll sqlite3.lib sqlite3.pdb 2%REDIRECT% NUL
   428    431           )
   429    432   
   430    433           REM
   431    434           REM NOTE: Call NMAKE with the MSVC makefile to build the "sqlite3.dll"
   432    435           REM       binary.  The x86 compiler will be used to compile the native
   433    436           REM       command line tools needed during the build process itself.
   434    437           REM       Also, disable looking for and/or linking to the native Tcl
................................................................................
   472    475             %__ECHO% XCOPY sqlite3.pdb "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
   473    476   
   474    477             IF ERRORLEVEL 1 (
   475    478               ECHO Failed to copy "sqlite3.pdb" to "%BINARYDIRECTORY%\%%B\%%D\".
   476    479               GOTO errors
   477    480             )
   478    481           )
          482  +
          483  +        REM
          484  +        REM NOTE: If requested, also build the shell executable.
          485  +        REM
          486  +        IF DEFINED BUILD_ALL_SHELL (
          487  +          REM
          488  +          REM NOTE: If necessary, make sure any previous build output for the
          489  +          REM       shell executable is deleted.
          490  +          REM
          491  +          IF DEFINED NOCLEAN (
          492  +            REM
          493  +            REM NOTE: Even when the cleaning step has been disabled, we still
          494  +            REM       need to remove the build output for all the files we are
          495  +            REM       specifically wanting to build for each platform.
          496  +            REM
          497  +            %_AECHO% Cleaning final shell executable output files only...
          498  +            %__ECHO% DEL /Q sqlite3.exe sqlite3sh.pdb 2%REDIRECT% NUL
          499  +          )
          500  +
          501  +          REM
          502  +          REM NOTE: Call NMAKE with the MSVC makefile to build the "sqlite3.exe"
          503  +          REM       binary.  The x86 compiler will be used to compile the native
          504  +          REM       command line tools needed during the build process itself.
          505  +          REM       Also, disable looking for and/or linking to the native Tcl
          506  +          REM       runtime library.
          507  +          REM
          508  +          %__ECHO% %NMAKE_CMD% sqlite3.exe XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS%
          509  +
          510  +          IF ERRORLEVEL 1 (
          511  +            ECHO Failed to build %%B "sqlite3.exe" for platform %%P.
          512  +            GOTO errors
          513  +          )
          514  +
          515  +          REM
          516  +          REM NOTE: Copy the "sqlite3.exe" file to the appropriate directory
          517  +          REM       for the build and platform beneath the binary directory.
          518  +          REM
          519  +          %__ECHO% XCOPY sqlite3.exe "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
          520  +
          521  +          IF ERRORLEVEL 1 (
          522  +            ECHO Failed to copy "sqlite3.exe" to "%BINARYDIRECTORY%\%%B\%%D\".
          523  +            GOTO errors
          524  +          )
          525  +
          526  +          REM
          527  +          REM NOTE: Copy the "sqlite3sh.pdb" file to the appropriate directory
          528  +          REM       for the build and platform beneath the binary directory
          529  +          REM       unless we are prevented from doing so.
          530  +          REM
          531  +          IF NOT DEFINED NOSYMBOLS (
          532  +            %__ECHO% XCOPY sqlite3sh.pdb "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
          533  +
          534  +            IF ERRORLEVEL 1 (
          535  +              ECHO Failed to copy "sqlite3sh.pdb" to "%BINARYDIRECTORY%\%%B\%%D\".
          536  +              GOTO errors
          537  +            )
          538  +          )
          539  +        )
   479    540         )
   480    541       )
   481    542     )
   482    543   
   483    544     REM
   484    545     REM NOTE: Handle any errors generated during the nested command shell.
   485    546     REM

Changes to tool/showdb.c.

   371    371   static void decodeCell(
   372    372     unsigned char *a,       /* Page content (without the page-1 header) */
   373    373     unsigned pgno,          /* Page number */
   374    374     int iCell,              /* Cell index */
   375    375     int szPgHdr,            /* Size of the page header.  0 or 100 */
   376    376     int ofst                /* Cell begins at a[ofst] */
   377    377   ){
   378         -  int i, j;
          378  +  int i, j = 0;
   379    379     int leftChild;
   380    380     i64 k;
   381    381     i64 nPayload;
   382    382     i64 rowid;
   383    383     i64 nHdr;
   384    384     i64 iType;
   385    385     i64 nLocal;