From 8bc52629150345f7b05a781944f911c18e311749 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 25 Nov 2013 09:36:07 +0000 Subject: [PATCH 01/27] Initial work on isolating usage of the Windows header file. FossilOrigin-Name: 0d42c6b830ee50f45539d73e3948ed3bc50a11d1 --- Makefile.in | 2 ++ Makefile.msc | 2 ++ Makefile.vxworks | 2 ++ main.mk | 2 ++ manifest | 36 +++++++++++--------- manifest.uuid | 2 +- src/mutex_w32.c | 5 +++ src/os.h | 43 ------------------------ src/os_win.c | 10 +++--- src/os_win.h | 67 +++++++++++++++++++++++++++++++++++++ tool/mksqlite3c-noext.tcl | 1 + tool/mksqlite3c.tcl | 1 + tool/mksqlite3internalh.tcl | 1 + 13 files changed, 109 insertions(+), 65 deletions(-) create mode 100644 src/os_win.h diff --git a/Makefile.in b/Makefile.in index a0217c4343..d96d30ae86 100644 --- a/Makefile.in +++ b/Makefile.in @@ -241,6 +241,7 @@ SRC = \ $(TOP)/src/os_common.h \ $(TOP)/src/os_unix.c \ $(TOP)/src/os_win.c \ + $(TOP)/src/os_win.h \ $(TOP)/src/pager.c \ $(TOP)/src/pager.h \ $(TOP)/src/parse.y \ @@ -457,6 +458,7 @@ HDR = \ opcodes.h \ $(TOP)/src/os.h \ $(TOP)/src/os_common.h \ + $(TOP)/src/os_win.h \ $(TOP)/src/pager.h \ $(TOP)/src/pcache.h \ parse.h \ diff --git a/Makefile.msc b/Makefile.msc index 437cb0eac3..afe66baad8 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -628,6 +628,7 @@ SRC = \ $(TOP)\src\os_common.h \ $(TOP)\src\os_unix.c \ $(TOP)\src\os_win.c \ + $(TOP)\src\os_win.h \ $(TOP)\src\pager.c \ $(TOP)\src\pager.h \ $(TOP)\src\parse.y \ @@ -847,6 +848,7 @@ HDR = \ opcodes.h \ $(TOP)\src\os.h \ $(TOP)\src\os_common.h \ + $(TOP)\src\os_win.h \ $(TOP)\src\pager.h \ $(TOP)\src\pcache.h \ parse.h \ diff --git a/Makefile.vxworks b/Makefile.vxworks index c9058da3e5..70b9bdde6b 100644 --- a/Makefile.vxworks +++ b/Makefile.vxworks @@ -264,6 +264,7 @@ SRC = \ $(TOP)/src/os_common.h \ $(TOP)/src/os_unix.c \ $(TOP)/src/os_win.c \ + $(TOP)/src/os_win.h \ $(TOP)/src/pager.c \ $(TOP)/src/pager.h \ $(TOP)/src/parse.y \ @@ -416,6 +417,7 @@ HDR = \ opcodes.h \ $(TOP)/src/os.h \ $(TOP)/src/os_common.h \ + $(TOP)/src/os_win.h \ $(TOP)/src/pager.h \ $(TOP)/src/pcache.h \ parse.h \ diff --git a/main.mk b/main.mk index 41d1743832..4992de549b 100644 --- a/main.mk +++ b/main.mk @@ -123,6 +123,7 @@ SRC = \ $(TOP)/src/os_common.h \ $(TOP)/src/os_unix.c \ $(TOP)/src/os_win.c \ + $(TOP)/src/os_win.h \ $(TOP)/src/pager.c \ $(TOP)/src/pager.h \ $(TOP)/src/parse.y \ @@ -339,6 +340,7 @@ HDR = \ opcodes.h \ $(TOP)/src/os.h \ $(TOP)/src/os_common.h \ + $(TOP)/src/os_win.h \ $(TOP)/src/pager.h \ $(TOP)/src/pcache.h \ parse.h \ diff --git a/manifest b/manifest index aa2b98cdb9..41499ad4d0 100644 --- a/manifest +++ b/manifest @@ -1,10 +1,10 @@ -C Add\sthe\s--scratch\sparameter\sto\sspeedtest1.\s\sImproved\serror\smessages\swhen\nmisconfiguring\smemory\sparameters\sin\sspeedtest1. -D 2013-11-24T01:14:14.123 +C Initial\swork\son\sisolating\susage\sof\sthe\sWindows\sheader\sfile. +D 2013-11-25T09:36:07.707 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in e1a9b4258bbde53f5636f4e238c65b7e11459e2b +F Makefile.in 16254fb023b7e69788013f0da5ccdc2063ba2328 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc a6247094079f3ef97dcd7a69d0e13ff718c7073e -F Makefile.vxworks db21ed42a01d5740e656b16f92cb5d8d5e5dd315 +F Makefile.msc 7e91dccedae82c45dbf91a4e8240c642c2b90c83 +F Makefile.vxworks f921bd6a0600e36d67da080d820ae712ab393f30 F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6 F VERSION 52f7e22bfcec71a462e34194b4ae1671380fde59 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -142,7 +142,7 @@ F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt f439556c5ce01ced70987e5ee86549a45165d9ff -F main.mk 82fd90375561d7b66287ae5a8b09e1e027394019 +F main.mk c9b6d61c55f461543244d63992c63037c3f11dac F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f F mkextw.sh d2a981497b404d6498f5ff3e3b1f3816bdfcb338 @@ -200,13 +200,14 @@ F src/mutex.c d3b66a569368015e0fcb1ac15f81c119f504d3bc F src/mutex.h 5bc526e19dccc412b7ff04642f6fdad3fdfdabea F src/mutex_noop.c 7682796b7d8d39bf1c138248858efcd10c9e1553 F src/mutex_unix.c c3a4e00f96ba068a8dbef34084465979aaf369cc -F src/mutex_w32.c 6108c88e1cb38d8fbb3534b170793815cbedbf97 +F src/mutex_w32.c ab08c0fc54b71979370ca7c8f42fc64a9f211ebb F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30 F src/os.c b4ad71336fd96f97776f75587cd9e8218288f5be -F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f +F src/os.h cd8fd6545d6a936bae05026136324ec8e620c7f8 F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_unix.c 143624d9eabb3b997c59cf594e0d06c56edd43e9 -F src/os_win.c ef091b347d682cb24fc575ac9a6290341af62e2b +F src/os_win.c 423d8f815067f4980cb84abab501374afc9bd039 +F src/os_win.h db1d1d18f56ea2931ba1c2ec25ff4616ae1e581b F src/pager.c 2aa4444ffe86e9282d03bc349a4a5e49bd77c0e8 F src/pager.h f094af9f6ececfaa8a1e93876905a4f34233fb0c F src/parse.y acee1a9958539e21263362b194594c5255ad2fca @@ -1111,10 +1112,10 @@ F tool/mkkeywordhash.c 189d76644e373c7d0864c628deb8ce7b4f403591 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e F tool/mkpragmatab.tcl 78a77b2c554d534c6f2dc903130186ed15715460 F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 -F tool/mksqlite3c-noext.tcl 8bce31074e4cbe631bb7676526a048335f4c9f02 -F tool/mksqlite3c.tcl e2ba20d3f690990079d17f3e5a7417dfb7ada543 +F tool/mksqlite3c-noext.tcl 1407684f6781496421be53841f1259303f0c8be9 +F tool/mksqlite3c.tcl c6b22da4d4ee272afda33f0aeb896d9c2e26dc95 F tool/mksqlite3h.tcl ba24038056f51fde07c0079c41885ab85e2cff12 -F tool/mksqlite3internalh.tcl 3dca7bb5374cee003379b8cbac73714f610ef795 +F tool/mksqlite3internalh.tcl ba0532989220eaef044cbb8c0108eca623d23bbc F tool/mkvsix.tcl 6477fb9dab838b7eea1eed50658ff1cda04850b5 F tool/offsets.c fe4262fdfa378e8f5499a42136d17bf3b98f6091 F tool/omittest.tcl 4665982e95a6e5c1bd806cf7bc3dea95be422d77 @@ -1142,7 +1143,10 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 12e612e8e7c4a6f83acf0daf5608151fb5ec1575 -R d231270eb8540c71c1fe43ad7f945ecf -U drh -Z 904197ecb3cb4ac430a652007d0a071c +P 8f3c767a30c552548ead104ca125f182ce4849ad +R e592d18e44da45424fc95ed6d55c4c01 +T *branch * winHdr +T *sym-winHdr * +T -sym-trunk * +U mistachkin +Z 4118ce5841a2a285e11b8bcc9d8fe99e diff --git a/manifest.uuid b/manifest.uuid index 7967f97b83..586356026f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8f3c767a30c552548ead104ca125f182ce4849ad \ No newline at end of file +0d42c6b830ee50f45539d73e3948ed3bc50a11d1 \ No newline at end of file diff --git a/src/mutex_w32.c b/src/mutex_w32.c index 4b88c17452..2eb852413e 100644 --- a/src/mutex_w32.c +++ b/src/mutex_w32.c @@ -19,6 +19,11 @@ */ #ifdef SQLITE_MUTEX_W32 +/* +** Include the header file for the Windows VFS. +*/ +#include "os_win.h" + /* ** Each recursive mutex is an instance of the following structure. */ diff --git a/src/os.h b/src/os.h index 070a2ddd17..1d438d22cd 100644 --- a/src/os.h +++ b/src/os.h @@ -56,49 +56,6 @@ # endif #endif -#if SQLITE_OS_WIN -# include -#endif - -/* -** Determine if we are dealing with Windows NT. -** -** We ought to be able to determine if we are compiling for win98 or winNT -** using the _WIN32_WINNT macro as follows: -** -** #if defined(_WIN32_WINNT) -** # define SQLITE_OS_WINNT 1 -** #else -** # define SQLITE_OS_WINNT 0 -** #endif -** -** However, vs2005 does not set _WIN32_WINNT by default, as it ought to, -** so the above test does not work. We'll just assume that everything is -** winNT unless the programmer explicitly says otherwise by setting -** SQLITE_OS_WINNT to 0. -*/ -#if SQLITE_OS_WIN && !defined(SQLITE_OS_WINNT) -# define SQLITE_OS_WINNT 1 -#endif - -/* -** Determine if we are dealing with WindowsCE - which has a much -** reduced API. -*/ -#if defined(_WIN32_WCE) -# define SQLITE_OS_WINCE 1 -#else -# define SQLITE_OS_WINCE 0 -#endif - -/* -** Determine if we are dealing with WinRT, which provides only a subset of -** the full Win32 API. -*/ -#if !defined(SQLITE_OS_WINRT) -# define SQLITE_OS_WINRT 0 -#endif - /* If the SET_FULLSYNC macro is not defined above, then make it ** a no-op */ diff --git a/src/os_win.c b/src/os_win.c index a2f5513a2b..343f0f01f0 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -15,16 +15,16 @@ #include "sqliteInt.h" #if SQLITE_OS_WIN /* This file is used for Windows only */ -#ifdef __CYGWIN__ -# include -# include /* amalgamator: keep */ -#endif - /* ** Include code that is common to all os_*.c files */ #include "os_common.h" +/* +** Include the header file for the Windows VFS. +*/ +#include "os_win.h" + /* ** Compiling and using WAL mode requires several APIs that are only ** available in Windows platforms based on the NT kernel. diff --git a/src/os_win.h b/src/os_win.h new file mode 100644 index 0000000000..15e53b1789 --- /dev/null +++ b/src/os_win.h @@ -0,0 +1,67 @@ +/* +** 2013 November 25 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This file contains code that is specific to Windows. +*/ +#ifndef _OS_WIN_H_ +#define _OS_WIN_H_ + +/* +** Include the Windows SDK header file. +*/ +#include "windows.h" + +#ifdef __CYGWIN__ +# include +# include /* amalgamator: keep */ +#endif + +/* +** Determine if we are dealing with Windows NT. +** +** We ought to be able to determine if we are compiling for win98 or winNT +** using the _WIN32_WINNT macro as follows: +** +** #if defined(_WIN32_WINNT) +** # define SQLITE_OS_WINNT 1 +** #else +** # define SQLITE_OS_WINNT 0 +** #endif +** +** However, vs2005 does not set _WIN32_WINNT by default, as it ought to, +** so the above test does not work. We'll just assume that everything is +** winNT unless the programmer explicitly says otherwise by setting +** SQLITE_OS_WINNT to 0. +*/ +#if SQLITE_OS_WIN && !defined(SQLITE_OS_WINNT) +# define SQLITE_OS_WINNT 1 +#endif + +/* +** Determine if we are dealing with WindowsCE - which has a much +** reduced API. +*/ +#if defined(_WIN32_WCE) +# define SQLITE_OS_WINCE 1 +#else +# define SQLITE_OS_WINCE 0 +#endif + +/* +** Determine if we are dealing with WinRT, which provides only a subset of +** the full Win32 API. +*/ +#if !defined(SQLITE_OS_WINRT) +# define SQLITE_OS_WINRT 0 +#endif + +#endif /* _OS_WIN_H_ */ diff --git a/tool/mksqlite3c-noext.tcl b/tool/mksqlite3c-noext.tcl index 017ad6292f..02d9ae5469 100644 --- a/tool/mksqlite3c-noext.tcl +++ b/tool/mksqlite3c-noext.tcl @@ -99,6 +99,7 @@ foreach hdr { mutex.h opcodes.h os_common.h + os_win.h os.h pager.h parse.h diff --git a/tool/mksqlite3c.tcl b/tool/mksqlite3c.tcl index de9b48b97b..e565bcbfe3 100644 --- a/tool/mksqlite3c.tcl +++ b/tool/mksqlite3c.tcl @@ -103,6 +103,7 @@ foreach hdr { mutex.h opcodes.h os_common.h + os_win.h os.h pager.h parse.h diff --git a/tool/mksqlite3internalh.tcl b/tool/mksqlite3internalh.tcl index 406ef5c457..3938316eec 100644 --- a/tool/mksqlite3internalh.tcl +++ b/tool/mksqlite3internalh.tcl @@ -60,6 +60,7 @@ foreach hdr { keywordhash.h opcodes.h os_common.h + os_win.h os.h pager.h parse.h From f3a4c7c2c7159bd7e2d438babc73bb46f821c724 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 25 Nov 2013 09:37:24 +0000 Subject: [PATCH 02/27] Correct line-endings in the new header file. FossilOrigin-Name: 94219b9f1ff59ea408c7ded167ee28b00c0f38c1 --- manifest | 15 +++--- manifest.uuid | 2 +- src/os_win.h | 134 +++++++++++++++++++++++++------------------------- 3 files changed, 74 insertions(+), 77 deletions(-) diff --git a/manifest b/manifest index 41499ad4d0..e8fa1b9203 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Initial\swork\son\sisolating\susage\sof\sthe\sWindows\sheader\sfile. -D 2013-11-25T09:36:07.707 +C Correct\sline-endings\sin\sthe\snew\sheader\sfile. +D 2013-11-25T09:37:24.023 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 16254fb023b7e69788013f0da5ccdc2063ba2328 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -207,7 +207,7 @@ F src/os.h cd8fd6545d6a936bae05026136324ec8e620c7f8 F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_unix.c 143624d9eabb3b997c59cf594e0d06c56edd43e9 F src/os_win.c 423d8f815067f4980cb84abab501374afc9bd039 -F src/os_win.h db1d1d18f56ea2931ba1c2ec25ff4616ae1e581b +F src/os_win.h ac253253d080dc3dd261efe5e98626c4b95e5a26 F src/pager.c 2aa4444ffe86e9282d03bc349a4a5e49bd77c0e8 F src/pager.h f094af9f6ececfaa8a1e93876905a4f34233fb0c F src/parse.y acee1a9958539e21263362b194594c5255ad2fca @@ -1143,10 +1143,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 8f3c767a30c552548ead104ca125f182ce4849ad -R e592d18e44da45424fc95ed6d55c4c01 -T *branch * winHdr -T *sym-winHdr * -T -sym-trunk * +P 0d42c6b830ee50f45539d73e3948ed3bc50a11d1 +R 0e6472b71f09f9a7891e918b85232304 U mistachkin -Z 4118ce5841a2a285e11b8bcc9d8fe99e +Z c441f2886dac757b12ddb73cf4ef6f57 diff --git a/manifest.uuid b/manifest.uuid index 586356026f..910f42306d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0d42c6b830ee50f45539d73e3948ed3bc50a11d1 \ No newline at end of file +94219b9f1ff59ea408c7ded167ee28b00c0f38c1 \ No newline at end of file diff --git a/src/os_win.h b/src/os_win.h index 15e53b1789..6ccd9f4828 100644 --- a/src/os_win.h +++ b/src/os_win.h @@ -1,67 +1,67 @@ -/* -** 2013 November 25 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This file contains code that is specific to Windows. -*/ -#ifndef _OS_WIN_H_ -#define _OS_WIN_H_ - -/* -** Include the Windows SDK header file. -*/ -#include "windows.h" - -#ifdef __CYGWIN__ -# include -# include /* amalgamator: keep */ -#endif - -/* -** Determine if we are dealing with Windows NT. -** -** We ought to be able to determine if we are compiling for win98 or winNT -** using the _WIN32_WINNT macro as follows: -** -** #if defined(_WIN32_WINNT) -** # define SQLITE_OS_WINNT 1 -** #else -** # define SQLITE_OS_WINNT 0 -** #endif -** -** However, vs2005 does not set _WIN32_WINNT by default, as it ought to, -** so the above test does not work. We'll just assume that everything is -** winNT unless the programmer explicitly says otherwise by setting -** SQLITE_OS_WINNT to 0. -*/ -#if SQLITE_OS_WIN && !defined(SQLITE_OS_WINNT) -# define SQLITE_OS_WINNT 1 -#endif - -/* -** Determine if we are dealing with WindowsCE - which has a much -** reduced API. -*/ -#if defined(_WIN32_WCE) -# define SQLITE_OS_WINCE 1 -#else -# define SQLITE_OS_WINCE 0 -#endif - -/* -** Determine if we are dealing with WinRT, which provides only a subset of -** the full Win32 API. -*/ -#if !defined(SQLITE_OS_WINRT) -# define SQLITE_OS_WINRT 0 -#endif - -#endif /* _OS_WIN_H_ */ +/* +** 2013 November 25 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This file contains code that is specific to Windows. +*/ +#ifndef _OS_WIN_H_ +#define _OS_WIN_H_ + +/* +** Include the Windows SDK header file. +*/ +#include "windows.h" + +#ifdef __CYGWIN__ +# include +# include /* amalgamator: keep */ +#endif + +/* +** Determine if we are dealing with Windows NT. +** +** We ought to be able to determine if we are compiling for win98 or winNT +** using the _WIN32_WINNT macro as follows: +** +** #if defined(_WIN32_WINNT) +** # define SQLITE_OS_WINNT 1 +** #else +** # define SQLITE_OS_WINNT 0 +** #endif +** +** However, vs2005 does not set _WIN32_WINNT by default, as it ought to, +** so the above test does not work. We'll just assume that everything is +** winNT unless the programmer explicitly says otherwise by setting +** SQLITE_OS_WINNT to 0. +*/ +#if SQLITE_OS_WIN && !defined(SQLITE_OS_WINNT) +# define SQLITE_OS_WINNT 1 +#endif + +/* +** Determine if we are dealing with WindowsCE - which has a much +** reduced API. +*/ +#if defined(_WIN32_WCE) +# define SQLITE_OS_WINCE 1 +#else +# define SQLITE_OS_WINCE 0 +#endif + +/* +** Determine if we are dealing with WinRT, which provides only a subset of +** the full Win32 API. +*/ +#if !defined(SQLITE_OS_WINRT) +# define SQLITE_OS_WINRT 0 +#endif + +#endif /* _OS_WIN_H_ */ From f74b9e0965bdf30ca8911ca28a5f7ad6e11d6b22 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 26 Nov 2013 01:00:31 +0000 Subject: [PATCH 03/27] Further work on Windows header file reform. FossilOrigin-Name: 540f5525160b516de282136ca77f909115a51630 --- Makefile.in | 2 ++ Makefile.msc | 2 ++ Makefile.vxworks | 2 ++ main.mk | 2 ++ manifest | 37 ++++++++++++------------ manifest.uuid | 2 +- src/os.h | 36 ++---------------------- src/os_setup.h | 56 +++++++++++++++++++++++++++++++++++++ src/test1.c | 4 +++ src/test_config.c | 4 +++ src/test_osinst.c | 7 ++++- src/test_quota.c | 40 ++------------------------ src/test_quota.h | 6 ---- tool/mksqlite3c-noext.tcl | 1 + tool/mksqlite3c.tcl | 1 + tool/mksqlite3internalh.tcl | 1 + 16 files changed, 106 insertions(+), 97 deletions(-) create mode 100644 src/os_setup.h diff --git a/Makefile.in b/Makefile.in index d96d30ae86..d554412348 100644 --- a/Makefile.in +++ b/Makefile.in @@ -239,6 +239,7 @@ SRC = \ $(TOP)/src/os.c \ $(TOP)/src/os.h \ $(TOP)/src/os_common.h \ + $(TOP)/src/os_setup.h \ $(TOP)/src/os_unix.c \ $(TOP)/src/os_win.c \ $(TOP)/src/os_win.h \ @@ -458,6 +459,7 @@ HDR = \ opcodes.h \ $(TOP)/src/os.h \ $(TOP)/src/os_common.h \ + $(TOP)/src/os_setup.h \ $(TOP)/src/os_win.h \ $(TOP)/src/pager.h \ $(TOP)/src/pcache.h \ diff --git a/Makefile.msc b/Makefile.msc index afe66baad8..18dfdf34b7 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -626,6 +626,7 @@ SRC = \ $(TOP)\src\os.c \ $(TOP)\src\os.h \ $(TOP)\src\os_common.h \ + $(TOP)\src\os_setup.h \ $(TOP)\src\os_unix.c \ $(TOP)\src\os_win.c \ $(TOP)\src\os_win.h \ @@ -848,6 +849,7 @@ HDR = \ opcodes.h \ $(TOP)\src\os.h \ $(TOP)\src\os_common.h \ + $(TOP)\src\os_setup.h \ $(TOP)\src\os_win.h \ $(TOP)\src\pager.h \ $(TOP)\src\pcache.h \ diff --git a/Makefile.vxworks b/Makefile.vxworks index 70b9bdde6b..0d9c27f635 100644 --- a/Makefile.vxworks +++ b/Makefile.vxworks @@ -262,6 +262,7 @@ SRC = \ $(TOP)/src/os.c \ $(TOP)/src/os.h \ $(TOP)/src/os_common.h \ + $(TOP)/src/os_setup.h \ $(TOP)/src/os_unix.c \ $(TOP)/src/os_win.c \ $(TOP)/src/os_win.h \ @@ -417,6 +418,7 @@ HDR = \ opcodes.h \ $(TOP)/src/os.h \ $(TOP)/src/os_common.h \ + $(TOP)/src/os_setup.h \ $(TOP)/src/os_win.h \ $(TOP)/src/pager.h \ $(TOP)/src/pcache.h \ diff --git a/main.mk b/main.mk index 4992de549b..904ddd708f 100644 --- a/main.mk +++ b/main.mk @@ -121,6 +121,7 @@ SRC = \ $(TOP)/src/os.c \ $(TOP)/src/os.h \ $(TOP)/src/os_common.h \ + $(TOP)/src/os_setup.h \ $(TOP)/src/os_unix.c \ $(TOP)/src/os_win.c \ $(TOP)/src/os_win.h \ @@ -340,6 +341,7 @@ HDR = \ opcodes.h \ $(TOP)/src/os.h \ $(TOP)/src/os_common.h \ + $(TOP)/src/os_setup.h \ $(TOP)/src/os_win.h \ $(TOP)/src/pager.h \ $(TOP)/src/pcache.h \ diff --git a/manifest b/manifest index 3f9a102e7b..2c2f3db4d5 100644 --- a/manifest +++ b/manifest @@ -1,10 +1,10 @@ -C Merge\supdates\sfrom\strunk. -D 2013-11-26T00:33:25.374 +C Further\swork\son\sWindows\sheader\sfile\sreform. +D 2013-11-26T01:00:31.440 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in 16254fb023b7e69788013f0da5ccdc2063ba2328 +F Makefile.in 5d0d35aef4d0601493f9b26e2f859b3e471b63ed F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc 7e91dccedae82c45dbf91a4e8240c642c2b90c83 -F Makefile.vxworks f921bd6a0600e36d67da080d820ae712ab393f30 +F Makefile.msc d66f5d9f338735e07aa4f6e3c99491421cca24f5 +F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6 F VERSION 52f7e22bfcec71a462e34194b4ae1671380fde59 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -142,7 +142,7 @@ F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt f439556c5ce01ced70987e5ee86549a45165d9ff -F main.mk c9b6d61c55f461543244d63992c63037c3f11dac +F main.mk 6e5cc23140ed3a85716c02376adc86aa11cfb673 F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f F mkextw.sh d2a981497b404d6498f5ff3e3b1f3816bdfcb338 @@ -203,8 +203,9 @@ F src/mutex_unix.c c3a4e00f96ba068a8dbef34084465979aaf369cc F src/mutex_w32.c ab08c0fc54b71979370ca7c8f42fc64a9f211ebb F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30 F src/os.c b4ad71336fd96f97776f75587cd9e8218288f5be -F src/os.h cd8fd6545d6a936bae05026136324ec8e620c7f8 +F src/os.h 60d419395e32a8029fa380a80a3da2e9030f635e F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 +F src/os_setup.h 55a27b7b02b8fb289e16749df17edcc376ba2dfb F src/os_unix.c 143624d9eabb3b997c59cf594e0d06c56edd43e9 F src/os_win.c 99a5668c207bee7fae238209a3043c03b6050056 F src/os_win.h ac253253d080dc3dd261efe5e98626c4b95e5a26 @@ -230,7 +231,7 @@ F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 7ac05a5c7017d0b9f0b4bcd701228b784f987158 F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e F src/tclsqlite.c 3b5f3716e320480659239abe887164521c575d83 -F src/test1.c 5757066e503a8ed51313cb3a5d9bcdcced2991a9 +F src/test1.c 8d96df19f045c629311751ed89c02c374d108e51 F src/test2.c 7355101c085304b90024f2261e056cdff13c6c35 F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df @@ -243,7 +244,7 @@ F src/test_async.c 21e11293a2f72080eda70e1124e9102044531cd8 F src/test_autoext.c dea8a01a7153b9adc97bd26161e4226329546e12 F src/test_backup.c 3875e899222b651e18b662f86e0e50daa946344e F src/test_btree.c 5b89601dcb42a33ba8b820a6b763cc9cb48bac16 -F src/test_config.c 10d0e00dd6315879a6d9fac20bd063c7bbbfb8f8 +F src/test_config.c 3186c5be34de7cd8c47487687e65ca2fb8bf6471 F src/test_demovfs.c 69b2085076654ebc18014cbc6386f04409c959a9 F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc F src/test_fs.c ced436e3d4b8e4681328409b8081051ce614e28f @@ -259,10 +260,10 @@ F src/test_multiplex.c 9f304bf04170c91c0318238d512df2da039eb1c8 F src/test_multiplex.h 110a8c4d356e0aa464ca8730375608a9a0b61ae1 F src/test_mutex.c 293042d623ebba969160f471a82aa1551626454f F src/test_onefile.c 0396f220561f3b4eedc450cef26d40c593c69a25 -F src/test_osinst.c 90a845c8183013d80eccb1f29e8805608516edba +F src/test_osinst.c 3d0340bc31a9f3d8a3547e0272373e80f78dde25 F src/test_pcache.c a5cd24730cb43c5b18629043314548c9169abb00 -F src/test_quota.c 30c64f0ef84734f2231a686df41ed882b0c59bc0 -F src/test_quota.h 8761e463b25e75ebc078bd67d70e39b9c817a0cb +F src/test_quota.c 65f6348fec0f2b3020c907247fb47556b214abb9 +F src/test_quota.h 2a8ad1952d1d2ca9af0ce0465e56e6c023b5e15d F src/test_rtree.c f3d1d12538dccb75fd916e3fa58f250edbdd3b47 F src/test_schema.c cd12a2223c3a394f4d07bb93bdf6d344c5c121b6 F src/test_server.c a2615049954cbb9cfb4a62e18e2f0616e4dc38fe @@ -1113,10 +1114,10 @@ F tool/mkkeywordhash.c 189d76644e373c7d0864c628deb8ce7b4f403591 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e F tool/mkpragmatab.tcl 78a77b2c554d534c6f2dc903130186ed15715460 F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 -F tool/mksqlite3c-noext.tcl 1407684f6781496421be53841f1259303f0c8be9 -F tool/mksqlite3c.tcl c6b22da4d4ee272afda33f0aeb896d9c2e26dc95 +F tool/mksqlite3c-noext.tcl 1712d3d71256ca1f297046619c89e77a4d7c8f6d +F tool/mksqlite3c.tcl db30eeba8bb34561985938438abca200689e8bc0 F tool/mksqlite3h.tcl ba24038056f51fde07c0079c41885ab85e2cff12 -F tool/mksqlite3internalh.tcl ba0532989220eaef044cbb8c0108eca623d23bbc +F tool/mksqlite3internalh.tcl b6514145a7d5321b47e64e19b8116cc44f973eb1 F tool/mkvsix.tcl 6477fb9dab838b7eea1eed50658ff1cda04850b5 F tool/offsets.c fe4262fdfa378e8f5499a42136d17bf3b98f6091 F tool/omittest.tcl 4665982e95a6e5c1bd806cf7bc3dea95be422d77 @@ -1144,7 +1145,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 94219b9f1ff59ea408c7ded167ee28b00c0f38c1 9954327c0febc0ece46f62e05976330a1b82b48f -R 8ba15fb22b38fc61c6334c03ecc16c63 +P c5ab4378756965b0c2ab218e5ec59c40898b89ea +R 3f71be42bb92a89017dddc2d61b45fe7 U mistachkin -Z a3a638752bfaa9f69bc41b7e3e5dbf34 +Z beeb2b639ff26c8bb19c3f48e2444291 diff --git a/manifest.uuid b/manifest.uuid index b8c2a58092..5a187b121e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c5ab4378756965b0c2ab218e5ec59c40898b89ea \ No newline at end of file +540f5525160b516de282136ca77f909115a51630 \ No newline at end of file diff --git a/src/os.h b/src/os.h index 1d438d22cd..3920a62ee3 100644 --- a/src/os.h +++ b/src/os.h @@ -21,40 +21,10 @@ #define _SQLITE_OS_H_ /* -** Figure out if we are dealing with Unix, Windows, or some other -** operating system. After the following block of preprocess macros, -** all of SQLITE_OS_UNIX, SQLITE_OS_WIN, and SQLITE_OS_OTHER -** will defined to either 1 or 0. One of the four will be 1. The other -** three will be 0. +** Attempt to automatically detect the operating system and setup the +** necessary pre-processor macros for it. */ -#if defined(SQLITE_OS_OTHER) -# if SQLITE_OS_OTHER==1 -# undef SQLITE_OS_UNIX -# define SQLITE_OS_UNIX 0 -# undef SQLITE_OS_WIN -# define SQLITE_OS_WIN 0 -# else -# undef SQLITE_OS_OTHER -# endif -#endif -#if !defined(SQLITE_OS_UNIX) && !defined(SQLITE_OS_OTHER) -# define SQLITE_OS_OTHER 0 -# ifndef SQLITE_OS_WIN -# if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__) -# define SQLITE_OS_WIN 1 -# define SQLITE_OS_UNIX 0 -# else -# define SQLITE_OS_WIN 0 -# define SQLITE_OS_UNIX 1 -# endif -# else -# define SQLITE_OS_UNIX 0 -# endif -#else -# ifndef SQLITE_OS_WIN -# define SQLITE_OS_WIN 0 -# endif -#endif +#include "os_setup.h" /* If the SET_FULLSYNC macro is not defined above, then make it ** a no-op diff --git a/src/os_setup.h b/src/os_setup.h new file mode 100644 index 0000000000..b04fbf7cf6 --- /dev/null +++ b/src/os_setup.h @@ -0,0 +1,56 @@ +/* +** 2013 November 25 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This file contains code that is specific to Windows. +*/ +#ifndef _OS_SETUP_H_ +#define _OS_SETUP_H_ + +/* +** Figure out if we are dealing with Unix, Windows, or some other operating +** system. +** +** After the following block of preprocess macros, all of SQLITE_OS_UNIX, +** SQLITE_OS_WIN, and SQLITE_OS_OTHER will defined to either 1 or 0. One of +** the four will be 1. The other three will be 0. +*/ +#if defined(SQLITE_OS_OTHER) +# if SQLITE_OS_OTHER==1 +# undef SQLITE_OS_UNIX +# define SQLITE_OS_UNIX 0 +# undef SQLITE_OS_WIN +# define SQLITE_OS_WIN 0 +# else +# undef SQLITE_OS_OTHER +# endif +#endif +#if !defined(SQLITE_OS_UNIX) && !defined(SQLITE_OS_OTHER) +# define SQLITE_OS_OTHER 0 +# ifndef SQLITE_OS_WIN +# if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || \ + defined(__MINGW32__) || defined(__BORLANDC__) +# define SQLITE_OS_WIN 1 +# define SQLITE_OS_UNIX 0 +# else +# define SQLITE_OS_WIN 0 +# define SQLITE_OS_UNIX 1 +# endif +# else +# define SQLITE_OS_UNIX 0 +# endif +#else +# ifndef SQLITE_OS_WIN +# define SQLITE_OS_WIN 0 +# endif +#endif + +#endif /* _OS_SETUP_H_ */ diff --git a/src/test1.c b/src/test1.c index d8a9e52d21..88e42b2d76 100644 --- a/src/test1.c +++ b/src/test1.c @@ -14,6 +14,10 @@ ** testing of the SQLite library. */ #include "sqliteInt.h" +#if SQLITE_OS_WIN +# include "os_win.h" +#endif + #include "vdbeInt.h" #include "tcl.h" #include diff --git a/src/test_config.c b/src/test_config.c index f44be40508..e5d5d0739d 100644 --- a/src/test_config.c +++ b/src/test_config.c @@ -20,6 +20,10 @@ #include "sqliteLimit.h" #include "sqliteInt.h" +#if SQLITE_OS_WIN +# include "os_win.h" +#endif + #include "tcl.h" #include #include diff --git a/src/test_osinst.c b/src/test_osinst.c index 531433313e..1701def159 100644 --- a/src/test_osinst.c +++ b/src/test_osinst.c @@ -70,6 +70,12 @@ */ #include "sqlite3.h" + +#include "os_setup.h" +#if SQLITE_OS_WIN +# include "os_win.h" +#endif + #include #include @@ -221,7 +227,6 @@ static sqlite3_uint64 vfslog_time(){ return sTime.tv_usec + (sqlite3_uint64)sTime.tv_sec * 1000000; } #elif SQLITE_OS_WIN -#include #include static sqlite3_uint64 vfslog_time(){ FILETIME ft; diff --git a/src/test_quota.c b/src/test_quota.c index e590996ca4..80ebd0589e 100644 --- a/src/test_quota.c +++ b/src/test_quota.c @@ -44,49 +44,13 @@ #define sqlite3_mutex_notheld(X) ((void)(X),1) #endif /* SQLITE_THREADSAFE==0 */ - -/* -** Figure out if we are dealing with Unix, Windows, or some other -** operating system. After the following block of preprocess macros, -** all of SQLITE_OS_UNIX, SQLITE_OS_WIN, and SQLITE_OS_OTHER -** will defined to either 1 or 0. One of the four will be 1. The other -** three will be 0. -*/ -#if defined(SQLITE_OS_OTHER) -# if SQLITE_OS_OTHER==1 -# undef SQLITE_OS_UNIX -# define SQLITE_OS_UNIX 0 -# undef SQLITE_OS_WIN -# define SQLITE_OS_WIN 0 -# else -# undef SQLITE_OS_OTHER -# endif -#endif -#if !defined(SQLITE_OS_UNIX) && !defined(SQLITE_OS_OTHER) -# define SQLITE_OS_OTHER 0 -# ifndef SQLITE_OS_WIN -# if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) \ - || defined(__MINGW32__) || defined(__BORLANDC__) -# define SQLITE_OS_WIN 1 -# define SQLITE_OS_UNIX 0 -# else -# define SQLITE_OS_WIN 0 -# define SQLITE_OS_UNIX 1 -# endif -# else -# define SQLITE_OS_UNIX 0 -# endif -#else -# ifndef SQLITE_OS_WIN -# define SQLITE_OS_WIN 0 -# endif -#endif +#include "os_setup.h" #if SQLITE_OS_UNIX # include #endif #if SQLITE_OS_WIN -# include +# include "os_win.h" # include #endif diff --git a/src/test_quota.h b/src/test_quota.h index 2d0767a19a..c17e15adca 100644 --- a/src/test_quota.h +++ b/src/test_quota.h @@ -31,12 +31,6 @@ #include #include #include -#if SQLITE_OS_UNIX -# include -#endif -#if SQLITE_OS_WIN -# include -#endif /* Make this callable from C++ */ #ifdef __cplusplus diff --git a/tool/mksqlite3c-noext.tcl b/tool/mksqlite3c-noext.tcl index 02d9ae5469..ecb9cb0439 100644 --- a/tool/mksqlite3c-noext.tcl +++ b/tool/mksqlite3c-noext.tcl @@ -99,6 +99,7 @@ foreach hdr { mutex.h opcodes.h os_common.h + os_setup.h os_win.h os.h pager.h diff --git a/tool/mksqlite3c.tcl b/tool/mksqlite3c.tcl index e565bcbfe3..cdfba7add7 100644 --- a/tool/mksqlite3c.tcl +++ b/tool/mksqlite3c.tcl @@ -103,6 +103,7 @@ foreach hdr { mutex.h opcodes.h os_common.h + os_setup.h os_win.h os.h pager.h diff --git a/tool/mksqlite3internalh.tcl b/tool/mksqlite3internalh.tcl index 3938316eec..7e92b3ad7d 100644 --- a/tool/mksqlite3internalh.tcl +++ b/tool/mksqlite3internalh.tcl @@ -60,6 +60,7 @@ foreach hdr { keywordhash.h opcodes.h os_common.h + os_setup.h os_win.h os.h pager.h From 2e72791781e674f009d1cf534c740e9434d7b6e9 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 26 Nov 2013 01:13:18 +0000 Subject: [PATCH 04/27] Fix comment. FossilOrigin-Name: 8364af392da2946acd84633b45684e6fba5c39ed --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/os_setup.h | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 2c2f3db4d5..7076746d4d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Further\swork\son\sWindows\sheader\sfile\sreform. -D 2013-11-26T01:00:31.440 +C Fix\scomment. +D 2013-11-26T01:13:18.839 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5d0d35aef4d0601493f9b26e2f859b3e471b63ed F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -205,7 +205,7 @@ F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30 F src/os.c b4ad71336fd96f97776f75587cd9e8218288f5be F src/os.h 60d419395e32a8029fa380a80a3da2e9030f635e F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 -F src/os_setup.h 55a27b7b02b8fb289e16749df17edcc376ba2dfb +F src/os_setup.h 3f9e87d981eef070c8a11e76b4704842a0e5870f F src/os_unix.c 143624d9eabb3b997c59cf594e0d06c56edd43e9 F src/os_win.c 99a5668c207bee7fae238209a3043c03b6050056 F src/os_win.h ac253253d080dc3dd261efe5e98626c4b95e5a26 @@ -1145,7 +1145,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P c5ab4378756965b0c2ab218e5ec59c40898b89ea -R 3f71be42bb92a89017dddc2d61b45fe7 +P 540f5525160b516de282136ca77f909115a51630 +R 4b6ba147833b38d11479654f460b02e2 U mistachkin -Z beeb2b639ff26c8bb19c3f48e2444291 +Z d79a165fcb75b9e4bfcba919773d7cea diff --git a/manifest.uuid b/manifest.uuid index 5a187b121e..aa49d27844 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -540f5525160b516de282136ca77f909115a51630 \ No newline at end of file +8364af392da2946acd84633b45684e6fba5c39ed \ No newline at end of file diff --git a/src/os_setup.h b/src/os_setup.h index b04fbf7cf6..5b010b894e 100644 --- a/src/os_setup.h +++ b/src/os_setup.h @@ -10,7 +10,8 @@ ** ****************************************************************************** ** -** This file contains code that is specific to Windows. +** This file contains pre-processor directives related to operating system +** detection and/or setup. */ #ifndef _OS_SETUP_H_ #define _OS_SETUP_H_ From 491451dead1b8848897cf80059f2255866514dce Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 18 Feb 2014 05:18:36 +0000 Subject: [PATCH 05/27] Enhance the Win32 VFS I/O retry logic. FossilOrigin-Name: adba783c702b05f83e0bee3eb1bc9e40cdec3785 --- manifest | 17 ++++++++++------- manifest.uuid | 2 +- src/os_win.c | 37 ++++++++++++++++++++++++++++++++++--- 3 files changed, 45 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 4606d87635..84d15c6531 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sVdbeCoverage()\sand\sVdbeCoverageIf()\smacros\sfor\simproved\sVDBE\scoverage\ntesting. -D 2014-02-18T03:07:12.342 +C Enhance\sthe\sWin32\sVFS\sI/O\sretry\slogic. +D 2014-02-18T05:18:36.863 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -203,7 +203,7 @@ F src/os.c 1b147e4cf7cc39e618115c14a086aed44bc91ace F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_unix.c 18f7f95dc6bcb9cf4d4a238d8e2de96611bc2ae5 -F src/os_win.c d4284f003445054a26689f1264b1b9bf7261bd1b +F src/os_win.c 5c0f315a7cfb513b7151c87a0699a8ad0bc1acb2 F src/pager.c 0ffa313a30ed6d061d9c6601b7b175cc50a1cab7 F src/pager.h ffd5607f7b3e4590b415b007a4382f693334d428 F src/parse.y cce844ccb80b5f969b04c25100c8d94338488efb @@ -1151,7 +1151,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 915f6f1c7aab54583729e60bdc1565f25ecc6f74 -R d0043e1267f21a1ea521214d42169c3d -U drh -Z f5a439caf79133298419241dae122f4e +P b92d31a97d5fe4606d9ae1393c7f3e052f46bf5a +R 36c4c6416a0341396e2a781bd502abeb +T *branch * winIoRetry +T *sym-winIoRetry * +T -sym-trunk * +U mistachkin +Z b9d60eef2d6576ef4d346ab00acfffd9 diff --git a/manifest.uuid b/manifest.uuid index 2e856727c0..02a7c49e96 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b92d31a97d5fe4606d9ae1393c7f3e052f46bf5a \ No newline at end of file +adba783c702b05f83e0bee3eb1bc9e40cdec3785 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index d393c0d016..616616d0df 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -1836,6 +1836,32 @@ static int winLogErrorAtLine( static int winIoerrRetry = SQLITE_WIN32_IOERR_RETRY; static int winIoerrRetryDelay = SQLITE_WIN32_IOERR_RETRY_DELAY; +/* +** The "winIoerrCanRetry1" macro is used to determine if a particular I/O +** error code obtained via GetLastError() is eligible to be retried. It +** must accept the error code DWORD as its only argument and should return +** non-zero if the error code is transient in nature and the operation +** responsible for generating the original error might succeed upon being +** retried. The argument to this macro should be a variable. +** +** Additionally, a macro named "winIoerrCanRetry2" may be defined. If it +** is defined, it will be consulted only when the macro "winIoerrCanRetry1" +** returns zero. The "winIoerrCanRetry2" macro is completely optional and +** may be used to include additional error codes in the set that should +** result in the failing I/O operation being retried by the caller. If +** defined, the "winIoerrCanRetry2" macro must exhibit external semantics +** identical to those of the "winIoerrCanRetry1" macro. +*/ +#if !defined(winIoerrCanRetry1) +#define winIoerrCanRetry1(a) (((a)==ERROR_ACCESS_DENIED) || \ + ((a)==ERROR_SHARING_VIOLATION) || \ + ((a)==ERROR_LOCK_VIOLATION) || \ + ((a)==ERROR_DEV_NOT_EXIST) || \ + ((a)==ERROR_NETNAME_DELETED) || \ + ((a)==ERROR_SEM_TIMEOUT) || \ + ((a)==ERROR_NETWORK_UNREACHABLE)) +#endif + /* ** If a ReadFile() or WriteFile() error occurs, invoke this routine ** to see if it should be retried. Return TRUE to retry. Return FALSE @@ -1849,13 +1875,18 @@ static int winRetryIoerr(int *pnRetry, DWORD *pError){ } return 0; } - if( e==ERROR_ACCESS_DENIED || - e==ERROR_LOCK_VIOLATION || - e==ERROR_SHARING_VIOLATION ){ + if( winIoerrCanRetry1(e) ){ sqlite3_win32_sleep(winIoerrRetryDelay*(1+*pnRetry)); ++*pnRetry; return 1; } +#if defined(winIoerrCanRetry2) + else if( winIoerrCanRetry2(e) ){ + sqlite3_win32_sleep(winIoerrRetryDelay*(1+*pnRetry)); + ++*pnRetry; + return 1; + } +#endif if( pError ){ *pError = e; } From 0bf8277196ff168f7b581ff5d523c98d0a4ca0b5 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 22 Apr 2014 19:30:00 +0000 Subject: [PATCH 06/27] Add the win32-none VFS which omits rollback-journal locking. FossilOrigin-Name: 03e3c5a8b17a219a49bfbe79b7debd27ace8ad85 --- manifest | 15 +++++++++------ manifest.uuid | 2 +- src/os_win.c | 39 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 48 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 7f4e9189fd..9f24411d5f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Comment\stweaks\son\sthe\stest\scase\sfor\sthe\s[b75a9ca6b0]\sbug\sfix. -D 2014-04-21T13:36:54.639 +C Add\sthe\swin32-none\sVFS\swhich\somits\srollback-journal\slocking. +D 2014-04-22T19:30:00.797 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -204,7 +204,7 @@ F src/os.c 1b147e4cf7cc39e618115c14a086aed44bc91ace F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_unix.c ae4b5240af4619d711301d7992396e182585269f -F src/os_win.c e71678ac927d0a0fb11d993db20a9748eabf808e +F src/os_win.c a49ee67a07d7aff98bd9793e7ac8c68ee12712b4 F src/pager.c ab62a24218d87dda1be641f6c5ad291bff78fd94 F src/pager.h ffd5607f7b3e4590b415b007a4382f693334d428 F src/parse.y 22d6a074e5f5a7258947a1dc55a9bf946b765dd0 @@ -1161,7 +1161,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P de9a490f594183f337a2ec9e0f87792eac83548b -R ce888b84132e0cad3bcca115a32951d3 +P 65d2544af9adc1e2f1d193e57f8be0422fb0d5eb +R a9779ff2bb2c9843026c8b0117f1fe75 +T *branch * win32-none +T *sym-win32-none * +T -sym-trunk * U drh -Z cf9f241149456ab1fa24984e95a412d2 +Z d17256f50e94b0475de531ab714c2ce7 diff --git a/manifest.uuid b/manifest.uuid index a2761a597b..0a5654bde9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -65d2544af9adc1e2f1d193e57f8be0422fb0d5eb \ No newline at end of file +03e3c5a8b17a219a49bfbe79b7debd27ace8ad85 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 287dad3b57..6b22fab20a 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -275,6 +275,7 @@ struct winFile { #define WINFILE_RDONLY 0x02 /* Connection is read only */ #define WINFILE_PERSIST_WAL 0x04 /* Persistent WAL mode */ #define WINFILE_PSOW 0x10 /* SQLITE_IOCAP_POWERSAFE_OVERWRITE */ +#define WINFILE_NOLOCK 0x20 /* Never do any real locking */ /* * The size of the buffer used by sqlite3_win32_write_debug(). @@ -2859,6 +2860,9 @@ static int winLock(sqlite3_file *id, int locktype){ assert( id!=0 ); OSTRACE(("LOCK file=%p, oldLock=%d(%d), newLock=%d\n", pFile->h, pFile->locktype, pFile->sharedLockByte, locktype)); + if( pFile->ctrlFlags & WINFILE_NOLOCK ){ + return SQLITE_OK; + } /* If there is already a lock of this type or more restrictive on the ** OsFile, do nothing. Don't use the end_lock: exit path, as @@ -2986,7 +2990,9 @@ static int winCheckReservedLock(sqlite3_file *id, int *pResOut){ OSTRACE(("TEST-WR-LOCK file=%p, pResOut=%p\n", pFile->h, pResOut)); assert( id!=0 ); - if( pFile->locktype>=RESERVED_LOCK ){ + if( pFile->ctrlFlags & WINFILE_NOLOCK ){ + rc = 0; + }else if( pFile->locktype>=RESERVED_LOCK ){ rc = 1; OSTRACE(("TEST-WR-LOCK file=%p, rc=%d (local)\n", pFile->h, rc)); }else{ @@ -3022,6 +3028,9 @@ static int winUnlock(sqlite3_file *id, int locktype){ assert( locktype<=SHARED_LOCK ); OSTRACE(("UNLOCK file=%p, oldLock=%d(%d), newLock=%d\n", pFile->h, pFile->locktype, pFile->sharedLockByte, locktype)); + if( pFile->ctrlFlags & WINFILE_NOLOCK ){ + return SQLITE_OK; + } type = pFile->locktype; if( type>=EXCLUSIVE_LOCK ){ winUnlockFile(&pFile->h, SHARED_FIRST, 0, SHARED_SIZE, 0); @@ -4692,6 +4701,9 @@ static int winOpen( if( sqlite3_uri_boolean(zName, "psow", SQLITE_POWERSAFE_OVERWRITE) ){ pFile->ctrlFlags |= WINFILE_PSOW; } + if( strcmp(pVfs->zName,"win32-none")==0 ){ + pFile->ctrlFlags |= WINFILE_NOLOCK; + } pFile->lastErrno = NO_ERROR; pFile->zPath = zName; #if SQLITE_MAX_MMAP_SIZE>0 @@ -5416,6 +5428,30 @@ int sqlite3_os_init(void){ winNextSystemCall, /* xNextSystemCall */ }; #endif + static sqlite3_vfs winNoneVfs = { + 3, /* iVersion */ + sizeof(winFile), /* szOsFile */ + SQLITE_WIN32_MAX_PATH_BYTES, /* mxPathname */ + 0, /* pNext */ + "win32-none", /* zName */ + 0, /* pAppData */ + winOpen, /* xOpen */ + winDelete, /* xDelete */ + winAccess, /* xAccess */ + winFullPathname, /* xFullPathname */ + winDlOpen, /* xDlOpen */ + winDlError, /* xDlError */ + winDlSym, /* xDlSym */ + winDlClose, /* xDlClose */ + winRandomness, /* xRandomness */ + winSleep, /* xSleep */ + winCurrentTime, /* xCurrentTime */ + winGetLastError, /* xGetLastError */ + winCurrentTimeInt64, /* xCurrentTimeInt64 */ + winSetSystemCall, /* xSetSystemCall */ + winGetSystemCall, /* xGetSystemCall */ + winNextSystemCall, /* xNextSystemCall */ + }; /* Double-check that the aSyscall[] array has been constructed ** correctly. See ticket [bb3a86e890c8e96ab] */ @@ -5432,6 +5468,7 @@ int sqlite3_os_init(void){ assert( winSysInfo.dwPageSize>0 ); sqlite3_vfs_register(&winVfs, 1); + sqlite3_vfs_register(&winNoneVfs, 0); #if defined(SQLITE_WIN32_HAS_WIDE) sqlite3_vfs_register(&winLongPathVfs, 0); From 9df245b07385378bb7d9054e5f722ec7c283946b Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 22 Apr 2014 19:34:16 +0000 Subject: [PATCH 07/27] Add some OSTRACE calls for consistency. FossilOrigin-Name: be292d559748a24ff012266a1f58ce6c027e0411 --- manifest | 17 +++++++---------- manifest.uuid | 2 +- src/os_win.c | 3 +++ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 9f24411d5f..cea8c644a2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\swin32-none\sVFS\swhich\somits\srollback-journal\slocking. -D 2014-04-22T19:30:00.797 +C Add\ssome\sOSTRACE\scalls\sfor\sconsistency. +D 2014-04-22T19:34:16.263 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -204,7 +204,7 @@ F src/os.c 1b147e4cf7cc39e618115c14a086aed44bc91ace F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_unix.c ae4b5240af4619d711301d7992396e182585269f -F src/os_win.c a49ee67a07d7aff98bd9793e7ac8c68ee12712b4 +F src/os_win.c 8c74fd4c2a7e2478e0b05530a51af4049acfcc43 F src/pager.c ab62a24218d87dda1be641f6c5ad291bff78fd94 F src/pager.h ffd5607f7b3e4590b415b007a4382f693334d428 F src/parse.y 22d6a074e5f5a7258947a1dc55a9bf946b765dd0 @@ -1161,10 +1161,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 65d2544af9adc1e2f1d193e57f8be0422fb0d5eb -R a9779ff2bb2c9843026c8b0117f1fe75 -T *branch * win32-none -T *sym-win32-none * -T -sym-trunk * -U drh -Z d17256f50e94b0475de531ab714c2ce7 +P 03e3c5a8b17a219a49bfbe79b7debd27ace8ad85 +R 173fb04236ec33d12e5d272efbb7cda6 +U mistachkin +Z 7e8fdfc3e14c55c25e98572df7e0ac54 diff --git a/manifest.uuid b/manifest.uuid index 0a5654bde9..7c3c02fbb8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -03e3c5a8b17a219a49bfbe79b7debd27ace8ad85 \ No newline at end of file +be292d559748a24ff012266a1f58ce6c027e0411 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 6b22fab20a..7d1b1af92a 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -2861,6 +2861,7 @@ static int winLock(sqlite3_file *id, int locktype){ OSTRACE(("LOCK file=%p, oldLock=%d(%d), newLock=%d\n", pFile->h, pFile->locktype, pFile->sharedLockByte, locktype)); if( pFile->ctrlFlags & WINFILE_NOLOCK ){ + OSTRACE(("LOCK-NOP file=%p, rc=SQLITE_OK\n", pFile->h)); return SQLITE_OK; } @@ -2992,6 +2993,7 @@ static int winCheckReservedLock(sqlite3_file *id, int *pResOut){ assert( id!=0 ); if( pFile->ctrlFlags & WINFILE_NOLOCK ){ rc = 0; + OSTRACE(("TEST-WR-LOCK file=%p, rc=%d (nop)\n", pFile->h, rc)); }else if( pFile->locktype>=RESERVED_LOCK ){ rc = 1; OSTRACE(("TEST-WR-LOCK file=%p, rc=%d (local)\n", pFile->h, rc)); @@ -3029,6 +3031,7 @@ static int winUnlock(sqlite3_file *id, int locktype){ OSTRACE(("UNLOCK file=%p, oldLock=%d(%d), newLock=%d\n", pFile->h, pFile->locktype, pFile->sharedLockByte, locktype)); if( pFile->ctrlFlags & WINFILE_NOLOCK ){ + OSTRACE(("UNLOCK-NOP file=%p, rc=SQLITE_OK\n", pFile->h)); return SQLITE_OK; } type = pFile->locktype; From f34a9fef4c285a14d2b3213d033512a0607eb1e4 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 22 Apr 2014 19:42:22 +0000 Subject: [PATCH 08/27] Change from using the win32-none VFS to just a query parameter. FossilOrigin-Name: ffceacf61905dc3553978ba5f68e133947eca2fa --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_win.c | 27 +-------------------------- 3 files changed, 9 insertions(+), 34 deletions(-) diff --git a/manifest b/manifest index cea8c644a2..f71432393e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\ssome\sOSTRACE\scalls\sfor\sconsistency. -D 2014-04-22T19:34:16.263 +C Change\sfrom\susing\sthe\swin32-none\sVFS\sto\sjust\sa\squery\sparameter. +D 2014-04-22T19:42:22.086 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -204,7 +204,7 @@ F src/os.c 1b147e4cf7cc39e618115c14a086aed44bc91ace F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_unix.c ae4b5240af4619d711301d7992396e182585269f -F src/os_win.c 8c74fd4c2a7e2478e0b05530a51af4049acfcc43 +F src/os_win.c 1662c40d22be162698a31725e836eede09e841ed F src/pager.c ab62a24218d87dda1be641f6c5ad291bff78fd94 F src/pager.h ffd5607f7b3e4590b415b007a4382f693334d428 F src/parse.y 22d6a074e5f5a7258947a1dc55a9bf946b765dd0 @@ -1161,7 +1161,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 03e3c5a8b17a219a49bfbe79b7debd27ace8ad85 -R 173fb04236ec33d12e5d272efbb7cda6 -U mistachkin -Z 7e8fdfc3e14c55c25e98572df7e0ac54 +P be292d559748a24ff012266a1f58ce6c027e0411 +R f3c1c9d0a2061a78351193fe4c39a447 +U drh +Z 55529acaca6c8896715e4d74b5257ddb diff --git a/manifest.uuid b/manifest.uuid index 7c3c02fbb8..fb9c97c16a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -be292d559748a24ff012266a1f58ce6c027e0411 \ No newline at end of file +ffceacf61905dc3553978ba5f68e133947eca2fa \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 7d1b1af92a..bf5b9c72d1 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -4704,7 +4704,7 @@ static int winOpen( if( sqlite3_uri_boolean(zName, "psow", SQLITE_POWERSAFE_OVERWRITE) ){ pFile->ctrlFlags |= WINFILE_PSOW; } - if( strcmp(pVfs->zName,"win32-none")==0 ){ + if( sqlite3_uri_boolean(zName, "nolock", 0) ){ pFile->ctrlFlags |= WINFILE_NOLOCK; } pFile->lastErrno = NO_ERROR; @@ -5431,30 +5431,6 @@ int sqlite3_os_init(void){ winNextSystemCall, /* xNextSystemCall */ }; #endif - static sqlite3_vfs winNoneVfs = { - 3, /* iVersion */ - sizeof(winFile), /* szOsFile */ - SQLITE_WIN32_MAX_PATH_BYTES, /* mxPathname */ - 0, /* pNext */ - "win32-none", /* zName */ - 0, /* pAppData */ - winOpen, /* xOpen */ - winDelete, /* xDelete */ - winAccess, /* xAccess */ - winFullPathname, /* xFullPathname */ - winDlOpen, /* xDlOpen */ - winDlError, /* xDlError */ - winDlSym, /* xDlSym */ - winDlClose, /* xDlClose */ - winRandomness, /* xRandomness */ - winSleep, /* xSleep */ - winCurrentTime, /* xCurrentTime */ - winGetLastError, /* xGetLastError */ - winCurrentTimeInt64, /* xCurrentTimeInt64 */ - winSetSystemCall, /* xSetSystemCall */ - winGetSystemCall, /* xGetSystemCall */ - winNextSystemCall, /* xNextSystemCall */ - }; /* Double-check that the aSyscall[] array has been constructed ** correctly. See ticket [bb3a86e890c8e96ab] */ @@ -5471,7 +5447,6 @@ int sqlite3_os_init(void){ assert( winSysInfo.dwPageSize>0 ); sqlite3_vfs_register(&winVfs, 1); - sqlite3_vfs_register(&winNoneVfs, 0); #if defined(SQLITE_WIN32_HAS_WIDE) sqlite3_vfs_register(&winLongPathVfs, 0); From d1ae96d39e7fe67db42aebb3613a22d88809daf4 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 1 May 2014 01:13:08 +0000 Subject: [PATCH 09/27] Add the immutable=TRUE query parameter and SQLITE_IOCAP_IMMUTABLE, either of which prevents locking of the database and omits tests for existance of journal files. FossilOrigin-Name: 71f152c85d79ebd9ca48bc9c4c71fc4debaf2437 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/pager.c | 51 +++++++++++++++++++++++++++---------------------- src/sqlite.h.in | 6 +++++- 4 files changed, 41 insertions(+), 32 deletions(-) diff --git a/manifest b/manifest index 25f2d0b735..9473264928 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\sin\sall\srecent\schanges\sand\senhancements\sfrom\strunk. -D 2014-04-30T20:32:41.139 +C Add\sthe\simmutable=TRUE\squery\sparameter\sand\sSQLITE_IOCAP_IMMUTABLE,\seither\nof\swhich\sprevents\slocking\sof\sthe\sdatabase\sand\somits\stests\sfor\sexistance\nof\sjournal\sfiles. +D 2014-05-01T01:13:08.624 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -206,7 +206,7 @@ F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_unix.c ae4b5240af4619d711301d7992396e182585269f F src/os_win.c 1662c40d22be162698a31725e836eede09e841ed -F src/pager.c ab62a24218d87dda1be641f6c5ad291bff78fd94 +F src/pager.c 5c296b584df0d675e2377196472ff8a993ad079d F src/pager.h ffd5607f7b3e4590b415b007a4382f693334d428 F src/parse.y 22d6a074e5f5a7258947a1dc55a9bf946b765dd0 F src/pcache.c d8eafac28290d4bb80332005435db44991d07fc2 @@ -220,7 +220,7 @@ F src/resolve.c 273d5f47c4e2c05b2d3d2bffeda939551ab59e66 F src/rowset.c a9c9aae3234b44a6d7c6f5a3cadf90dce1e627be F src/select.c ed459f7f478a1e533d19c4b953693b3ffa2efd15 F src/shell.c 2afe7a7154e97be0c74c5feacf09626bda8493be -F src/sqlite.h.in bde98816e1ba0c9ffef50afe7b32f4e5a8f54fe0 +F src/sqlite.h.in ad2bbeb6a41c228f6a9dbf24df62e4d3eff79ee5 F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc F src/sqliteInt.h b2947801eccefd7ba3e5f14e1353289351a83cf3 @@ -1166,7 +1166,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P ffceacf61905dc3553978ba5f68e133947eca2fa 9bbca48b42e4fe16f2188e18dc736da30a96435c -R de599c68866896adcd34d6a6ff4634e0 +P 84243f844417f888ab731841f7dbf95749f6e034 +R 5c0369593ee1e8996babaee6957b771b U drh -Z adbf9541c1c60ea64244c304cb7bb6d4 +Z 54ea9e774afb5e969c7607c1ec92b0eb diff --git a/manifest.uuid b/manifest.uuid index 2b647b0726..717b11ca0b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -84243f844417f888ab731841f7dbf95749f6e034 \ No newline at end of file +71f152c85d79ebd9ca48bc9c4c71fc4debaf2437 \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index b09d6cb930..78f2cae020 100644 --- a/src/pager.c +++ b/src/pager.c @@ -4674,30 +4674,37 @@ int sqlite3PagerOpen( ** + The value returned by sqlite3OsSectorSize() ** + The largest page size that can be written atomically. */ - if( rc==SQLITE_OK && !readOnly ){ - setSectorSize(pPager); - assert(SQLITE_DEFAULT_PAGE_SIZE<=SQLITE_MAX_DEFAULT_PAGE_SIZE); - if( szPageDfltsectorSize ){ - if( pPager->sectorSize>SQLITE_MAX_DEFAULT_PAGE_SIZE ){ - szPageDflt = SQLITE_MAX_DEFAULT_PAGE_SIZE; - }else{ - szPageDflt = (u32)pPager->sectorSize; - } - } -#ifdef SQLITE_ENABLE_ATOMIC_WRITE - { + if( rc==SQLITE_OK ){ + if( !readOnly ){ int iDc = sqlite3OsDeviceCharacteristics(pPager->fd); - int ii; - assert(SQLITE_IOCAP_ATOMIC512==(512>>8)); - assert(SQLITE_IOCAP_ATOMIC64K==(65536>>8)); - assert(SQLITE_MAX_DEFAULT_PAGE_SIZE<=65536); - for(ii=szPageDflt; ii<=SQLITE_MAX_DEFAULT_PAGE_SIZE; ii=ii*2){ - if( iDc&(SQLITE_IOCAP_ATOMIC|(ii>>8)) ){ - szPageDflt = ii; + setSectorSize(pPager); + assert(SQLITE_DEFAULT_PAGE_SIZE<=SQLITE_MAX_DEFAULT_PAGE_SIZE); + if( szPageDfltsectorSize ){ + if( pPager->sectorSize>SQLITE_MAX_DEFAULT_PAGE_SIZE ){ + szPageDflt = SQLITE_MAX_DEFAULT_PAGE_SIZE; + }else{ + szPageDflt = (u32)pPager->sectorSize; + } + } +#ifdef SQLITE_ENABLE_ATOMIC_WRITE + { + int ii; + assert(SQLITE_IOCAP_ATOMIC512==(512>>8)); + assert(SQLITE_IOCAP_ATOMIC64K==(65536>>8)); + assert(SQLITE_MAX_DEFAULT_PAGE_SIZE<=65536); + for(ii=szPageDflt; ii<=SQLITE_MAX_DEFAULT_PAGE_SIZE; ii=ii*2){ + if( iDc&(SQLITE_IOCAP_ATOMIC|(ii>>8)) ){ + szPageDflt = ii; + } } } - } #endif + if( (iDc & SQLITE_IOCAP_IMMUTABLE)!=0 + || sqlite3_uri_boolean(zFilename, "immutable", 0) ){ + vfsFlags |= SQLITE_OPEN_READONLY; + goto act_like_temp_file; + } + } } }else{ /* If a temporary file is requested, it is not opened immediately. @@ -4708,6 +4715,7 @@ int sqlite3PagerOpen( ** database is the same as a temp-file that is never written out to ** disk and uses an in-memory rollback journal. */ +act_like_temp_file: tempFile = 1; pPager->eState = PAGER_READER; pPager->eLock = EXCLUSIVE_LOCK; @@ -4751,9 +4759,6 @@ int sqlite3PagerOpen( /* pPager->nPage = 0; */ pPager->mxPgno = SQLITE_MAX_PAGE_COUNT; /* pPager->state = PAGER_UNLOCK; */ -#if 0 - assert( pPager->state == (tempFile ? PAGER_EXCLUSIVE : PAGER_UNLOCK) ); -#endif /* pPager->errMask = 0; */ pPager->tempFile = (u8)tempFile; assert( tempFile==PAGER_LOCKINGMODE_NORMAL diff --git a/src/sqlite.h.in b/src/sqlite.h.in index e8dddc468c..81220a8822 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -555,7 +555,10 @@ int sqlite3_exec( ** file that were written at the application level might have changed ** and that adjacent bytes, even bytes within the same sector are ** guaranteed to be unchanged. The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN -** flag indicate that a file cannot be deleted when open. +** flag indicate that a file cannot be deleted when open. The +** SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on +** read-only media and cannot be changed even by processes with +** elevated privileges. */ #define SQLITE_IOCAP_ATOMIC 0x00000001 #define SQLITE_IOCAP_ATOMIC512 0x00000002 @@ -570,6 +573,7 @@ int sqlite3_exec( #define SQLITE_IOCAP_SEQUENTIAL 0x00000400 #define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800 #define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000 +#define SQLITE_IOCAP_IMMUTABLE 0x00002000 /* ** CAPI3REF: File Locking Levels From 48cdabcb1af2762fdfb8ede588328def41d1b74a Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 1 May 2014 01:20:05 +0000 Subject: [PATCH 10/27] Avoid unnecessary xUnlock operations on temp file. FossilOrigin-Name: 1829c38c3233c8cb194fae6d560d35a8916b1348 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/pager.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 9473264928..2f57028bf7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\simmutable=TRUE\squery\sparameter\sand\sSQLITE_IOCAP_IMMUTABLE,\seither\nof\swhich\sprevents\slocking\sof\sthe\sdatabase\sand\somits\stests\sfor\sexistance\nof\sjournal\sfiles. -D 2014-05-01T01:13:08.624 +C Avoid\sunnecessary\sxUnlock\soperations\son\stemp\sfile. +D 2014-05-01T01:20:05.808 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -206,7 +206,7 @@ F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_unix.c ae4b5240af4619d711301d7992396e182585269f F src/os_win.c 1662c40d22be162698a31725e836eede09e841ed -F src/pager.c 5c296b584df0d675e2377196472ff8a993ad079d +F src/pager.c 52b7f435cb06063ccb52ff7089dfbc7be613b9b2 F src/pager.h ffd5607f7b3e4590b415b007a4382f693334d428 F src/parse.y 22d6a074e5f5a7258947a1dc55a9bf946b765dd0 F src/pcache.c d8eafac28290d4bb80332005435db44991d07fc2 @@ -1166,7 +1166,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 84243f844417f888ab731841f7dbf95749f6e034 -R 5c0369593ee1e8996babaee6957b771b +P 71f152c85d79ebd9ca48bc9c4c71fc4debaf2437 +R 936969710ee66727ffa03c716e1344c2 U drh -Z 54ea9e774afb5e969c7607c1ec92b0eb +Z b6af320858436be94ae3e128e461e236 diff --git a/manifest.uuid b/manifest.uuid index 717b11ca0b..8ca149ad7f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -71f152c85d79ebd9ca48bc9c4c71fc4debaf2437 \ No newline at end of file +1829c38c3233c8cb194fae6d560d35a8916b1348 \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index 78f2cae020..15d21cd9b1 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1089,7 +1089,7 @@ static int pagerUnlockDb(Pager *pPager, int eLock){ assert( !pPager->exclusiveMode || pPager->eLock==eLock ); assert( eLock==NO_LOCK || eLock==SHARED_LOCK ); assert( eLock!=NO_LOCK || pagerUseWal(pPager)==0 ); - if( isOpen(pPager->fd) ){ + if( isOpen(pPager->fd) && !pPager->tempFile ){ assert( pPager->eLock>=eLock ); rc = sqlite3OsUnlock(pPager->fd, eLock); if( pPager->eLock!=UNKNOWN_LOCK ){ From 57fe136b23aca972e867a3c7925980c1a5e80842 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 1 May 2014 01:49:22 +0000 Subject: [PATCH 11/27] Take out the special handling of nolock=true in os_win.c and add it to pager.c, so that it works for all VFSes. Add the pPager->noLock boolean for clarity. FossilOrigin-Name: 725c1c14be331bce9bf074960dbfa7b6d4c1ba87 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_win.c | 17 +---------------- src/pager.c | 17 +++++++++++------ 4 files changed, 20 insertions(+), 30 deletions(-) diff --git a/manifest b/manifest index 2f57028bf7..6ac75f7987 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Avoid\sunnecessary\sxUnlock\soperations\son\stemp\sfile. -D 2014-05-01T01:20:05.808 +C Take\sout\sthe\sspecial\shandling\sof\snolock=true\sin\sos_win.c\sand\sadd\sit\sto\npager.c,\sso\sthat\sit\sworks\sfor\sall\sVFSes.\s\sAdd\sthe\spPager->noLock\sboolean\nfor\sclarity. +D 2014-05-01T01:49:22.279 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -205,8 +205,8 @@ F src/os.c 1b147e4cf7cc39e618115c14a086aed44bc91ace F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_unix.c ae4b5240af4619d711301d7992396e182585269f -F src/os_win.c 1662c40d22be162698a31725e836eede09e841ed -F src/pager.c 52b7f435cb06063ccb52ff7089dfbc7be613b9b2 +F src/os_win.c e71678ac927d0a0fb11d993db20a9748eabf808e +F src/pager.c 6ed54e169933200b8d113674d5da46a5cbd32c6c F src/pager.h ffd5607f7b3e4590b415b007a4382f693334d428 F src/parse.y 22d6a074e5f5a7258947a1dc55a9bf946b765dd0 F src/pcache.c d8eafac28290d4bb80332005435db44991d07fc2 @@ -1166,7 +1166,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 71f152c85d79ebd9ca48bc9c4c71fc4debaf2437 -R 936969710ee66727ffa03c716e1344c2 +P 1829c38c3233c8cb194fae6d560d35a8916b1348 +R 9585bcff14fbe775451a3a647d896079 U drh -Z b6af320858436be94ae3e128e461e236 +Z 3dae204f6c4a7be4483961b87ae0c17a diff --git a/manifest.uuid b/manifest.uuid index 8ca149ad7f..d015fa2fa6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1829c38c3233c8cb194fae6d560d35a8916b1348 \ No newline at end of file +725c1c14be331bce9bf074960dbfa7b6d4c1ba87 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index bf5b9c72d1..287dad3b57 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -275,7 +275,6 @@ struct winFile { #define WINFILE_RDONLY 0x02 /* Connection is read only */ #define WINFILE_PERSIST_WAL 0x04 /* Persistent WAL mode */ #define WINFILE_PSOW 0x10 /* SQLITE_IOCAP_POWERSAFE_OVERWRITE */ -#define WINFILE_NOLOCK 0x20 /* Never do any real locking */ /* * The size of the buffer used by sqlite3_win32_write_debug(). @@ -2860,10 +2859,6 @@ static int winLock(sqlite3_file *id, int locktype){ assert( id!=0 ); OSTRACE(("LOCK file=%p, oldLock=%d(%d), newLock=%d\n", pFile->h, pFile->locktype, pFile->sharedLockByte, locktype)); - if( pFile->ctrlFlags & WINFILE_NOLOCK ){ - OSTRACE(("LOCK-NOP file=%p, rc=SQLITE_OK\n", pFile->h)); - return SQLITE_OK; - } /* If there is already a lock of this type or more restrictive on the ** OsFile, do nothing. Don't use the end_lock: exit path, as @@ -2991,10 +2986,7 @@ static int winCheckReservedLock(sqlite3_file *id, int *pResOut){ OSTRACE(("TEST-WR-LOCK file=%p, pResOut=%p\n", pFile->h, pResOut)); assert( id!=0 ); - if( pFile->ctrlFlags & WINFILE_NOLOCK ){ - rc = 0; - OSTRACE(("TEST-WR-LOCK file=%p, rc=%d (nop)\n", pFile->h, rc)); - }else if( pFile->locktype>=RESERVED_LOCK ){ + if( pFile->locktype>=RESERVED_LOCK ){ rc = 1; OSTRACE(("TEST-WR-LOCK file=%p, rc=%d (local)\n", pFile->h, rc)); }else{ @@ -3030,10 +3022,6 @@ static int winUnlock(sqlite3_file *id, int locktype){ assert( locktype<=SHARED_LOCK ); OSTRACE(("UNLOCK file=%p, oldLock=%d(%d), newLock=%d\n", pFile->h, pFile->locktype, pFile->sharedLockByte, locktype)); - if( pFile->ctrlFlags & WINFILE_NOLOCK ){ - OSTRACE(("UNLOCK-NOP file=%p, rc=SQLITE_OK\n", pFile->h)); - return SQLITE_OK; - } type = pFile->locktype; if( type>=EXCLUSIVE_LOCK ){ winUnlockFile(&pFile->h, SHARED_FIRST, 0, SHARED_SIZE, 0); @@ -4704,9 +4692,6 @@ static int winOpen( if( sqlite3_uri_boolean(zName, "psow", SQLITE_POWERSAFE_OVERWRITE) ){ pFile->ctrlFlags |= WINFILE_PSOW; } - if( sqlite3_uri_boolean(zName, "nolock", 0) ){ - pFile->ctrlFlags |= WINFILE_NOLOCK; - } pFile->lastErrno = NO_ERROR; pFile->zPath = zName; #if SQLITE_MAX_MMAP_SIZE>0 diff --git a/src/pager.c b/src/pager.c index 15d21cd9b1..9ab7cfbe54 100644 --- a/src/pager.c +++ b/src/pager.c @@ -626,7 +626,8 @@ struct Pager { u8 ckptSyncFlags; /* SYNC_NORMAL or SYNC_FULL for checkpoint */ u8 walSyncFlags; /* SYNC_NORMAL or SYNC_FULL for wal writes */ u8 syncFlags; /* SYNC_NORMAL or SYNC_FULL otherwise */ - u8 tempFile; /* zFilename is a temporary file */ + u8 tempFile; /* zFilename is a temporary or immutable file */ + u8 noLock; /* Do not lock (except in WAL mode) */ u8 readOnly; /* True for a read-only database */ u8 memDb; /* True to inhibit all file I/O */ @@ -1089,9 +1090,9 @@ static int pagerUnlockDb(Pager *pPager, int eLock){ assert( !pPager->exclusiveMode || pPager->eLock==eLock ); assert( eLock==NO_LOCK || eLock==SHARED_LOCK ); assert( eLock!=NO_LOCK || pagerUseWal(pPager)==0 ); - if( isOpen(pPager->fd) && !pPager->tempFile ){ + if( isOpen(pPager->fd) ){ assert( pPager->eLock>=eLock ); - rc = sqlite3OsUnlock(pPager->fd, eLock); + rc = pPager->noLock ? SQLITE_OK : sqlite3OsUnlock(pPager->fd, eLock); if( pPager->eLock!=UNKNOWN_LOCK ){ pPager->eLock = (u8)eLock; } @@ -1115,7 +1116,7 @@ static int pagerLockDb(Pager *pPager, int eLock){ assert( eLock==SHARED_LOCK || eLock==RESERVED_LOCK || eLock==EXCLUSIVE_LOCK ); if( pPager->eLockeLock==UNKNOWN_LOCK ){ - rc = sqlite3OsLock(pPager->fd, eLock); + rc = pPager->noLock ? SQLITE_OK : sqlite3OsLock(pPager->fd, eLock); if( rc==SQLITE_OK && (pPager->eLock!=UNKNOWN_LOCK||eLock==EXCLUSIVE_LOCK) ){ pPager->eLock = (u8)eLock; IOTRACE(("LOCK %p %d\n", pPager, eLock)) @@ -4699,6 +4700,7 @@ int sqlite3PagerOpen( } } #endif + pPager->noLock = sqlite3_uri_boolean(zFilename, "nolock", 0); if( (iDc & SQLITE_IOCAP_IMMUTABLE)!=0 || sqlite3_uri_boolean(zFilename, "immutable", 0) ){ vfsFlags |= SQLITE_OPEN_READONLY; @@ -4714,11 +4716,14 @@ int sqlite3PagerOpen( ** This branch is also run for an in-memory database. An in-memory ** database is the same as a temp-file that is never written out to ** disk and uses an in-memory rollback journal. + ** + ** This branch also runs for files marked as immutable. */ act_like_temp_file: tempFile = 1; - pPager->eState = PAGER_READER; - pPager->eLock = EXCLUSIVE_LOCK; + pPager->eState = PAGER_READER; /* Pretend we already have a lock */ + pPager->eLock = EXCLUSIVE_LOCK; /* Pretend we are in EXCLUSIVE locking mode */ + pPager->noLock = 1; /* Do no locking */ readOnly = (vfsFlags&SQLITE_OPEN_READONLY); } From a153643b0731de848cb07cbe697ebef0e1ae4e61 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 2 May 2014 14:54:56 +0000 Subject: [PATCH 12/27] Fix a broken test case in fuzz.test. FossilOrigin-Name: faa469355eabb2c407f24638b090725448aac37f --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/fuzz.test | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index af2b3b36ec..c958eec031 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\scomment\sexplaining\swhy\sWhereLoop\scost\sadjustments\sare\somitted\sfor\nskip-scan\sloops. -D 2014-05-02T00:09:40.134 +C Fix\sa\sbroken\stest\scase\sin\sfuzz.test. +D 2014-05-02T14:54:56.266 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -582,7 +582,7 @@ F test/func3.test dbccee9133cfef1473c59ec07b5f0262b9d72f9a F test/func4.test 6beacdfcb0e18c358e6c2dcacf1b65d1fa80955f F test/func5.test cdd224400bc3e48d891827cc913a57051a426fa4 F test/fuzz-oss1.test 4912e528ec9cf2f42134456933659d371c9e0d74 -F test/fuzz.test 77fd50afc12847af50fcf1941679d90adebadde6 +F test/fuzz.test 96083052bf5765e4518c1ba686ce2bab785670d1 F test/fuzz2.test 207d0f9d06db3eaf47a6b7bfc835b8e2fc397167 F test/fuzz3.test efd384b896c647b61a2c1848ba70d42aad60a7b3 F test/fuzz_common.tcl a87dfbb88c2a6b08a38e9a070dabd129e617b45b @@ -1166,7 +1166,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 427409ae106cdab7892a6b50fe30c5f52de5addc -R ee65c8e54ebb299c9693aee246a7e200 -U drh -Z 5a37e5aacc1e047352493d523b6fb849 +P 3bc43594aaeee9225c0590677fcce480bedcb37b +R cb5319eb84ea1cdb4a55d1e33cf3d763 +U dan +Z 412ddec016208716851032f358e0939e diff --git a/manifest.uuid b/manifest.uuid index 6c6f1f805d..52fb89ae57 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3bc43594aaeee9225c0590677fcce480bedcb37b \ No newline at end of file +faa469355eabb2c407f24638b090725448aac37f \ No newline at end of file diff --git a/test/fuzz.test b/test/fuzz.test index e1b22ae804..0deed3b636 100644 --- a/test/fuzz.test +++ b/test/fuzz.test @@ -285,7 +285,7 @@ do_test fuzz-1.18 { ) )) } -} {0 -4294967298} +} {0 {{}}} # At one point the following INSERT statement caused an assert() to fail. # From fdf9f045b7c33281d5a027f2427e9431c31813c0 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 5 May 2014 17:43:28 +0000 Subject: [PATCH 13/27] Fix several header file comments. No changes to code. FossilOrigin-Name: dd6eb5d1eb4d50023a008fac116497ede29600c1 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_setup.h | 2 +- src/os_win.h | 18 +++++++++--------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/manifest b/manifest index 0a0e83ebbd..bbea0afd3a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\supdates\sfrom\strunk. -D 2014-05-02T21:38:02.443 +C Fix\sseveral\sheader\sfile\scomments.\s\sNo\schanges\sto\scode. +D 2014-05-05T17:43:28.823 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -204,10 +204,10 @@ F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30 F src/os.c 1b147e4cf7cc39e618115c14a086aed44bc91ace F src/os.h 60d419395e32a8029fa380a80a3da2e9030f635e F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 -F src/os_setup.h 3f9e87d981eef070c8a11e76b4704842a0e5870f +F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_unix.c ae4b5240af4619d711301d7992396e182585269f F src/os_win.c 089fcb45dabe90a4c87369cc69846838198dd221 -F src/os_win.h ac253253d080dc3dd261efe5e98626c4b95e5a26 +F src/os_win.h ca9c83efaf41298691553e1d0f7e11328168d8b8 F src/pager.c ab62a24218d87dda1be641f6c5ad291bff78fd94 F src/pager.h ffd5607f7b3e4590b415b007a4382f693334d428 F src/parse.y 22d6a074e5f5a7258947a1dc55a9bf946b765dd0 @@ -1168,7 +1168,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 09cf240a7fb4022aeb1d7ae2a2455b5f97b53d68 faa469355eabb2c407f24638b090725448aac37f -R 332509ae33dff41f389350276535e395 +P c4d1d8a0db48f523d1624f2468261c171152c0f7 +R e81e8bbcb0f41d36dce23eda3c309a85 U mistachkin -Z 6c2182b94bf292df6ecab4543f02e83a +Z 2824130e829ad3dc4daa36d25ec17b58 diff --git a/manifest.uuid b/manifest.uuid index b20cd682c5..fd4cdfc69f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c4d1d8a0db48f523d1624f2468261c171152c0f7 \ No newline at end of file +dd6eb5d1eb4d50023a008fac116497ede29600c1 \ No newline at end of file diff --git a/src/os_setup.h b/src/os_setup.h index 5b010b894e..68de1446ed 100644 --- a/src/os_setup.h +++ b/src/os_setup.h @@ -22,7 +22,7 @@ ** ** After the following block of preprocess macros, all of SQLITE_OS_UNIX, ** SQLITE_OS_WIN, and SQLITE_OS_OTHER will defined to either 1 or 0. One of -** the four will be 1. The other three will be 0. +** the three will be 1. The other two will be 0. */ #if defined(SQLITE_OS_OTHER) # if SQLITE_OS_OTHER==1 diff --git a/src/os_win.h b/src/os_win.h index 6ccd9f4828..cb1ff80bd9 100644 --- a/src/os_win.h +++ b/src/os_win.h @@ -16,7 +16,7 @@ #define _OS_WIN_H_ /* -** Include the Windows SDK header file. +** Include the primary Windows SDK header file. */ #include "windows.h" @@ -28,8 +28,8 @@ /* ** Determine if we are dealing with Windows NT. ** -** We ought to be able to determine if we are compiling for win98 or winNT -** using the _WIN32_WINNT macro as follows: +** We ought to be able to determine if we are compiling for Windows 9x or +** Windows NT using the _WIN32_WINNT macro as follows: ** ** #if defined(_WIN32_WINNT) ** # define SQLITE_OS_WINNT 1 @@ -37,18 +37,18 @@ ** # define SQLITE_OS_WINNT 0 ** #endif ** -** However, vs2005 does not set _WIN32_WINNT by default, as it ought to, -** so the above test does not work. We'll just assume that everything is -** winNT unless the programmer explicitly says otherwise by setting -** SQLITE_OS_WINNT to 0. +** However, Visual Studio 2005 does not set _WIN32_WINNT by default, as +** it ought to, so the above test does not work. We'll just assume that +** everything is Windows NT unless the programmer explicitly says otherwise +** by setting SQLITE_OS_WINNT to 0. */ #if SQLITE_OS_WIN && !defined(SQLITE_OS_WINNT) # define SQLITE_OS_WINNT 1 #endif /* -** Determine if we are dealing with WindowsCE - which has a much -** reduced API. +** Determine if we are dealing with Windows CE - which has a much reduced +** API. */ #if defined(_WIN32_WCE) # define SQLITE_OS_WINCE 1 From 1a8a0d3f1a4b35dbe9bde09026c6358cc9b2619c Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 5 May 2014 20:21:52 +0000 Subject: [PATCH 14/27] Attempt to fix the build on beagleboard. FossilOrigin-Name: 3ac75725a66730566105ad184a988a8f80f51055 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/os_win.h | 2 +- tool/mksqlite3c.tcl | 4 +++- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 2785d56cb3..a49aee7bc9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Centralize\sand\sreform\suse\sof\sthe\sWin32\srelated\sinclude\sfiles. -D 2014-05-05T18:24:47.522 +C Attempt\sto\sfix\sthe\sbuild\son\sbeagleboard. +D 2014-05-05T20:21:52.937 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -207,7 +207,7 @@ F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_unix.c ae4b5240af4619d711301d7992396e182585269f F src/os_win.c 485d06a93965f306c7281fca0937829292367234 -F src/os_win.h ca9c83efaf41298691553e1d0f7e11328168d8b8 +F src/os_win.h 057344a6720b4c8405d9bd98f58cb37a6ee46c25 F src/pager.c ab62a24218d87dda1be641f6c5ad291bff78fd94 F src/pager.h ffd5607f7b3e4590b415b007a4382f693334d428 F src/parse.y 22d6a074e5f5a7258947a1dc55a9bf946b765dd0 @@ -1137,7 +1137,7 @@ F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e F tool/mkpragmatab.tcl 78a77b2c554d534c6f2dc903130186ed15715460 F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 F tool/mksqlite3c-noext.tcl 1712d3d71256ca1f297046619c89e77a4d7c8f6d -F tool/mksqlite3c.tcl 1be89affd8ad71a31b6e5d49cc7bf790db7686ff +F tool/mksqlite3c.tcl ba274df71f5e6534b0a913c7c48eabfcbd0934b6 F tool/mksqlite3h.tcl ba24038056f51fde07c0079c41885ab85e2cff12 F tool/mksqlite3internalh.tcl b6514145a7d5321b47e64e19b8116cc44f973eb1 F tool/mkvsix.tcl 6477fb9dab838b7eea1eed50658ff1cda04850b5 @@ -1168,7 +1168,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 4760504396bcf44528eb8de9ed7aa5d9659c54b6 a3cfd81339267c87db511cedf35ec209ee1f1a72 -R 938ab94058764b9d56f0ca54851e9d8f -U mistachkin -Z 010c73dcd5fc4fed61a248b3b687b42d +P 857f2baf9b722e4eb1ac0d50fe03e32d5176185b +R 13f47e22fa817432bd25922bb1ff1b2f +U drh +Z 55108ca91e730f32aa309dbf16d83499 diff --git a/manifest.uuid b/manifest.uuid index 691d0d795d..f90aaab944 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -857f2baf9b722e4eb1ac0d50fe03e32d5176185b \ No newline at end of file +3ac75725a66730566105ad184a988a8f80f51055 \ No newline at end of file diff --git a/src/os_win.h b/src/os_win.h index cb1ff80bd9..d662cd467d 100644 --- a/src/os_win.h +++ b/src/os_win.h @@ -22,7 +22,7 @@ #ifdef __CYGWIN__ # include -# include /* amalgamator: keep */ +# include /* amalgamator: dontcache */ #endif /* diff --git a/tool/mksqlite3c.tcl b/tool/mksqlite3c.tcl index 9b222bdd22..64207727be 100644 --- a/tool/mksqlite3c.tcl +++ b/tool/mksqlite3c.tcl @@ -170,7 +170,9 @@ proc copy_file {filename} { if {$linemacros} {puts $out "#line [expr {$ln+1}] \"$filename\""} } } elseif {![info exists seen_hdr($hdr)]} { - set seen_hdr($hdr) 1 + if {![regexp {/\*\s+amalgamator:\s+dontcache\s+\*/} $line]} { + set seen_hdr($hdr) 1 + } puts $out $line } elseif {[regexp {/\*\s+amalgamator:\s+keep\s+\*/} $line]} { # This include file must be kept because there was a "keep" From f6a2342651595b22fffb3076c718de4250456afb Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 5 May 2014 20:24:34 +0000 Subject: [PATCH 15/27] Work on cleaning up the MSVC batch build tool integration with Visual Studio 2013. FossilOrigin-Name: b5a72dfd59fba6a9938ac1afdec06a2e6809fd2d --- Makefile.msc | 16 ++++++++++------ manifest | 14 +++++++------- manifest.uuid | 2 +- tool/build-all-msvc.bat | 9 ++++++--- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index 5d6460b7d5..112d4b6e5f 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -510,16 +510,20 @@ LTLIBOPTS = /MACHINE:$(PLATFORM) !IF $(FOR_WINRT)!=0 LTLINKOPTS = $(LTLINKOPTS) /APPCONTAINER !IF "$(VISUALSTUDIOVERSION)"=="12.0" +!IFNDEF STORELIBPATH !IF "$(PLATFORM)"=="x86" -LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(VCINSTALLDIR)\lib\store" +STORELIBPATH = $(NCRTLIBPATH)\store !ELSEIF "$(PLATFORM)"=="x64" -LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(VCINSTALLDIR)\lib\store\amd64" +STORELIBPATH = $(NCRTLIBPATH)\store\amd64 !ELSEIF "$(PLATFORM)"=="ARM" -LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(VCINSTALLDIR)\lib\store\arm" +STORELIBPATH = $(NCRTLIBPATH)\store\arm !ELSE -LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(VCINSTALLDIR)\lib\store" +STORELIBPATH = $(NCRTLIBPATH)\store !ENDIF !ENDIF +STORELIBPATH = $(STORELIBPATH:\\=\) +LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(STORELIBPATH)" +!ENDIF !ENDIF # If either debugging or symbols are enabled, enable PDBs. @@ -1370,8 +1374,8 @@ clean: del /Q *.lo *.ilk *.lib *.obj *.pdb sqlite3.exe libsqlite3.lib del /Q *.cod *.da *.bb *.bbg gmon.out del /Q sqlite3.h opcodes.c opcodes.h - del /Q lemon.exe lempar.c parse.* - del /Q mkkeywordhash.exe keywordhash.h + del /Q lemon.* lempar.c parse.* + del /Q mkkeywordhash.* keywordhash.h del /Q notasharedlib.* -rmdir /Q/S .deps -rmdir /Q/S .libs diff --git a/manifest b/manifest index 44f5a64a12..0392d96bc7 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Enhance\sthe\sWin32\sVFS\sI/O\sretry\slogic. -D 2014-05-02T22:39:54.345 +C Work\son\scleaning\sup\sthe\sMSVC\sbatch\sbuild\stool\sintegration\swith\sVisual\sStudio\s2013. +D 2014-05-05T20:24:34.916 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc fdacba6fb574868c71fde6db6b77789a383a4c19 +F Makefile.msc 1e8c0f7e80f73b36d04520844e1e6c335cfe2000 F Makefile.vxworks db21ed42a01d5740e656b16f92cb5d8d5e5dd315 F README.md 64f270c43c38c46de749e419c22f0ae2f4499fe8 F VERSION 9f823c026c6a32fc5f84d212a8aae0a221dba45c @@ -1116,7 +1116,7 @@ F test/without_rowid5.test b4a639a367f04d382d20e8f44fc1be4f2d57d107 F test/wordcount.c 9915e06cb33d8ca8109b8700791afe80d305afda F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688 F test/zerodamage.test cf6748bad89553cc1632be51a6f54e487e4039ac -F tool/build-all-msvc.bat e0917e787df675b020d250d60a00de8abaa4e30a x +F tool/build-all-msvc.bat 3ffc57eadcf6229ee8b940dde2cb2eac03813bf3 x F tool/build-shell.sh 950f47c6174f1eea171319438b93ba67ff5bf367 F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2 F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b @@ -1166,7 +1166,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P faa469355eabb2c407f24638b090725448aac37f 598a3875ce98015e9a38db54bd0cb6290424c3d8 -R ea09ee65f031a4f810c7f319ecf812cc +P 4760504396bcf44528eb8de9ed7aa5d9659c54b6 +R 430719bf3d22eab8999716ab9edcc7d3 U mistachkin -Z f9afa829a6179e568b33b0a29e5a3328 +Z 9015c1d19aac4c8ce51a7c46f2b60a96 diff --git a/manifest.uuid b/manifest.uuid index fea2bea1a8..22c786fba4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4760504396bcf44528eb8de9ed7aa5d9659c54b6 \ No newline at end of file +b5a72dfd59fba6a9938ac1afdec06a2e6809fd2d \ No newline at end of file diff --git a/tool/build-all-msvc.bat b/tool/build-all-msvc.bat index 6e0aeb572c..fcb4d2c8c0 100755 --- a/tool/build-all-msvc.bat +++ b/tool/build-all-msvc.bat @@ -238,6 +238,7 @@ GOTO set_vcvarsall_done :set_vcvarsall_phone SET VCVARSALL=%VCINSTALLDIR%\WPSDK\WP80\vcvarsphoneall.bat :set_vcvarsall_done +SET VCVARSALL=%VCVARSALL:\\=\% REM REM NOTE: This is the outer loop. There should be exactly one iteration per @@ -268,6 +269,7 @@ FOR %%P IN (%PLATFORMS%) DO ( CALL :fn_UnsetVariable DevEnvDir CALL :fn_UnsetVariable ExtensionSdkDir CALL :fn_UnsetVariable Framework35Version + CALL :fn_UnsetVariable Framework40Version CALL :fn_UnsetVariable FrameworkDir CALL :fn_UnsetVariable FrameworkDir32 CALL :fn_UnsetVariable FrameworkVersion @@ -283,6 +285,8 @@ FOR %%P IN (%PLATFORMS%) DO ( CALL :fn_UnsetVariable WindowsSdkDir CALL :fn_UnsetVariable WindowsSdkDir_35 CALL :fn_UnsetVariable WindowsSdkDir_old + CALL :fn_UnsetVariable WindowsSDK_ExecutablePath_x86 + CALL :fn_UnsetVariable WindowsSDK_ExecutablePath_x64 REM REM NOTE: Reset the PATH here to the absolute bare minimum required. @@ -374,10 +378,9 @@ FOR %%P IN (%PLATFORMS%) DO ( REM REM NOTE: The Windows 8.1 SDK has a slightly different directory - REM naming convention. Currently, this tool assumes that - REM the Windows 8.1 SDK should only be used with MSVC 2013. + REM naming convention. REM - IF "%VisualStudioVersion%" == "12.0" ( + IF DEFINED USE_WINV63_NSDKLIBPATH ( CALL :fn_AppendVariable NSDKLIBPATH \lib\winv6.3\um\x86 ) ELSE ( CALL :fn_AppendVariable NSDKLIBPATH \lib\win8\um\x86 From 220942b7576815b3034148232c565957662c31d7 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 5 May 2014 21:08:47 +0000 Subject: [PATCH 16/27] More modularization work on the MSVC batch build tool. FossilOrigin-Name: 9a06773acc181e981f61f476a8e56417b98beba9 --- manifest | 14 +++++++------- manifest.uuid | 2 +- tool/build-all-msvc.bat | 18 ++++++++++++++++-- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index f693fb7396..bd0a456f88 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Create\snew\sheader\sfile\s"os_setup.h"\sused\sto\sdetect\sthe\soperating\ssystem\nat\scompile-time,\sand\s"os_win.h"\sthat\scontains\swindows-specific\sheader\sin\nformation. -D 2014-05-05T20:32:15.817 +C More\smodularization\swork\son\sthe\sMSVC\sbatch\sbuild\stool. +D 2014-05-05T21:08:47.656 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -1118,7 +1118,7 @@ F test/without_rowid5.test b4a639a367f04d382d20e8f44fc1be4f2d57d107 F test/wordcount.c 9915e06cb33d8ca8109b8700791afe80d305afda F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688 F test/zerodamage.test cf6748bad89553cc1632be51a6f54e487e4039ac -F tool/build-all-msvc.bat 3ffc57eadcf6229ee8b940dde2cb2eac03813bf3 x +F tool/build-all-msvc.bat b4f0b5577fd248529c3247c06309226c35db9ff6 x F tool/build-shell.sh 950f47c6174f1eea171319438b93ba67ff5bf367 F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2 F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b @@ -1168,7 +1168,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P b5a72dfd59fba6a9938ac1afdec06a2e6809fd2d 3ac75725a66730566105ad184a988a8f80f51055 -R 8d3da72aab741dd9279195207e6c8bd7 -U drh -Z 892b3ce35265d0d6387ad7a7c3c1d88b +P bd92e0f80c1158d810b0d47e38f2fe06ff24bb8c +R 219607b5b5ba75498daf10431b648c43 +U mistachkin +Z de5605f1e301dc16c5db1ce3f5edb9e1 diff --git a/manifest.uuid b/manifest.uuid index feb33def06..e6d8119bed 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bd92e0f80c1158d810b0d47e38f2fe06ff24bb8c \ No newline at end of file +9a06773acc181e981f61f476a8e56417b98beba9 \ No newline at end of file diff --git a/tool/build-all-msvc.bat b/tool/build-all-msvc.bat index fcb4d2c8c0..b34fe0c829 100755 --- a/tool/build-all-msvc.bat +++ b/tool/build-all-msvc.bat @@ -146,6 +146,17 @@ IF NOT DEFINED CONFIGURATIONS ( %_VECHO% Configurations = '%CONFIGURATIONS%' +REM +REM NOTE: If the command used to invoke NMAKE is not already set, use the +REM default. +REM +IF NOT DEFINED NMAKE_CMD ( + SET NMAKE_CMD=nmake -B -f Makefile.msc +) + +%_VECHO% NmakeCmd = '%NMAKE_CMD%' +%_VECHO% NmakeArgs = '%NMAKE_ARGS%' + REM REM NOTE: Setup environment variables to translate between the MSVC platform REM names and the names to be used for the platform-specific binary @@ -303,6 +314,8 @@ FOR %%P IN (%PLATFORMS%) DO ( REM environment variables to be picked up by the MSVC makefile REM itself. REM + %_AECHO% Building the "%%B" configuration for platform "%%D"... + IF /I "%%B" == "Debug" ( SET DEBUG=2 SET MEMDEBUG=1 @@ -395,7 +408,7 @@ FOR %%P IN (%PLATFORMS%) DO ( REM file, etc. REM IF NOT DEFINED NOCLEAN ( - %__ECHO% nmake -f Makefile.msc clean + %__ECHO% %NMAKE_CMD% clean IF ERRORLEVEL 1 ( ECHO Failed to clean for platform %%P. @@ -407,6 +420,7 @@ FOR %%P IN (%PLATFORMS%) DO ( REM need to remove the build output for the files we are REM specifically wanting to build for each platform. REM + %_AECHO% Cleaning final output files only... %__ECHO% DEL /Q *.lo sqlite3.dll sqlite3.lib sqlite3.pdb ) @@ -417,7 +431,7 @@ FOR %%P IN (%PLATFORMS%) DO ( REM Also, disable looking for and/or linking to the native Tcl REM runtime library. REM - %__ECHO% nmake -f Makefile.msc sqlite3.dll XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS% + %__ECHO% %NMAKE_CMD% sqlite3.dll XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS% IF ERRORLEVEL 1 ( ECHO Failed to build %%B "sqlite3.dll" for platform %%P. From 7dd9fb65e26606025ddd3ef4ba7f8f8b7842393b Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 5 May 2014 22:43:17 +0000 Subject: [PATCH 17/27] When building for Windows 8.0 using Visual Studio 2013, make sure the cross-compilation native library path is set correctly. FossilOrigin-Name: c1ab9092e29bc9d172c1f1a3becbcc83b79f2080 --- Makefile.msc | 4 ++-- manifest | 14 +++++++------- manifest.uuid | 2 +- tool/build-all-msvc.bat | 5 ++++- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index 1d59040844..2b970e3097 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -962,7 +962,7 @@ lempar.c: $(TOP)\src\lempar.c copy $(TOP)\src\lempar.c . lemon.exe: $(TOP)\tool\lemon.c lempar.c - $(BCC) -Daccess=_access -Fe$@ $(TOP)\tool\lemon.c /link $(NLTLIBPATHS) + $(BCC) -Daccess=_access -Fe$@ $(TOP)\tool\lemon.c /link $(NLTLINKOPTS) $(NLTLIBPATHS) # Rules to build individual *.lo files from generated *.c files. This # applies to: @@ -1230,7 +1230,7 @@ sqlite3.h: $(TOP)\src\sqlite.h.in $(TOP)\manifest.uuid $(TOP)\VERSION $(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP:\=/) > sqlite3.h mkkeywordhash.exe: $(TOP)\tool\mkkeywordhash.c - $(BCC) -Fe$@ $(OPT_FEATURE_FLAGS) $(OPTS) $(TOP)\tool\mkkeywordhash.c /link $(NLTLIBPATHS) + $(BCC) -Fe$@ $(OPT_FEATURE_FLAGS) $(OPTS) $(TOP)\tool\mkkeywordhash.c /link $(NLTLINKOPTS) $(NLTLIBPATHS) keywordhash.h: $(TOP)\tool\mkkeywordhash.c mkkeywordhash.exe .\mkkeywordhash.exe > keywordhash.h diff --git a/manifest b/manifest index bd0a456f88..089fba14e7 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C More\smodularization\swork\son\sthe\sMSVC\sbatch\sbuild\stool. -D 2014-05-05T21:08:47.656 +C When\sbuilding\sfor\sWindows\s8.0\susing\sVisual\sStudio\s2013,\smake\ssure\sthe\scross-compilation\snative\slibrary\spath\sis\sset\scorrectly. +D 2014-05-05T22:43:17.621 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc cf9737350840c56f1e46204aa310227b8183c221 +F Makefile.msc 7e6c495d9a145054a09f518781916c7503f7a8e9 F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 F README.md 64f270c43c38c46de749e419c22f0ae2f4499fe8 F VERSION 9f823c026c6a32fc5f84d212a8aae0a221dba45c @@ -1118,7 +1118,7 @@ F test/without_rowid5.test b4a639a367f04d382d20e8f44fc1be4f2d57d107 F test/wordcount.c 9915e06cb33d8ca8109b8700791afe80d305afda F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688 F test/zerodamage.test cf6748bad89553cc1632be51a6f54e487e4039ac -F tool/build-all-msvc.bat b4f0b5577fd248529c3247c06309226c35db9ff6 x +F tool/build-all-msvc.bat a0534c971b86fe95f1983f445db5b896d3394818 x F tool/build-shell.sh 950f47c6174f1eea171319438b93ba67ff5bf367 F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2 F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b @@ -1168,7 +1168,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P bd92e0f80c1158d810b0d47e38f2fe06ff24bb8c -R 219607b5b5ba75498daf10431b648c43 +P 9a06773acc181e981f61f476a8e56417b98beba9 +R e91b1cf1dddb5793408fd6de2be74034 U mistachkin -Z de5605f1e301dc16c5db1ce3f5edb9e1 +Z b713eaa9517cf3b104e3dc82bdd65124 diff --git a/manifest.uuid b/manifest.uuid index e6d8119bed..af81c8bc82 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9a06773acc181e981f61f476a8e56417b98beba9 \ No newline at end of file +c1ab9092e29bc9d172c1f1a3becbcc83b79f2080 \ No newline at end of file diff --git a/tool/build-all-msvc.bat b/tool/build-all-msvc.bat index b34fe0c829..1fb61d4df8 100755 --- a/tool/build-all-msvc.bat +++ b/tool/build-all-msvc.bat @@ -277,6 +277,7 @@ FOR %%P IN (%PLATFORMS%) DO ( REM and/or Visual Studio. This block may need to be updated in the REM future to account for additional environment variables. REM + CALL :fn_UnsetVariable CommandPromptType CALL :fn_UnsetVariable DevEnvDir CALL :fn_UnsetVariable ExtensionSdkDir CALL :fn_UnsetVariable Framework35Version @@ -314,7 +315,7 @@ FOR %%P IN (%PLATFORMS%) DO ( REM environment variables to be picked up by the MSVC makefile REM itself. REM - %_AECHO% Building the "%%B" configuration for platform "%%D"... + %_AECHO% Building the %%B configuration for platform %%P with name %%D... IF /I "%%B" == "Debug" ( SET DEBUG=2 @@ -395,6 +396,8 @@ FOR %%P IN (%PLATFORMS%) DO ( REM IF DEFINED USE_WINV63_NSDKLIBPATH ( CALL :fn_AppendVariable NSDKLIBPATH \lib\winv6.3\um\x86 + ) ELSE IF "%VisualStudioVersion%" == "12.0" ( + CALL :fn_AppendVariable NSDKLIBPATH \..\8.0\lib\win8\um\x86 ) ELSE ( CALL :fn_AppendVariable NSDKLIBPATH \lib\win8\um\x86 ) From 441aa095edbdcbdcf77765424026a9d263bd1ece Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 6 May 2014 21:26:34 +0000 Subject: [PATCH 18/27] Enhance the VSIX package creation tool to better support Visual Studio 2013. FossilOrigin-Name: c1fb04f61eb74d80d1b7607ae6904fe2e1717988 --- manifest | 12 +-- manifest.uuid | 2 +- tool/mkvsix.tcl | 199 ++++++++++++++++++++++++++++++++++-------------- 3 files changed, 150 insertions(+), 63 deletions(-) diff --git a/manifest b/manifest index 089fba14e7..5cc3df3b6b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C When\sbuilding\sfor\sWindows\s8.0\susing\sVisual\sStudio\s2013,\smake\ssure\sthe\scross-compilation\snative\slibrary\spath\sis\sset\scorrectly. -D 2014-05-05T22:43:17.621 +C Enhance\sthe\sVSIX\spackage\screation\stool\sto\sbetter\ssupport\sVisual\sStudio\s2013. +D 2014-05-06T21:26:34.436 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -1140,7 +1140,7 @@ F tool/mksqlite3c-noext.tcl 1712d3d71256ca1f297046619c89e77a4d7c8f6d F tool/mksqlite3c.tcl ba274df71f5e6534b0a913c7c48eabfcbd0934b6 F tool/mksqlite3h.tcl ba24038056f51fde07c0079c41885ab85e2cff12 F tool/mksqlite3internalh.tcl b6514145a7d5321b47e64e19b8116cc44f973eb1 -F tool/mkvsix.tcl 6477fb9dab838b7eea1eed50658ff1cda04850b5 +F tool/mkvsix.tcl 924dcdecda86969686833301c08f84cca2600d94 F tool/offsets.c fe4262fdfa378e8f5499a42136d17bf3b98f6091 F tool/omittest.tcl 34d7ac01fe4fd18e3637f64abe12c40eca0f6b97 F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c @@ -1168,7 +1168,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 9a06773acc181e981f61f476a8e56417b98beba9 -R e91b1cf1dddb5793408fd6de2be74034 +P c1ab9092e29bc9d172c1f1a3becbcc83b79f2080 +R a58107e75319df920bcb764f3109ea62 U mistachkin -Z b713eaa9517cf3b104e3dc82bdd65124 +Z 469c7a319e5e989d73df4c062d995fca diff --git a/manifest.uuid b/manifest.uuid index af81c8bc82..4bcb53df54 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c1ab9092e29bc9d172c1f1a3becbcc83b79f2080 \ No newline at end of file +c1fb04f61eb74d80d1b7607ae6904fe2e1717988 \ No newline at end of file diff --git a/tool/mkvsix.tcl b/tool/mkvsix.tcl index 65fa731245..712cf32278 100644 --- a/tool/mkvsix.tcl +++ b/tool/mkvsix.tcl @@ -65,12 +65,15 @@ # argument is optional and if present must contain the name of the directory # containing the root of the source tree for SQLite. The third argument is # optional and if present must contain the flavor the VSIX package to build. -# Currently, the only supported package flavors are "WinRT", "WinRT81", and -# "WP80". The fourth argument is optional and if present must be a string -# containing a list of platforms to include in the VSIX package. The format -# of the platform list string is "platform1,platform2,platform3". Typically, -# when on Windows, this script is executed using commands similar to the -# following from a normal Windows command prompt: +# Currently, the only supported package flavors are "WinRT", "WinRT81", "WP80", +# and "Win32". The fourth argument is optional and if present must be a string +# containing a list of platforms to include in the VSIX package. The platform +# list is "platform1,platform2,platform3". The fifth argument is optional and +# if present must contain the version of Visual Studio required by the package. +# Currently, the only supported versions are "2012" and "2013". The package +# flavor "WinRT81" is only supported when the Visual Studio version is "2013". +# Typically, when on Windows, this script is executed using commands similar to +# the following from a normal Windows command prompt: # # CD /D C:\dev\sqlite\core # tclsh85 tool\mkvsix.tcl C:\Temp @@ -100,7 +103,7 @@ proc fail { {error ""} {usage false} } { puts stdout "usage:\ [file tail [info nameofexecutable]]\ [file tail [info script]] \[sourceDirectory\]\ -\[packageFlavor\] \[platformNames\]" +\[packageFlavor\] \[platformNames\] \[vsVersion\]" exit 1 } @@ -170,13 +173,49 @@ proc writeFile { fileName data } { return "" } -proc substFile { fileName } { +proc getMinVsVersionXmlChunk { vsVersion } { + switch -exact $vsVersion { + 2012 { + return [appendArgs \ + "\r\n " {MinVSVersion="11.0"}] + } + 2013 { + return [appendArgs \ + "\r\n " {MinVSVersion="12.0"}] + } + default { + return "" + } + } +} + +proc getExtraFileListXmlChunk { packageFlavor vsVersion } { # - # NOTE: Performs all Tcl command, variable, and backslash substitutions in - # the specified file and then rewrites the contents of that same file - # with the substituted data. + # NOTE: Windows Phone 8.0 does not require any extra attributes in its VSIX + # package SDK manifests. # - return [writeFile $fileName [uplevel 1 [list subst [readFile $fileName]]]] + if {[string equal $packageFlavor WP80]} then { + return "" + } + + set appliesTo [expr {[string equal $packageFlavor Win32] ? \ + "VisualC" : "WindowsAppContainer"}] + + switch -exact $vsVersion { + 2012 { + return [appendArgs \ + "\r\n " AppliesTo=\" $appliesTo \" \ + "\r\n " {DependsOn="Microsoft.VCLibs, version=11.0"}] + } + 2013 { + return [appendArgs \ + "\r\n " AppliesTo=\" $appliesTo \" \ + "\r\n " {DependsOn="Microsoft.VCLibs, version=12.0"}] + } + default { + return "" + } + } } proc replaceFileNameTokens { fileName name buildName platformName } { @@ -188,6 +227,15 @@ proc replaceFileNameTokens { fileName name buildName platformName } { $name] $fileName] } +proc substFile { fileName } { + # + # NOTE: Performs all Tcl command, variable, and backslash substitutions in + # the specified file and then rewrites the contents of that same file + # with the substituted data. + # + return [writeFile $fileName [uplevel 1 [list subst [readFile $fileName]]]] +} + # # NOTE: This is the entry point for this script. # @@ -206,7 +254,7 @@ set rootName [file rootname [file tail $script]] # NOTE: Process and verify all the command line arguments. # set argc [llength $argv] -if {$argc < 1 || $argc > 4} then {fail} +if {$argc < 1 || $argc > 5} then {fail} set binaryDirectory [lindex $argv 0] @@ -251,58 +299,97 @@ if {[string length $packageFlavor] == 0} then { fail "invalid package flavor" } -if {[string equal -nocase $packageFlavor WinRT]} then { - set shortName SQLite.WinRT - set displayName "SQLite for Windows Runtime" - set targetPlatformIdentifier Windows - set targetPlatformVersion v8.0 - set minVsVersion 11.0 - set extraSdkPath "" - set extraFileListAttributes [appendArgs \ - "\r\n " {AppliesTo="WindowsAppContainer"} \ - "\r\n " {DependsOn="Microsoft.VCLibs, version=11.0"}] -} elseif {[string equal -nocase $packageFlavor WinRT81]} then { - set shortName SQLite.WinRT81 - set displayName "SQLite for Windows Runtime (Windows 8.1)" - set targetPlatformIdentifier Windows - set targetPlatformVersion v8.1 - set minVsVersion 12.0 - set extraSdkPath "" - set extraFileListAttributes [appendArgs \ - "\r\n " {AppliesTo="WindowsAppContainer"} \ - "\r\n " {DependsOn="Microsoft.VCLibs, version=12.0"}] -} elseif {[string equal -nocase $packageFlavor WP80]} then { - set shortName SQLite.WP80 - set displayName "SQLite for Windows Phone" - set targetPlatformIdentifier "Windows Phone" - set targetPlatformVersion v8.0 - set minVsVersion 11.0 - set extraSdkPath "\\..\\$targetPlatformIdentifier" - set extraFileListAttributes "" -} elseif {[string equal -nocase $packageFlavor Win32]} then { - set shortName SQLite.Win32 - set displayName "SQLite for Windows" - set targetPlatformIdentifier Windows - set targetPlatformVersion v8.0 - set minVsVersion 11.0 - set extraSdkPath "" - set extraFileListAttributes [appendArgs \ - "\r\n " {AppliesTo="VisualC"} \ - "\r\n " {DependsOn="Microsoft.VCLibs, version=11.0"}] -} else { - fail "unsupported package flavor, must be one of: WinRT WinRT81 WP80 Win32" -} - if {$argc >= 4} then { set platformNames [list] foreach platformName [split [lindex $argv 3] ", "] { + set platformName [string trim $platformName] + if {[string length $platformName] > 0} then { lappend platformNames $platformName } } } +if {$argc >= 5} then { + set vsVersion [lindex $argv 4] +} else { + set vsVersion 2012 +} + +if {[string length $vsVersion] == 0} then { + fail "invalid Visual Studio version" +} + +if {$vsVersion ne "2012" && $vsVersion ne "2013"} then { + fail [appendArgs \ + "unsupported Visual Studio version, must be one of: " \ + [list 2012 2013]] +} + +set shortNames(WinRT,2012) SQLite.WinRT +set shortNames(WinRT,2013) SQLite.WinRT.2013 +set shortNames(WinRT81,2013) SQLite.WinRT81 +set shortNames(WP80,2012) SQLite.WP80 +set shortNames(WP80,2013) SQLite.WP80.2013 +set shortNames(Win32,2012) SQLite.Win32 +set shortNames(Win32,2013) SQLite.Win32.2013 + +set displayNames(WinRT,2012) "SQLite for Windows Runtime" +set displayNames(WinRT,2013) "SQLite for Windows Runtime" +set displayNames(WinRT81,2013) "SQLite for Windows Runtime (Windows 8.1)" +set displayNames(WP80,2012) "SQLite for Windows Phone" +set displayNames(WP80,2013) "SQLite for Windows Phone" +set displayNames(Win32,2012) "SQLite for Windows" +set displayNames(Win32,2013) "SQLite for Windows" + +if {[string equal $packageFlavor WinRT]} then { + set shortName $shortNames($packageFlavor,$vsVersion) + set displayName $displayNames($packageFlavor,$vsVersion) + set targetPlatformIdentifier Windows + set targetPlatformVersion v8.0 + set minVsVersion [getMinVsVersionXmlChunk $vsVersion] + set extraSdkPath "" + set extraFileListAttributes \ + [getExtraFileListXmlChunk $packageFlavor $vsVersion] +} elseif {[string equal $packageFlavor WinRT81]} then { + if {$vsVersion ne "2013"} then { + fail [appendArgs \ + "unsupported combination, package flavor " $packageFlavor \ + " is only supported with Visual Studio 2013"] + } + set shortName $shortNames($packageFlavor,$vsVersion) + set displayName $displayNames($packageFlavor,$vsVersion) + set targetPlatformIdentifier Windows + set targetPlatformVersion v8.1 + set minVsVersion [getMinVsVersionXmlChunk $vsVersion] + set extraSdkPath "" + set extraFileListAttributes \ + [getExtraFileListXmlChunk $packageFlavor $vsVersion] +} elseif {[string equal $packageFlavor WP80]} then { + set shortName $shortNames($packageFlavor,$vsVersion) + set displayName $displayNames($packageFlavor,$vsVersion) + set targetPlatformIdentifier "Windows Phone" + set targetPlatformVersion v8.0 + set minVsVersion [getMinVsVersionXmlChunk $vsVersion] + set extraSdkPath "\\..\\$targetPlatformIdentifier" + set extraFileListAttributes \ + [getExtraFileListXmlChunk $packageFlavor $vsVersion] +} elseif {[string equal $packageFlavor Win32]} then { + set shortName $shortNames($packageFlavor,$vsVersion) + set displayName $displayNames($packageFlavor,$vsVersion) + set targetPlatformIdentifier Windows + set targetPlatformVersion v8.0 + set minVsVersion [getMinVsVersionXmlChunk $vsVersion] + set extraSdkPath "" + set extraFileListAttributes \ + [getExtraFileListXmlChunk $packageFlavor $vsVersion] +} else { + fail [appendArgs \ + "unsupported package flavor, must be one of: " \ + [list WinRT WinRT81 WP80 Win32]] +} + ############################################################################### # @@ -490,7 +577,7 @@ if {![info exists buildNames]} then { # overridden via the command line or the user-specific customizations # file. # -if {![info exists platformNames]} then { +if {![info exists platformNames] || [llength $platformNames] == 0} then { set platformNames [list x86 x64 ARM] } From 6117272e03bf37fb4754205bc13f0826b35bc788 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Tue, 6 May 2014 21:37:10 +0000 Subject: [PATCH 19/27] Update the template VSIX package file as well. FossilOrigin-Name: 99d96765cc378fde7b285f4577ea2b5d130d9a61 --- manifest | 12 ++++++------ manifest.uuid | 2 +- tool/win/sqlite.vsix | Bin 32825 -> 32820 bytes 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 5cc3df3b6b..91f6b157b3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhance\sthe\sVSIX\spackage\screation\stool\sto\sbetter\ssupport\sVisual\sStudio\s2013. -D 2014-05-06T21:26:34.436 +C Update\sthe\stemplate\sVSIX\spackage\sfile\sas\swell. +D 2014-05-06T21:37:10.782 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -1167,8 +1167,8 @@ F tool/vdbe-compress.tcl 0cf56e9263a152b84da86e75a5c0cdcdb7a47891 F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 -F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P c1ab9092e29bc9d172c1f1a3becbcc83b79f2080 -R a58107e75319df920bcb764f3109ea62 +F tool/win/sqlite.vsix a94fb9b1b1ef06efc2898975cdfcfa9643731f5e +P c1fb04f61eb74d80d1b7607ae6904fe2e1717988 +R e86d9d0c4e9d221c23e483062a69a0ee U mistachkin -Z 469c7a319e5e989d73df4c062d995fca +Z 61035ffe1ca5b1a658207d61a8a19a18 diff --git a/manifest.uuid b/manifest.uuid index 4bcb53df54..eaa07f7373 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c1fb04f61eb74d80d1b7607ae6904fe2e1717988 \ No newline at end of file +99d96765cc378fde7b285f4577ea2b5d130d9a61 \ No newline at end of file diff --git a/tool/win/sqlite.vsix b/tool/win/sqlite.vsix index ac4afb3f4bc2aa7c4419376732e5a7b3910d1070..de4d0a1f96ad3b53b899a7bcfbba53f23a1d4990 100644 GIT binary patch delta 313 zcmV-90mlBhfC99D0OuO<`_nW@U49E_iKh zRgh0h!$1(l?}dJcWy#e>>ZK#bm%`XWEq3S8|QbemE~Y0oaTn%_((vn3jMK$hu5rMX28f2R6=tSpo|+cp1k z&?E6gzKOLgD~sljMljq5(yIX^5M~`ES(~)C%Z4o z>h=0f?;lVcLX-FbvkrS(1PuUykwjgh(dOF#001|Wc7HGjqdpA6kXp}^t$#ZK36tr6 LN(K*n00000h#!t5 delta 327 zcmV-N0l5COfC9OI0OuO<`_nW@U49E_iKh zRgg_f!$1&*?}h${W$D#KZ=zjGK?{Nvq0ozZh{>cG*)L~jO-1tG-H^t%dwbxSecze+ zVsEtg1`6n`l2_TK6ktnNq1`DNxxToTVsST}%vY%42?I|jBE5SIe_j_q&xHXcXTQ}E zJ2@CHTmsxYYkz0f$~Q)}%A9&PQEY?%E`p0{nAg)fZ^nWJ4kYG}8c?a;FS$0QC1 z?h?bEsTdnBnF&84L+FO-P4qtHhIQ18Uc+H9DEUC-NS;|xEval$e#wy_Ij^4%t(c|# zxOQav_CdVezRUh93HcbB;15ts0|b-5e;BhRdp`sXQ(e?Tdi!qm-~a#sOp|ecFb5W4 ZChz5K&XcHrI{^-px001^@mD~UT From 62e603a904e8d4c48ba70df5ef1376dcfdb27e73 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 7 May 2014 15:09:24 +0000 Subject: [PATCH 20/27] Add test cases and documentation for the nolock and immutable query parameters. FossilOrigin-Name: 19d56cbaca222b32e2e354063149cccd89441d73 --- manifest | 15 ++--- manifest.uuid | 2 +- src/sqlite.h.in | 29 +++++++++- src/test_vfs.c | 73 +++++++++++++++++------- test/nolock.test | 143 +++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 232 insertions(+), 30 deletions(-) create mode 100644 test/nolock.test diff --git a/manifest b/manifest index 6ac75f7987..f945a392c4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Take\sout\sthe\sspecial\shandling\sof\snolock=true\sin\sos_win.c\sand\sadd\sit\sto\npager.c,\sso\sthat\sit\sworks\sfor\sall\sVFSes.\s\sAdd\sthe\spPager->noLock\sboolean\nfor\sclarity. -D 2014-05-01T01:49:22.279 +C Add\stest\scases\sand\sdocumentation\sfor\sthe\snolock\sand\simmutable\squery\nparameters. +D 2014-05-07T15:09:24.618 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -220,7 +220,7 @@ F src/resolve.c 273d5f47c4e2c05b2d3d2bffeda939551ab59e66 F src/rowset.c a9c9aae3234b44a6d7c6f5a3cadf90dce1e627be F src/select.c ed459f7f478a1e533d19c4b953693b3ffa2efd15 F src/shell.c 2afe7a7154e97be0c74c5feacf09626bda8493be -F src/sqlite.h.in ad2bbeb6a41c228f6a9dbf24df62e4d3eff79ee5 +F src/sqlite.h.in 564fc23db33870b5096b20d72df7491ce0b8b74f F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc F src/sqliteInt.h b2947801eccefd7ba3e5f14e1353289351a83cf3 @@ -270,7 +270,7 @@ F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd F src/test_syscall.c 2e21ca7f7dc54a028f1967b63f1e76155c356f9b F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa F src/test_thread.c 1e133a40b50e9c035b00174035b846e7eef481cb -F src/test_vfs.c e72f555ef7a59080f898fcf1a233deb9eb704ea9 +F src/test_vfs.c f84075a388527892ff184988f43b69ce69b8083c F src/test_vfstrace.c bab9594adc976cbe696ff3970728830b4c5ed698 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/tokenize.c 6da2de6e12218ccb0aea5184b56727d011f4bee7 @@ -713,6 +713,7 @@ F test/multiplex3.test d228f59eac91839a977eac19f21d053f03e4d101 F test/mutex1.test 78b2b9bb320e51d156c4efdb71b99b051e7a4b41 F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660 F test/nan.test e9648b9d007c7045242af35e11a984d4b169443a +F test/nolock.test 77b278317fa765b1ada5f88d59219cdeb8364f8f F test/notify1.test 669b2b743618efdc18ca4b02f45423d5d2304abf F test/notify2.test ce23eb522c9e1fff6443f96376fe67872202061c F test/notify3.test 10ff25cde502e72a92053a2f215d64bece4ef934 @@ -1166,7 +1167,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 1829c38c3233c8cb194fae6d560d35a8916b1348 -R 9585bcff14fbe775451a3a647d896079 +P 725c1c14be331bce9bf074960dbfa7b6d4c1ba87 +R 89db3fd7a34cc009fbfa4be31d82927f U drh -Z 3dae204f6c4a7be4483961b87ae0c17a +Z 2af631f996ea658459fe7078e363eaf4 diff --git a/manifest.uuid b/manifest.uuid index d015fa2fa6..164fe70792 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -725c1c14be331bce9bf074960dbfa7b6d4c1ba87 \ No newline at end of file +19d56cbaca222b32e2e354063149cccd89441d73 \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 81220a8822..9be07fc1e6 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -2778,6 +2778,30 @@ void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); ** ^If sqlite3_open_v2() is used and the "cache" parameter is present in ** a URI filename, its value overrides any behavior requested by setting ** SQLITE_OPEN_PRIVATECACHE or SQLITE_OPEN_SHAREDCACHE flag. +** +**
  • psow: ^The psow parameter may be "true" (or "on" or "yes" or +** "1") or "false" (or "off" or "no" or "0") to indicate that the +** [powersafe overwrite] property does or does not apply to the +** storage media on which the database file resides. ^The psow query +** parameter only works for the built-in unix and Windows VFSes. +** +**
  • nolock: ^The nolock parameter is a boolean query parameter +** which if set disables file locking in rollback journal modes. This +** is useful for accessing a database on a filesystem that does not +** support locking. Caution: Database corruption might result if two +** or more processes write to the same database and any one of those +** processes uses nolock=1. +** +**
  • immutable: ^The immutable parameter is a boolean query +** parameter that indicates that the database file is stored on +** read-only media. ^When immutable is set, SQLite assumes that the +** database file cannot be changed, even by a process with higher +** privilege, and so the database is opened read-only and all locking +** and change detection is disabled. Caution: Setting the immutable +** property on a database file that does in fact change can result +** in incorrect query results and/or [SQLITE_CORRUPT] errors. +** See also: [SQLITE_IOCAP_IMMUTABLE]. +** ** ** ** ^Specifying an unknown parameter in the query component of a URI is not an @@ -2807,8 +2831,9 @@ void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); ** Open file "data.db" in the current directory for read-only access. ** Regardless of whether or not shared-cache mode is enabled by ** default, use a private cache. -** file:/home/fred/data.db?vfs=unix-nolock -** Open file "/home/fred/data.db". Use the special VFS "unix-nolock". +** file:/home/fred/data.db?vfs=unix-dotfile +** Open file "/home/fred/data.db". Use the special VFS "unix-dotfile" +** that uses dot-files in place of posix advisory locking. ** file:data.db?mode=readonly ** An error. "readonly" is not a valid option for the "mode" parameter. ** diff --git a/src/test_vfs.c b/src/test_vfs.c index 613b0fce77..7ee2a93453 100644 --- a/src/test_vfs.c +++ b/src/test_vfs.c @@ -127,8 +127,10 @@ struct Testvfs { #define TESTVFS_FULLPATHNAME_MASK 0x00008000 #define TESTVFS_READ_MASK 0x00010000 #define TESTVFS_UNLOCK_MASK 0x00020000 +#define TESTVFS_LOCK_MASK 0x00040000 +#define TESTVFS_CKLOCK_MASK 0x00080000 -#define TESTVFS_ALL_MASK 0x0003FFFF +#define TESTVFS_ALL_MASK 0x000FFFFF #define TESTVFS_MAX_PAGES 1024 @@ -466,8 +468,15 @@ static int tvfsFileSize(sqlite3_file *pFile, sqlite_int64 *pSize){ ** Lock an tvfs-file. */ static int tvfsLock(sqlite3_file *pFile, int eLock){ - TestvfsFd *p = tvfsGetFd(pFile); - return sqlite3OsLock(p->pReal, eLock); + TestvfsFd *pFd = tvfsGetFd(pFile); + Testvfs *p = (Testvfs *)pFd->pVfs->pAppData; + if( p->pScript && p->mask&TESTVFS_LOCK_MASK ){ + char zLock[30]; + sqlite3_snprintf(sizeof(zLock),zLock,"%d",eLock); + tvfsExecTcl(p, "xLock", Tcl_NewStringObj(pFd->zFilename, -1), + Tcl_NewStringObj(zLock, -1), 0, 0); + } + return sqlite3OsLock(pFd->pReal, eLock); } /* @@ -476,6 +485,12 @@ static int tvfsLock(sqlite3_file *pFile, int eLock){ static int tvfsUnlock(sqlite3_file *pFile, int eLock){ TestvfsFd *pFd = tvfsGetFd(pFile); Testvfs *p = (Testvfs *)pFd->pVfs->pAppData; + if( p->pScript && p->mask&TESTVFS_UNLOCK_MASK ){ + char zLock[30]; + sqlite3_snprintf(sizeof(zLock),zLock,"%d",eLock); + tvfsExecTcl(p, "xUnlock", Tcl_NewStringObj(pFd->zFilename, -1), + Tcl_NewStringObj(zLock, -1), 0, 0); + } if( p->mask&TESTVFS_WRITE_MASK && tvfsInjectIoerr(p) ){ return SQLITE_IOERR_UNLOCK; } @@ -486,8 +501,13 @@ static int tvfsUnlock(sqlite3_file *pFile, int eLock){ ** Check if another file-handle holds a RESERVED lock on an tvfs-file. */ static int tvfsCheckReservedLock(sqlite3_file *pFile, int *pResOut){ - TestvfsFd *p = tvfsGetFd(pFile); - return sqlite3OsCheckReservedLock(p->pReal, pResOut); + TestvfsFd *pFd = tvfsGetFd(pFile); + Testvfs *p = (Testvfs *)pFd->pVfs->pAppData; + if( p->pScript && p->mask&TESTVFS_CKLOCK_MASK ){ + tvfsExecTcl(p, "xCheckReservedLock", Tcl_NewStringObj(pFd->zFilename, -1), + 0, 0, 0); + } + return sqlite3OsCheckReservedLock(pFd->pReal, pResOut); } /* @@ -1111,26 +1131,32 @@ static int testvfs_obj_cmd( break; } + /* TESTVFS filter METHOD-LIST + ** + ** Activate special processing for those methods contained in the list + */ case CMD_FILTER: { static struct VfsMethod { char *zName; int mask; } vfsmethod [] = { - { "xShmOpen", TESTVFS_SHMOPEN_MASK }, - { "xShmLock", TESTVFS_SHMLOCK_MASK }, - { "xShmBarrier", TESTVFS_SHMBARRIER_MASK }, - { "xShmUnmap", TESTVFS_SHMCLOSE_MASK }, - { "xShmMap", TESTVFS_SHMMAP_MASK }, - { "xSync", TESTVFS_SYNC_MASK }, - { "xDelete", TESTVFS_DELETE_MASK }, - { "xWrite", TESTVFS_WRITE_MASK }, - { "xRead", TESTVFS_READ_MASK }, - { "xTruncate", TESTVFS_TRUNCATE_MASK }, - { "xOpen", TESTVFS_OPEN_MASK }, - { "xClose", TESTVFS_CLOSE_MASK }, - { "xAccess", TESTVFS_ACCESS_MASK }, - { "xFullPathname", TESTVFS_FULLPATHNAME_MASK }, - { "xUnlock", TESTVFS_UNLOCK_MASK }, + { "xShmOpen", TESTVFS_SHMOPEN_MASK }, + { "xShmLock", TESTVFS_SHMLOCK_MASK }, + { "xShmBarrier", TESTVFS_SHMBARRIER_MASK }, + { "xShmUnmap", TESTVFS_SHMCLOSE_MASK }, + { "xShmMap", TESTVFS_SHMMAP_MASK }, + { "xSync", TESTVFS_SYNC_MASK }, + { "xDelete", TESTVFS_DELETE_MASK }, + { "xWrite", TESTVFS_WRITE_MASK }, + { "xRead", TESTVFS_READ_MASK }, + { "xTruncate", TESTVFS_TRUNCATE_MASK }, + { "xOpen", TESTVFS_OPEN_MASK }, + { "xClose", TESTVFS_CLOSE_MASK }, + { "xAccess", TESTVFS_ACCESS_MASK }, + { "xFullPathname", TESTVFS_FULLPATHNAME_MASK }, + { "xUnlock", TESTVFS_UNLOCK_MASK }, + { "xLock", TESTVFS_LOCK_MASK }, + { "xCheckReservedLock", TESTVFS_CKLOCK_MASK }, }; Tcl_Obj **apElem = 0; int nElem = 0; @@ -1162,6 +1188,12 @@ static int testvfs_obj_cmd( break; } + /* + ** TESTVFS script ?SCRIPT? + ** + ** Query or set the script to be run when filtered VFS events + ** occur. + */ case CMD_SCRIPT: { if( objc==3 ){ int nByte; @@ -1248,6 +1280,7 @@ static int testvfs_obj_cmd( { "safe_append", SQLITE_IOCAP_SAFE_APPEND }, { "undeletable_when_open", SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN }, { "powersafe_overwrite", SQLITE_IOCAP_POWERSAFE_OVERWRITE }, + { "immutable", SQLITE_IOCAP_IMMUTABLE }, { 0, 0 } }; Tcl_Obj *pRet; diff --git a/test/nolock.test b/test/nolock.test new file mode 100644 index 0000000000..98ed762cac --- /dev/null +++ b/test/nolock.test @@ -0,0 +1,143 @@ +# 2014-05-07 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# +# This file implements regression tests for SQLite library. The +# focus of this file is testing the nolock=1 and immutable=1 query +# parameters and the SQLITE_IOCAP_IMMUTABLE device characteristic. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +unset -nocomplain tvfs_calls +proc tvfs_reset {} { + global tvfs_calls + array set tvfs_calls {xLock 0 xUnlock 0 xCheckReservedLock 0 xAccess 0} +} +proc tvfs_callback {op args} { + global tvfs_calls + incr tvfs_calls($op) + return SQLITE_OK +} +tvfs_reset + +testvfs tvfs +tvfs script tvfs_callback +tvfs filter {xLock xUnlock xCheckReservedLock xAccess} + +############################################################################ +# Verify that the nolock=1 query parameter for URI filenames disables all +# calls to xLock and xUnlock for rollback databases. +# +do_test nolock-1.0 { + db close + forcedelete test.db + tvfs_reset + sqlite db test.db -vfs tvfs + db eval {CREATE TABLE t1(a,b,c); INSERT INTO t1 VALUES(1,2,3);} + list xLock $::tvfs_calls(xLock) xUnlock $::tvfs_calls(xUnlock) \ + xCheckReservedLock $::tvfs_calls(xCheckReservedLock) +} {xLock 7 xUnlock 5 xCheckReservedLock 0} + +do_test nolock-1.1 { + db close + forcedelete test.db + tvfs_reset + sqlite db file:test.db?nolock=0 -vfs tvfs -uri 1 + db eval {CREATE TABLE t1(a,b,c); INSERT INTO t1 VALUES(1,2,3);} + list xLock $::tvfs_calls(xLock) xUnlock $::tvfs_calls(xUnlock) \ + xCheckReservedLock $::tvfs_calls(xCheckReservedLock) +} {xLock 7 xUnlock 5 xCheckReservedLock 0} + +do_test nolock-1.2 { + db close + forcedelete test.db + tvfs_reset + sqlite db file:test.db?nolock=1 -vfs tvfs -uri 1 + db eval {CREATE TABLE t1(a,b,c); INSERT INTO t1 VALUES(1,2,3);} + list xLock $::tvfs_calls(xLock) xUnlock $::tvfs_calls(xUnlock) \ + xCheckReservedLock $::tvfs_calls(xCheckReservedLock) +} {xLock 0 xUnlock 0 xCheckReservedLock 0} + +############################################################################# +# Verify that immutable=1 disables both locking and xAccess calls to the +# journal files. +# +do_test nolock-2.0 { + db close + forcedelete test.db + # begin by creating a test database + sqlite3 db test.db + db eval { + CREATE TABLE t1(a,b); + INSERT INTO t1 VALUES('hello','world'); + CREATE TABLE t2(x,y); + INSERT INTO t2 VALUES(12345,67890); + SELECT * FROM t1, t2; + } +} {hello world 12345 67890} +do_test nolock-2.1 { + tvfs_reset + sqlite3 db2 test.db -vfs tvfs + db2 eval {SELECT * FROM t1, t2} +} {hello world 12345 67890} +do_test nolock-2.2 { + list xLock $::tvfs_calls(xLock) xUnlock $::tvfs_calls(xUnlock) \ + xCheckReservedLock $::tvfs_calls(xCheckReservedLock) \ + xAccess $::tvfs_calls(xAccess) +} {xLock 2 xUnlock 2 xCheckReservedLock 0 xAccess 4} + + +do_test nolock-2.11 { + db2 close + tvfs_reset + sqlite3 db2 file:test.db?immutable=0 -vfs tvfs -uri 1 + db2 eval {SELECT * FROM t1, t2} +} {hello world 12345 67890} +do_test nolock-2.12 { + list xLock $::tvfs_calls(xLock) xUnlock $::tvfs_calls(xUnlock) \ + xCheckReservedLock $::tvfs_calls(xCheckReservedLock) \ + xAccess $::tvfs_calls(xAccess) +} {xLock 2 xUnlock 2 xCheckReservedLock 0 xAccess 4} + + +do_test nolock-2.21 { + db2 close + tvfs_reset + sqlite3 db2 file:test.db?immutable=1 -vfs tvfs -uri 1 + db2 eval {SELECT * FROM t1, t2} +} {hello world 12345 67890} +do_test nolock-2.22 { + list xLock $::tvfs_calls(xLock) xUnlock $::tvfs_calls(xUnlock) \ + xCheckReservedLock $::tvfs_calls(xCheckReservedLock) \ + xAccess $::tvfs_calls(xAccess) +} {xLock 0 xUnlock 0 xCheckReservedLock 0 xAccess 0} + +############################################################################ +# Verify that the SQLITE_IOCAP_IMMUTABLE flag works +# +do_test nolock-3.1 { + db2 close + tvfs devchar immutable + tvfs_reset + sqlite3 db2 test.db -vfs tvfs + db2 eval {SELECT * FROM t1, t2} +} {hello world 12345 67890} +do_test nolock-3.2 { + list xLock $::tvfs_calls(xLock) xUnlock $::tvfs_calls(xUnlock) \ + xCheckReservedLock $::tvfs_calls(xCheckReservedLock) \ + xAccess $::tvfs_calls(xAccess) +} {xLock 0 xUnlock 0 xCheckReservedLock 0 xAccess 0} + +db2 close +db close +tvfs delete +finish_test From 6451c2b04e1f08175800d1c9359b634565c84ce6 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 7 May 2014 15:32:03 +0000 Subject: [PATCH 21/27] Fix nolock and immutable so that they work even if READONLY is requested. FossilOrigin-Name: e193aced2942e7405d0f45f90d4954b5663b4ba5 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/pager.c | 14 +++++++------- test/nolock.test | 42 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 15 deletions(-) diff --git a/manifest b/manifest index f945a392c4..4823bece17 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\stest\scases\sand\sdocumentation\sfor\sthe\snolock\sand\simmutable\squery\nparameters. -D 2014-05-07T15:09:24.618 +C Fix\snolock\sand\simmutable\sso\sthat\sthey\swork\seven\sif\sREADONLY\sis\srequested. +D 2014-05-07T15:32:03.879 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -206,7 +206,7 @@ F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_unix.c ae4b5240af4619d711301d7992396e182585269f F src/os_win.c e71678ac927d0a0fb11d993db20a9748eabf808e -F src/pager.c 6ed54e169933200b8d113674d5da46a5cbd32c6c +F src/pager.c f6bb1fa6cdf2062f2d8aec3e64db302bca519ab8 F src/pager.h ffd5607f7b3e4590b415b007a4382f693334d428 F src/parse.y 22d6a074e5f5a7258947a1dc55a9bf946b765dd0 F src/pcache.c d8eafac28290d4bb80332005435db44991d07fc2 @@ -713,7 +713,7 @@ F test/multiplex3.test d228f59eac91839a977eac19f21d053f03e4d101 F test/mutex1.test 78b2b9bb320e51d156c4efdb71b99b051e7a4b41 F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660 F test/nan.test e9648b9d007c7045242af35e11a984d4b169443a -F test/nolock.test 77b278317fa765b1ada5f88d59219cdeb8364f8f +F test/nolock.test 0540dd96f39b8876e3ffdd8814fad0ea425efeee F test/notify1.test 669b2b743618efdc18ca4b02f45423d5d2304abf F test/notify2.test ce23eb522c9e1fff6443f96376fe67872202061c F test/notify3.test 10ff25cde502e72a92053a2f215d64bece4ef934 @@ -1167,7 +1167,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 725c1c14be331bce9bf074960dbfa7b6d4c1ba87 -R 89db3fd7a34cc009fbfa4be31d82927f +P 19d56cbaca222b32e2e354063149cccd89441d73 +R 330846b5261a6146788edf187c03b165 U drh -Z 2af631f996ea658459fe7078e363eaf4 +Z 1507cbe7cdb05905b7ab13bc4a3a8db3 diff --git a/manifest.uuid b/manifest.uuid index 164fe70792..ba9d26dfee 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -19d56cbaca222b32e2e354063149cccd89441d73 \ No newline at end of file +e193aced2942e7405d0f45f90d4954b5663b4ba5 \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index 9ab7cfbe54..a77dcecc4c 100644 --- a/src/pager.c +++ b/src/pager.c @@ -4676,8 +4676,8 @@ int sqlite3PagerOpen( ** + The largest page size that can be written atomically. */ if( rc==SQLITE_OK ){ + int iDc = sqlite3OsDeviceCharacteristics(pPager->fd); if( !readOnly ){ - int iDc = sqlite3OsDeviceCharacteristics(pPager->fd); setSectorSize(pPager); assert(SQLITE_DEFAULT_PAGE_SIZE<=SQLITE_MAX_DEFAULT_PAGE_SIZE); if( szPageDfltsectorSize ){ @@ -4700,12 +4700,12 @@ int sqlite3PagerOpen( } } #endif - pPager->noLock = sqlite3_uri_boolean(zFilename, "nolock", 0); - if( (iDc & SQLITE_IOCAP_IMMUTABLE)!=0 - || sqlite3_uri_boolean(zFilename, "immutable", 0) ){ - vfsFlags |= SQLITE_OPEN_READONLY; - goto act_like_temp_file; - } + } + pPager->noLock = sqlite3_uri_boolean(zFilename, "nolock", 0); + if( (iDc & SQLITE_IOCAP_IMMUTABLE)!=0 + || sqlite3_uri_boolean(zFilename, "immutable", 0) ){ + vfsFlags |= SQLITE_OPEN_READONLY; + goto act_like_temp_file; } } }else{ diff --git a/test/nolock.test b/test/nolock.test index 98ed762cac..331af08ad7 100644 --- a/test/nolock.test +++ b/test/nolock.test @@ -67,6 +67,24 @@ do_test nolock-1.2 { xCheckReservedLock $::tvfs_calls(xCheckReservedLock) } {xLock 0 xUnlock 0 xCheckReservedLock 0} +do_test nolock-1.3 { + db close + tvfs_reset + sqlite db file:test.db?nolock=0 -vfs tvfs -uri 1 -readonly 1 + db eval {SELECT * FROM t1} + list xLock $::tvfs_calls(xLock) xUnlock $::tvfs_calls(xUnlock) \ + xCheckReservedLock $::tvfs_calls(xCheckReservedLock) +} {xLock 2 xUnlock 2 xCheckReservedLock 0} + +do_test nolock-1.4 { + db close + tvfs_reset + sqlite db file:test.db?nolock=1 -vfs tvfs -uri 1 -readonly 1 + db eval {SELECT * FROM t1} + list xLock $::tvfs_calls(xLock) xUnlock $::tvfs_calls(xUnlock) \ + xCheckReservedLock $::tvfs_calls(xCheckReservedLock) +} {xLock 0 xUnlock 0 xCheckReservedLock 0} + ############################################################################# # Verify that immutable=1 disables both locking and xAccess calls to the # journal files. @@ -121,6 +139,18 @@ do_test nolock-2.22 { xAccess $::tvfs_calls(xAccess) } {xLock 0 xUnlock 0 xCheckReservedLock 0 xAccess 0} +do_test nolock-2.31 { + db2 close + tvfs_reset + sqlite3 db2 file:test.db?immutable=1 -vfs tvfs -uri 1 -readonly 1 + db2 eval {SELECT * FROM t1, t2} +} {hello world 12345 67890} +do_test nolock-2.32 { + list xLock $::tvfs_calls(xLock) xUnlock $::tvfs_calls(xUnlock) \ + xCheckReservedLock $::tvfs_calls(xCheckReservedLock) \ + xAccess $::tvfs_calls(xAccess) +} {xLock 0 xUnlock 0 xCheckReservedLock 0 xAccess 0} + ############################################################################ # Verify that the SQLITE_IOCAP_IMMUTABLE flag works # @@ -137,6 +167,18 @@ do_test nolock-3.2 { xAccess $::tvfs_calls(xAccess) } {xLock 0 xUnlock 0 xCheckReservedLock 0 xAccess 0} +do_test nolock-3.11 { + db2 close + tvfs_reset + sqlite3 db2 test.db -vfs tvfs -readonly 1 + db2 eval {SELECT * FROM t1, t2} +} {hello world 12345 67890} +do_test nolock-3.12 { + list xLock $::tvfs_calls(xLock) xUnlock $::tvfs_calls(xUnlock) \ + xCheckReservedLock $::tvfs_calls(xCheckReservedLock) \ + xAccess $::tvfs_calls(xAccess) +} {xLock 0 xUnlock 0 xCheckReservedLock 0 xAccess 0} + db2 close db close tvfs delete From eacc050f3059b197533fc2d4903cb1fb8108ec7d Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 7 May 2014 17:19:31 +0000 Subject: [PATCH 22/27] Make sure the group_concat() function returns an empty string, not a NULL, if it has at least one input row. Fix for ticket [55746f9e65f8587]. FossilOrigin-Name: 0deac8737545a020d344be96fff16660a7977ab8 --- manifest | 15 +++++++-------- manifest.uuid | 2 +- src/func.c | 2 +- test/func.test | 12 ++++++++++++ 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 28652fe3ac..9818296e6d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\sSQLITE_IOCAP_IMMUTABLE\sbit\sas\sa\spossible\sreturn\svalue\sfrom\nthe\sxDeviceCharacteristics\smethod\sin\sthe\sVFS.\s\sAdd\sthe\s"nolock"\sand\n"immutable"\squery\sparameters\sto\sURI\sfilenames. -D 2014-05-07T15:46:04.082 +C Make\ssure\sthe\sgroup_concat()\sfunction\sreturns\san\sempty\sstring,\snot\sa\sNULL,\nif\sit\shas\sat\sleast\sone\sinput\srow.\s\sFix\sfor\sticket\s[55746f9e65f8587]. +D 2014-05-07T17:19:31.457 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -177,7 +177,7 @@ F src/delete.c bcf8f72126cea80fc3d5bc5494cf19b3f8935aaf F src/expr.c 4f9e497c66e2f25a4d139357a778c84d5713207c F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c 5269ef07b100763134f71b889327c333bd0989cf -F src/func.c 2945bb2c4cdc0ac43733046285a4434310be1811 +F src/func.c 1db49570e01b31fd3cd00ff2c13da8f2f05e9051 F src/global.c 1d7bb7ea8254ae6a68ed9bfaf65fcb3d1690b486 F src/hash.c d139319967164f139c8d1bb8a11b14db9c4ba3cd F src/hash.h 8890a25af81fb85a9ad7790d32eedab4b994da22 @@ -578,7 +578,7 @@ F test/fts4merge4.test c19c85ca1faa7b6d536832b49c12e1867235f584 F test/fts4noti.test aed33ba44808852dcb24bf70fa132e7bf530f057 F test/fts4unicode.test 01ec3fe2a7c3cfff3b4c0581b83caa11b33efa36 F test/full.test 6b3c8fb43c6beab6b95438c1675374b95fab245d -F test/func.test c2cbfc23d554c5bf8678d0fb271aa4f8ef94839c +F test/func.test ae97561957aba6ca9e3a7b8a13aac41830d701ef F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f F test/func3.test dbccee9133cfef1473c59ec07b5f0262b9d72f9a F test/func4.test 6beacdfcb0e18c358e6c2dcacf1b65d1fa80955f @@ -1169,8 +1169,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix a94fb9b1b1ef06efc2898975cdfcfa9643731f5e -P 99d96765cc378fde7b285f4577ea2b5d130d9a61 e193aced2942e7405d0f45f90d4954b5663b4ba5 -R 397fc32d1bd36ead839d4c78d231487f -T +closed e193aced2942e7405d0f45f90d4954b5663b4ba5 +P 1a0d7d3d9dd54b783e3a805961287dd01f94770c +R 34db7d5fd6dab33bdc52f4f3fa07974a U drh -Z 57c6364c482e6b92f356dd08394fdb62 +Z eb431a80b9a77174dcfd85ab3e28a5a4 diff --git a/manifest.uuid b/manifest.uuid index 9da16245c0..d19d28ec95 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1a0d7d3d9dd54b783e3a805961287dd01f94770c \ No newline at end of file +0deac8737545a020d344be96fff16660a7977ab8 \ No newline at end of file diff --git a/src/func.c b/src/func.c index 6be963580c..50f76c33de 100644 --- a/src/func.c +++ b/src/func.c @@ -1541,7 +1541,7 @@ static void groupConcatStep( } zVal = (char*)sqlite3_value_text(argv[0]); nVal = sqlite3_value_bytes(argv[0]); - if( nVal ) sqlite3StrAccumAppend(pAccum, zVal, nVal); + if( nVal || firstTerm ) sqlite3StrAccumAppend(pAccum, zVal, nVal); } } static void groupConcatFinalize(sqlite3_context *context){ diff --git a/test/func.test b/test/func.test index e3cec32153..98ae8ddeb5 100644 --- a/test/func.test +++ b/test/func.test @@ -1194,6 +1194,18 @@ do_test func-24.12 { WHEN 'program' THEN null ELSE t1 END) FROM tbl1 } } {,is,free,software} +# Tests to verify ticket http://www.sqlite.org/src/tktview/55746f9e65f8587c0 +do_test func-24.13 { + execsql { + SELECT typeof(group_concat(x)) FROM (SELECT '' AS x); + } +} {text} +do_test func-24.14 { + execsql { + SELECT typeof(group_concat(x,'')) + FROM (SELECT '' AS x UNION ALL SELECT ''); + } +} {text} # Use the test_isolation function to make sure that type conversions From 86a1119133963032a2c388a7ce5a300a904f5d00 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 7 May 2014 18:21:56 +0000 Subject: [PATCH 23/27] Ensure that the sqlite3StrAccumAppend() routine is never called with a NULL second argument. Doing so is harmless when N==0, but it causes an assert() to fail that was placed to quiet static analyzers. FossilOrigin-Name: f03fbf3700d9d4a654e3aa2e5caa810a8416bed9 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/func.c | 4 +++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 9818296e6d..c8a928d230 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\ssure\sthe\sgroup_concat()\sfunction\sreturns\san\sempty\sstring,\snot\sa\sNULL,\nif\sit\shas\sat\sleast\sone\sinput\srow.\s\sFix\sfor\sticket\s[55746f9e65f8587]. -D 2014-05-07T17:19:31.457 +C Ensure\sthat\sthe\ssqlite3StrAccumAppend()\sroutine\sis\snever\scalled\swith\sa\sNULL\nsecond\sargument.\s\sDoing\sso\sis\sharmless\swhen\sN==0,\sbut\sit\scauses\san\sassert()\nto\sfail\sthat\swas\splaced\sto\squiet\sstatic\sanalyzers. +D 2014-05-07T18:21:56.753 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -177,7 +177,7 @@ F src/delete.c bcf8f72126cea80fc3d5bc5494cf19b3f8935aaf F src/expr.c 4f9e497c66e2f25a4d139357a778c84d5713207c F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c 5269ef07b100763134f71b889327c333bd0989cf -F src/func.c 1db49570e01b31fd3cd00ff2c13da8f2f05e9051 +F src/func.c 2077ccd5c77952fb654997eb81bc7be57c955ba2 F src/global.c 1d7bb7ea8254ae6a68ed9bfaf65fcb3d1690b486 F src/hash.c d139319967164f139c8d1bb8a11b14db9c4ba3cd F src/hash.h 8890a25af81fb85a9ad7790d32eedab4b994da22 @@ -1169,7 +1169,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix a94fb9b1b1ef06efc2898975cdfcfa9643731f5e -P 1a0d7d3d9dd54b783e3a805961287dd01f94770c -R 34db7d5fd6dab33bdc52f4f3fa07974a +P 0deac8737545a020d344be96fff16660a7977ab8 +R aaf6cc2f3f5ec9bee45f0a384deaafae U drh -Z eb431a80b9a77174dcfd85ab3e28a5a4 +Z daf5890128d88bd8d8d454e0919fc158 diff --git a/manifest.uuid b/manifest.uuid index d19d28ec95..a75992b9d9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0deac8737545a020d344be96fff16660a7977ab8 \ No newline at end of file +f03fbf3700d9d4a654e3aa2e5caa810a8416bed9 \ No newline at end of file diff --git a/src/func.c b/src/func.c index 50f76c33de..91c20ff41e 100644 --- a/src/func.c +++ b/src/func.c @@ -1541,7 +1541,9 @@ static void groupConcatStep( } zVal = (char*)sqlite3_value_text(argv[0]); nVal = sqlite3_value_bytes(argv[0]); - if( nVal || firstTerm ) sqlite3StrAccumAppend(pAccum, zVal, nVal); + if( nVal || (zVal="", firstTerm) ){ + sqlite3StrAccumAppend(pAccum, zVal, nVal); + } } } static void groupConcatFinalize(sqlite3_context *context){ From d2d8ca600e5bb14050799f9246d29335dc87a476 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 7 May 2014 19:59:36 +0000 Subject: [PATCH 24/27] Fix the way parenthesis in MATCH expressions are handled by FTS if the tokenizer considers them to be token characters. FossilOrigin-Name: e21bf7a2ade6373e94ea403c665f78e1ad22143f --- ext/fts3/fts3_expr.c | 205 ++++++++++++++++++++++--------------------- manifest | 20 ++--- manifest.uuid | 2 +- test/fts3defer2.test | 1 + test/fts3expr.test | 5 ++ test/fts3expr4.test | 57 ++++++++++++ 6 files changed, 178 insertions(+), 112 deletions(-) create mode 100644 test/fts3expr4.test diff --git a/ext/fts3/fts3_expr.c b/ext/fts3/fts3_expr.c index 9c71f26ba1..95a9b1aada 100644 --- a/ext/fts3/fts3_expr.c +++ b/ext/fts3/fts3_expr.c @@ -185,40 +185,23 @@ static int getNextToken( int rc; sqlite3_tokenizer_cursor *pCursor; Fts3Expr *pRet = 0; - int nConsumed = 0; + int i = 0; - rc = sqlite3Fts3OpenTokenizer(pTokenizer, pParse->iLangid, z, n, &pCursor); + /* Set variable i to the maximum number of bytes of input to tokenize. */ + for(i=0; iiLangid, z, i, &pCursor); if( rc==SQLITE_OK ){ const char *zToken; int nToken = 0, iStart = 0, iEnd = 0, iPosition = 0; int nByte; /* total space to allocate */ rc = pModule->xNext(pCursor, &zToken, &nToken, &iStart, &iEnd, &iPosition); - - if( (rc==SQLITE_OK || rc==SQLITE_DONE) && sqlite3_fts3_enable_parentheses ){ - int i; - if( rc==SQLITE_DONE ) iStart = n; - for(i=0; inNest++; - rc = fts3ExprParse(pParse, &z[i+1], n-i-1, &pRet, &nConsumed); - if( rc==SQLITE_OK && !pRet ){ - rc = SQLITE_DONE; - } - nConsumed = (int)(i + 1 + nConsumed); - break; - } - - if( z[i]==')' ){ - rc = SQLITE_DONE; - pParse->nNest--; - nConsumed = i+1; - break; - } - } - } - - if( nConsumed==0 && rc==SQLITE_OK ){ + if( rc==SQLITE_OK ){ nByte = sizeof(Fts3Expr) + sizeof(Fts3Phrase) + nToken; pRet = (Fts3Expr *)fts3MallocZero(nByte); if( !pRet ){ @@ -252,13 +235,14 @@ static int getNextToken( } } - nConsumed = iEnd; + *pnConsumed = iEnd; + }else if( i && rc==SQLITE_DONE ){ + rc = SQLITE_OK; } pModule->xClose(pCursor); } - *pnConsumed = nConsumed; *ppExpr = pRet; return rc; } @@ -508,6 +492,21 @@ static int getNextNode( return getNextString(pParse, &zInput[1], ii-1, ppExpr); } + if( sqlite3_fts3_enable_parentheses ){ + if( *zInput=='(' ){ + int nConsumed = 0; + pParse->nNest++; + rc = fts3ExprParse(pParse, zInput+1, nInput-1, ppExpr, &nConsumed); + if( rc==SQLITE_OK && !*ppExpr ){ rc = SQLITE_DONE; } + *pnConsumed = (int)(zInput - z) + 1 + nConsumed; + return rc; + }else if( *zInput==')' ){ + pParse->nNest--; + *pnConsumed = (zInput - z) + 1; + *ppExpr = 0; + return SQLITE_DONE; + } + } /* If control flows to this point, this must be a regular token, or ** the end of the input. Read a regular token using the sqlite3_tokenizer @@ -626,96 +625,100 @@ static int fts3ExprParse( while( rc==SQLITE_OK ){ Fts3Expr *p = 0; int nByte = 0; + rc = getNextNode(pParse, zIn, nIn, &p, &nByte); + assert( nByte>0 || (rc!=SQLITE_OK && p==0) ); if( rc==SQLITE_OK ){ - int isPhrase; + if( p ){ + int isPhrase; - if( !sqlite3_fts3_enable_parentheses - && p->eType==FTSQUERY_PHRASE && pParse->isNot - ){ - /* Create an implicit NOT operator. */ - Fts3Expr *pNot = fts3MallocZero(sizeof(Fts3Expr)); - if( !pNot ){ - sqlite3Fts3ExprFree(p); - rc = SQLITE_NOMEM; - goto exprparse_out; - } - pNot->eType = FTSQUERY_NOT; - pNot->pRight = p; - p->pParent = pNot; - if( pNotBranch ){ - pNot->pLeft = pNotBranch; - pNotBranch->pParent = pNot; - } - pNotBranch = pNot; - p = pPrev; - }else{ - int eType = p->eType; - isPhrase = (eType==FTSQUERY_PHRASE || p->pLeft); - - /* The isRequirePhrase variable is set to true if a phrase or - ** an expression contained in parenthesis is required. If a - ** binary operator (AND, OR, NOT or NEAR) is encounted when - ** isRequirePhrase is set, this is a syntax error. - */ - if( !isPhrase && isRequirePhrase ){ - sqlite3Fts3ExprFree(p); - rc = SQLITE_ERROR; - goto exprparse_out; - } - - if( isPhrase && !isRequirePhrase ){ - /* Insert an implicit AND operator. */ - Fts3Expr *pAnd; - assert( pRet && pPrev ); - pAnd = fts3MallocZero(sizeof(Fts3Expr)); - if( !pAnd ){ + if( !sqlite3_fts3_enable_parentheses + && p->eType==FTSQUERY_PHRASE && pParse->isNot + ){ + /* Create an implicit NOT operator. */ + Fts3Expr *pNot = fts3MallocZero(sizeof(Fts3Expr)); + if( !pNot ){ sqlite3Fts3ExprFree(p); rc = SQLITE_NOMEM; goto exprparse_out; } - pAnd->eType = FTSQUERY_AND; - insertBinaryOperator(&pRet, pPrev, pAnd); - pPrev = pAnd; - } + pNot->eType = FTSQUERY_NOT; + pNot->pRight = p; + p->pParent = pNot; + if( pNotBranch ){ + pNot->pLeft = pNotBranch; + pNotBranch->pParent = pNot; + } + pNotBranch = pNot; + p = pPrev; + }else{ + int eType = p->eType; + isPhrase = (eType==FTSQUERY_PHRASE || p->pLeft); - /* This test catches attempts to make either operand of a NEAR - ** operator something other than a phrase. For example, either of - ** the following: - ** - ** (bracketed expression) NEAR phrase - ** phrase NEAR (bracketed expression) - ** - ** Return an error in either case. - */ - if( pPrev && ( + /* The isRequirePhrase variable is set to true if a phrase or + ** an expression contained in parenthesis is required. If a + ** binary operator (AND, OR, NOT or NEAR) is encounted when + ** isRequirePhrase is set, this is a syntax error. + */ + if( !isPhrase && isRequirePhrase ){ + sqlite3Fts3ExprFree(p); + rc = SQLITE_ERROR; + goto exprparse_out; + } + + if( isPhrase && !isRequirePhrase ){ + /* Insert an implicit AND operator. */ + Fts3Expr *pAnd; + assert( pRet && pPrev ); + pAnd = fts3MallocZero(sizeof(Fts3Expr)); + if( !pAnd ){ + sqlite3Fts3ExprFree(p); + rc = SQLITE_NOMEM; + goto exprparse_out; + } + pAnd->eType = FTSQUERY_AND; + insertBinaryOperator(&pRet, pPrev, pAnd); + pPrev = pAnd; + } + + /* This test catches attempts to make either operand of a NEAR + ** operator something other than a phrase. For example, either of + ** the following: + ** + ** (bracketed expression) NEAR phrase + ** phrase NEAR (bracketed expression) + ** + ** Return an error in either case. + */ + if( pPrev && ( (eType==FTSQUERY_NEAR && !isPhrase && pPrev->eType!=FTSQUERY_PHRASE) || (eType!=FTSQUERY_PHRASE && isPhrase && pPrev->eType==FTSQUERY_NEAR) - )){ - sqlite3Fts3ExprFree(p); - rc = SQLITE_ERROR; - goto exprparse_out; - } - - if( isPhrase ){ - if( pRet ){ - assert( pPrev && pPrev->pLeft && pPrev->pRight==0 ); - pPrev->pRight = p; - p->pParent = pPrev; - }else{ - pRet = p; + )){ + sqlite3Fts3ExprFree(p); + rc = SQLITE_ERROR; + goto exprparse_out; } - }else{ - insertBinaryOperator(&pRet, pPrev, p); + + if( isPhrase ){ + if( pRet ){ + assert( pPrev && pPrev->pLeft && pPrev->pRight==0 ); + pPrev->pRight = p; + p->pParent = pPrev; + }else{ + pRet = p; + } + }else{ + insertBinaryOperator(&pRet, pPrev, p); + } + isRequirePhrase = !isPhrase; } - isRequirePhrase = !isPhrase; + pPrev = p; } assert( nByte>0 ); } assert( rc!=SQLITE_OK || (nByte>0 && nByte<=nIn) ); nIn -= nByte; zIn += nByte; - pPrev = p; } if( rc==SQLITE_DONE && pRet && isRequirePhrase ){ diff --git a/manifest b/manifest index 77f24441e5..98fa92f28f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\ssure\sthe\sgroup_concat()\sfunction\sreturns\san\sempty\sstring,\snot\sa\sNULL,\s\nif\sit\shas\sat\sleast\sone\sinput\srow.\sFix\sfor\sticket\s[55746f9e65f8587]. -D 2014-05-07T18:23:04.692 +C Fix\sthe\sway\sparenthesis\sin\sMATCH\sexpressions\sare\shandled\sby\sFTS\sif\sthe\stokenizer\sconsiders\sthem\sto\sbe\stoken\scharacters. +D 2014-05-07T19:59:36.446 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -82,7 +82,7 @@ F ext/fts3/fts3.c 41b1920b9a8657963f09cb93b208c2671c5568db F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe F ext/fts3/fts3Int.h bdeb9015405e8facffb8fc7e09174521a2a780f4 F ext/fts3/fts3_aux.c 5c211e17a64885faeb16b9ba7772f9d5445c2365 -F ext/fts3/fts3_expr.c 5165c365cb5a035f5be8bb296f7aa3211d43e4ac +F ext/fts3/fts3_expr.c 2ac35bda474f00c14c19608e49a02c8c7ceb9970 F ext/fts3/fts3_hash.c 29b986e43f4e9dd40110eafa377dc0d63c422c60 F ext/fts3/fts3_hash.h 39cf6874dc239d6b4e30479b1975fe5b22a3caaf F ext/fts3/fts3_icu.c e319e108661147bcca8dd511cd562f33a1ba81b5 @@ -541,13 +541,14 @@ F test/fts3corrupt2.test 6d96efae2f8a6af3eeaf283aba437e6d0e5447ba F test/fts3cov.test e0fb00d8b715ddae4a94c305992dfc3ef70353d7 F test/fts3d.test 597b0b76e41f0d672e2731c4d7b631d628efd13f F test/fts3defer.test 0be4440b73a2e651fc1e472066686d6ada4b9963 -F test/fts3defer2.test a3b6cbeabaf28c9398652a4d101ea224d9358479 +F test/fts3defer2.test e880e3b65bdf999f4746cdaefa65f14a98b9b724 F test/fts3defer3.test dd53fc13223c6d8264a98244e9b19abd35ed71cd F test/fts3drop.test 1b906e293d6773812587b3dc458cb9e8f3f0c297 F test/fts3e.test 1f6c6ac9cc8b772ca256e6b22aaeed50c9350851 -F test/fts3expr.test 06f1a96facc8f3e4b1ad5cc001dc5c8e83e68b9f +F test/fts3expr.test 3401d47b229c4504424caf362cc4ff704cad4162 F test/fts3expr2.test 18da930352e5693eaa163a3eacf96233b7290d1a F test/fts3expr3.test 9e91b8edbcb197bf2e92161aa7696446d96dce5f +F test/fts3expr4.test 0713d94ab951ed88a8c3629a4889a48c55c4067c F test/fts3fault.test cb72dccb0a3b9f730f16c5240f3fcb9303eb1660 F test/fts3fault2.test 3198eef2804deea7cac8403e771d9cbcb752d887 F test/fts3first.test dbdedd20914c8d539aa3206c9b34a23775644641 @@ -1169,8 +1170,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix a94fb9b1b1ef06efc2898975cdfcfa9643731f5e -P 1a0d7d3d9dd54b783e3a805961287dd01f94770c f03fbf3700d9d4a654e3aa2e5caa810a8416bed9 -R aaf6cc2f3f5ec9bee45f0a384deaafae -T +closed f03fbf3700d9d4a654e3aa2e5caa810a8416bed9 -U drh -Z fad451fce86c7077ae7b04e526f1422c +P d01cedaa73d8f9e5502502a1068a9509d1de295c +R 28138eb84e0bfcefa0d0799bd622d421 +U dan +Z 3413f41d3a51a750e0d3b3c404322221 diff --git a/manifest.uuid b/manifest.uuid index ff91e39b9f..d0d7c962bf 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d01cedaa73d8f9e5502502a1068a9509d1de295c \ No newline at end of file +e21bf7a2ade6373e94ea403c665f78e1ad22143f \ No newline at end of file diff --git a/test/fts3defer2.test b/test/fts3defer2.test index 608371f15d..87af52461b 100644 --- a/test/fts3defer2.test +++ b/test/fts3defer2.test @@ -59,6 +59,7 @@ do_execsql_test 1.2.1 { SELECT content FROM t1 WHERE t1 MATCH 'f (e NEAR/2 a)'; } {{a b c d e f a x y}} + do_execsql_test 1.2.2 { SELECT snippet(t1, '[', ']'), offsets(t1), mit(matchinfo(t1, 'pcxnal')) FROM t1 WHERE t1 MATCH 'f (e NEAR/2 a)'; diff --git a/test/fts3expr.test b/test/fts3expr.test index 192219f142..6e23faf633 100644 --- a/test/fts3expr.test +++ b/test/fts3expr.test @@ -509,4 +509,9 @@ do_test fts3expr-8.7 { test_fts3expr "((((blah!))))" } {PHRASE 3 0 blah} do_test fts3expr-8.8 { test_fts3expr "(,(blah-),)" } {PHRASE 3 0 blah} set sqlite_fts3_enable_parentheses 0 + +do_test fts3expr-9.1 { + test_fts3expr "f (e NEAR/2 a)" +} {AND {PHRASE 3 0 f} {NEAR/2 {PHRASE 3 0 e} {PHRASE 3 0 a}}} + finish_test diff --git a/test/fts3expr4.test b/test/fts3expr4.test new file mode 100644 index 0000000000..94737971b4 --- /dev/null +++ b/test/fts3expr4.test @@ -0,0 +1,57 @@ +# 2014 May 7 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#************************************************************************* +# This file implements regression tests for SQLite library. The +# focus of this script is testing the FTS3 module. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +set testprefix fts3expr4 + +# If SQLITE_ENABLE_FTS3 is defined, omit this file. +ifcapable !fts3||!icu { + finish_test + return +} + +set sqlite_fts3_enable_parentheses 1 + +proc test_icu_fts3expr {expr} { + db one {SELECT fts3_exprtest('icu', $expr, 'a', 'b', 'c')} +} + +proc do_icu_expr_test {tn expr res} { + uplevel [list do_test $tn [list test_icu_fts3expr $expr] $res] +} + +#------------------------------------------------------------------------- +# +do_icu_expr_test 1.1 "abcd" {PHRASE 3 0 abcd} +do_icu_expr_test 1.2 " tag " {PHRASE 3 0 tag} +do_icu_expr_test 1.3 {"x y z"} {PHRASE 3 0 x y z} +do_icu_expr_test 1.4 {x OR y} {OR {PHRASE 3 0 x} {PHRASE 3 0 y}} +do_icu_expr_test 1.5 {(x OR y)} {OR {PHRASE 3 0 x} {PHRASE 3 0 y}} +do_icu_expr_test 1.6 { "(x OR y)" } {PHRASE 3 0 ( x or y )} + +# In "col:word", if "col" is not the name of a column, the entire thing +# is passed to the tokenizer. +# +do_icu_expr_test 1.7 {a:word} {PHRASE 0 0 word} +do_icu_expr_test 1.8 {d:word} {PHRASE 3 0 d:word} + +set sqlite_fts3_enable_parentheses 0 + +do_icu_expr_test 2.1 { + f (e NEAR/2 a) +} {AND {AND {AND {PHRASE 3 0 f} {PHRASE 3 0 (}} {NEAR/2 {PHRASE 3 0 e} {PHRASE 3 0 a}}} {PHRASE 3 0 )}} + +finish_test + From 8009c9b4391db9f64523362cc0ae5a0a4f17e1fb Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 7 May 2014 20:24:00 +0000 Subject: [PATCH 25/27] A better fix for the group_concat() problem. FossilOrigin-Name: 1c086deebd0eb442918972e4b9185a5a0db3b8c3 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/func.c | 4 +--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 98fa92f28f..2487a4cca5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\sway\sparenthesis\sin\sMATCH\sexpressions\sare\shandled\sby\sFTS\sif\sthe\stokenizer\sconsiders\sthem\sto\sbe\stoken\scharacters. -D 2014-05-07T19:59:36.446 +C A\sbetter\sfix\sfor\sthe\sgroup_concat()\sproblem. +D 2014-05-07T20:24:00.613 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -177,7 +177,7 @@ F src/delete.c bcf8f72126cea80fc3d5bc5494cf19b3f8935aaf F src/expr.c 4f9e497c66e2f25a4d139357a778c84d5713207c F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c 5269ef07b100763134f71b889327c333bd0989cf -F src/func.c 2077ccd5c77952fb654997eb81bc7be57c955ba2 +F src/func.c 2e16316ec3a6365a0dc3e553c586f91b20f7f6c8 F src/global.c 1d7bb7ea8254ae6a68ed9bfaf65fcb3d1690b486 F src/hash.c d139319967164f139c8d1bb8a11b14db9c4ba3cd F src/hash.h 8890a25af81fb85a9ad7790d32eedab4b994da22 @@ -1170,7 +1170,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix a94fb9b1b1ef06efc2898975cdfcfa9643731f5e -P d01cedaa73d8f9e5502502a1068a9509d1de295c -R 28138eb84e0bfcefa0d0799bd622d421 -U dan -Z 3413f41d3a51a750e0d3b3c404322221 +P e21bf7a2ade6373e94ea403c665f78e1ad22143f +R afe7614324621c209bd24609b796c72c +U drh +Z 90528f628504d485125985a9d758e5e7 diff --git a/manifest.uuid b/manifest.uuid index d0d7c962bf..db899c0006 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e21bf7a2ade6373e94ea403c665f78e1ad22143f \ No newline at end of file +1c086deebd0eb442918972e4b9185a5a0db3b8c3 \ No newline at end of file diff --git a/src/func.c b/src/func.c index 91c20ff41e..bc5c78981e 100644 --- a/src/func.c +++ b/src/func.c @@ -1541,9 +1541,7 @@ static void groupConcatStep( } zVal = (char*)sqlite3_value_text(argv[0]); nVal = sqlite3_value_bytes(argv[0]); - if( nVal || (zVal="", firstTerm) ){ - sqlite3StrAccumAppend(pAccum, zVal, nVal); - } + if( zVal ) sqlite3StrAccumAppend(pAccum, zVal, nVal); } } static void groupConcatFinalize(sqlite3_context *context){ From 9ee8810be233e2ad62fd6cc0531cfd1f6b99490c Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 7 May 2014 20:33:17 +0000 Subject: [PATCH 26/27] Remove a superfluous variable initialization. FossilOrigin-Name: 68766f837491cb89c2103f2627eb9e23ab326a68 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/where.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 2487a4cca5..8dad091c67 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C A\sbetter\sfix\sfor\sthe\sgroup_concat()\sproblem. -D 2014-05-07T20:24:00.613 +C Remove\sa\ssuperfluous\svariable\sinitialization. +D 2014-05-07T20:33:17.262 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -294,7 +294,7 @@ F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 76e7fc6de229bea8b30bb2539110f03a494dc3a8 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 -F src/where.c 91dfd382273c3f67fcdc0ac4728f9140f91c6ab3 +F src/where.c fd4b525cd5ab652cea2fbc71ac15c975271ca461 F src/whereInt.h 6804c2e5010378568c2bb1350477537755296a46 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -1170,7 +1170,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix a94fb9b1b1ef06efc2898975cdfcfa9643731f5e -P e21bf7a2ade6373e94ea403c665f78e1ad22143f -R afe7614324621c209bd24609b796c72c +P 1c086deebd0eb442918972e4b9185a5a0db3b8c3 +R 995ed9b07fad6d84d47ce217aca5ca74 U drh -Z 90528f628504d485125985a9d758e5e7 +Z 2d839c831dc7cae35991010f3444c69e diff --git a/manifest.uuid b/manifest.uuid index db899c0006..4980e6682b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1c086deebd0eb442918972e4b9185a5a0db3b8c3 \ No newline at end of file +68766f837491cb89c2103f2627eb9e23ab326a68 \ No newline at end of file diff --git a/src/where.c b/src/where.c index c5892590bc..2daa9f1536 100644 --- a/src/where.c +++ b/src/where.c @@ -3761,7 +3761,7 @@ static int whereLoopCheaperProperSubset( if( pX->rRun > pY->rRun ) return 0; /* X costs more than Y */ if( pX->nOut > pY->nOut ) return 0; /* X costs more than Y */ } - for(j=0, i=pX->nLTerm-1; i>=0; i--){ + for(i=pX->nLTerm-1; i>=0; i--){ for(j=pY->nLTerm-1; j>=0; j--){ if( pY->aLTerm[j]==pX->aLTerm[i] ) break; } From 2e7be081526084a73bee5ebe778bc83904b87de3 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 7 May 2014 21:16:56 +0000 Subject: [PATCH 27/27] Include sqlite3rtree.h in the tsrc/ pile of source files during target_source in the main.mk makefile. FossilOrigin-Name: 116bed5af664899a73b46dca528ac0c021fc50c3 --- main.mk | 1 + manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/main.mk b/main.mk index da1c30b2fe..3bdbe810f8 100644 --- a/main.mk +++ b/main.mk @@ -210,6 +210,7 @@ SRC += \ $(TOP)/ext/icu/sqliteicu.h \ $(TOP)/ext/icu/icu.c SRC += \ + $(TOP)/ext/rtree/sqlite3rtree.h \ $(TOP)/ext/rtree/rtree.h \ $(TOP)/ext/rtree/rtree.c diff --git a/manifest b/manifest index 8dad091c67..bec4a2d4fe 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sa\ssuperfluous\svariable\sinitialization. -D 2014-05-07T20:33:17.262 +C Include\ssqlite3rtree.h\sin\sthe\stsrc/\spile\sof\ssource\sfiles\sduring\ntarget_source\sin\sthe\smain.mk\smakefile. +D 2014-05-07T21:16:56.524 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -144,7 +144,7 @@ F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt f439556c5ce01ced70987e5ee86549a45165d9ff -F main.mk 601f43d91e6c7043127ec192bf85c9a1ae940621 +F main.mk cfa185eed4e0f7e9d28a2e3167cecaa9d6cb39f3 F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea F mkopcodeh.awk c6b3fa301db6ef7ac916b14c60868aeaec1337b5 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 @@ -1170,7 +1170,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix a94fb9b1b1ef06efc2898975cdfcfa9643731f5e -P 1c086deebd0eb442918972e4b9185a5a0db3b8c3 -R 995ed9b07fad6d84d47ce217aca5ca74 +P 68766f837491cb89c2103f2627eb9e23ab326a68 +R 1b75d6e5e9a19ccc14f8e59e21c749f6 U drh -Z 2d839c831dc7cae35991010f3444c69e +Z 3528e73d8f87faaf66e6658213b6d573 diff --git a/manifest.uuid b/manifest.uuid index 4980e6682b..150ca37810 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -68766f837491cb89c2103f2627eb9e23ab326a68 \ No newline at end of file +116bed5af664899a73b46dca528ac0c021fc50c3 \ No newline at end of file