From fd6ddf91b0711b6b6cfe0938db56fc9bc2cd8dcf Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 5 Mar 2012 16:24:26 +0000 Subject: [PATCH 01/11] Fix a problem compiling the test code in fts3_test.c when SQLITE_ENABLE_FTS3 is not defined. FossilOrigin-Name: b00ccda307caae597c143ab0586f90acb77f79cf --- ext/fts3/fts3_test.c | 4 ++++ manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ext/fts3/fts3_test.c b/ext/fts3/fts3_test.c index 7cbc9eae9f..01873d4978 100644 --- a/ext/fts3/fts3_test.c +++ b/ext/fts3/fts3_test.c @@ -317,6 +317,7 @@ static int fts3_configure_incr_load_cmd( return TCL_OK; } +#ifdef SQLITE_ENABLE_FTS3 /************************************************************************** ** Beginning of test tokenizer code. ** @@ -479,6 +480,7 @@ static int testTokenizerLanguage( } return rc; } +#endif static int fts3_test_tokenizer_cmd( ClientData clientData, @@ -486,6 +488,7 @@ static int fts3_test_tokenizer_cmd( int objc, Tcl_Obj *CONST objv[] ){ +#ifdef SQLITE_ENABLE_FTS3 static const sqlite3_tokenizer_module testTokenizerModule = { 1, testTokenizerCreate, @@ -503,6 +506,7 @@ static int fts3_test_tokenizer_cmd( Tcl_SetObjResult(interp, Tcl_NewByteArrayObj( (const unsigned char *)&pPtr, sizeof(sqlite3_tokenizer_module *) )); +#endif return TCL_OK; } diff --git a/manifest b/manifest index 258b28d302..804df3f20b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\sthe\sfts4-languageid\sbranch\swith\sthe\strunk. -D 2012-03-05T15:33:32.751 +C Fix\sa\sproblem\scompiling\sthe\stest\scode\sin\sfts3_test.c\swhen\sSQLITE_ENABLE_FTS3\sis\snot\sdefined. +D 2012-03-05T16:24:26.279 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 3f79a373e57c3b92dabf76f40b065e719d31ac34 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -74,7 +74,7 @@ F ext/fts3/fts3_icu.c 6c8f395cdf9e1e3afa7fadb7e523dbbf381c6dfa F ext/fts3/fts3_porter.c b7e5276f9f0a5fc7018b6fa55ce0f31f269ef881 F ext/fts3/fts3_snippet.c c9e126c20760988aa7c43c6ea1379db34738282e F ext/fts3/fts3_term.c d3466cf99432291be08e379d89645462431809d6 -F ext/fts3/fts3_test.c a026412a41450a014ccb7abdd5efaa7c9711d49e +F ext/fts3/fts3_test.c 6b7cc68aef4efb084e1449f7d20c4b20d3bdf6b4 F ext/fts3/fts3_tokenizer.c 3da7254a9881f7e270ab28e2004e0d22b3212bce F ext/fts3/fts3_tokenizer.h 66dec98e365854b6cd2d54f1a96bb6d428fc5a68 F ext/fts3/fts3_tokenizer1.c 0dde8f307b8045565cf63797ba9acfaff1c50c68 @@ -992,7 +992,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 -P 4f34d7077b9acf7926c5e7375ca870d4ed3c60b9 f8e9c445dd358c40e5a7bf3756b9f291909dbea7 -R 6e003d0f8aa6b8eacd50254a31c50e6a +P 99a9073b5e411ce94f38ce49608baaa15de8b850 +R d0dc4635c0ac977f7342c0a0dac9e48b U dan -Z c6f6d9c6291c4c182b564ddd4b9e0a68 +Z d6573fd4e75425ab6ee13bee3b518e09 diff --git a/manifest.uuid b/manifest.uuid index 0025deab29..dda6c5d414 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -99a9073b5e411ce94f38ce49608baaa15de8b850 \ No newline at end of file +b00ccda307caae597c143ab0586f90acb77f79cf \ No newline at end of file From f8a784645cd27c4cbbf87fc5e3001ee74867b298 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 8 Mar 2012 20:00:36 +0000 Subject: [PATCH 02/11] On Windows, make sure the current directory value used by the test suite is 'normalized' to what the parent command shell sees. Also, clean the test directories used by the quota2.test file. FossilOrigin-Name: 82bcd7ec1531f6d71c079578434c58d3ce46a1de --- Makefile.in | 1 + Makefile.msc | 3 +++ Makefile.vxworks | 1 + main.mk | 1 + manifest | 52 ++++++++++++++++++++-------------------- manifest.uuid | 2 +- src/test6.c | 8 +++++++ test/bigfile.test | 6 ++--- test/bigfile2.test | 2 +- test/crash5.test | 4 ++-- test/e_uri.test | 16 ++++++------- test/filectrl.test | 2 +- test/misc7.test | 2 +- test/pager1.test | 6 ++--- test/pragma.test | 4 ++-- test/quota.test | 2 +- test/quota2.test | 2 +- test/tester.tcl | 15 +++++++++++- test/tkt-94c04eaadb.test | 2 +- test/uri.test | 8 +++---- test/wal.test | 2 +- test/walbig.test | 2 +- 22 files changed, 85 insertions(+), 58 deletions(-) diff --git a/Makefile.in b/Makefile.in index 5593b4c6ff..3d7c74ba37 100644 --- a/Makefile.in +++ b/Makefile.in @@ -934,6 +934,7 @@ clean: rm -f mkkeywordhash$(BEXE) keywordhash.h rm -f $(PUBLISH) rm -f *.da *.bb *.bbg gmon.out + rm -rf quota2a quota2b quota2c rm -rf tsrc .target_source rm -f tclsqlite3$(TEXE) rm -f testfixture$(TEXE) test.db diff --git a/Makefile.msc b/Makefile.msc index e95b443fe1..2d8f44c733 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -985,6 +985,9 @@ clean: del /Q mkkeywordhash.exe keywordhash.h -rmdir /Q/S .deps -rmdir /Q/S .libs + -rmdir /Q/S quota2a + -rmdir /Q/S quota2b + -rmdir /Q/S quota2c -rmdir /Q/S tsrc del /Q .target_source del /Q tclsqlite3.exe diff --git a/Makefile.vxworks b/Makefile.vxworks index 8d57da7283..4398c18265 100644 --- a/Makefile.vxworks +++ b/Makefile.vxworks @@ -657,6 +657,7 @@ clean: rm -f lemon lempar.c parse.* sqlite*.tar.gz mkkeywordhash keywordhash.h rm -f $(PUBLISH) rm -f *.da *.bb *.bbg gmon.out + rm -rf quota2a quota2b quota2c rm -rf tsrc target_source rm -f testloadext.dll libtestloadext.so rm -f sqlite3.c fts?amal.c tclsqlite3.c diff --git a/main.mk b/main.mk index 4360d8626d..e28282c32d 100644 --- a/main.mk +++ b/main.mk @@ -601,6 +601,7 @@ clean: rm -f mkkeywordhash mkkeywordhash.exe keywordhash.h rm -f $(PUBLISH) rm -f *.da *.bb *.bbg gmon.out + rm -rf quota2a quota2b quota2c rm -rf tsrc target_source rm -f testloadext.dll libtestloadext.so rm -f amalgamation-testfixture amalgamation-testfixture.exe diff --git a/manifest b/manifest index 804df3f20b..0722c0bf60 100644 --- a/manifest +++ b/manifest @@ -1,10 +1,10 @@ -C Fix\sa\sproblem\scompiling\sthe\stest\scode\sin\sfts3_test.c\swhen\sSQLITE_ENABLE_FTS3\sis\snot\sdefined. -D 2012-03-05T16:24:26.279 +C On\sWindows,\smake\ssure\sthe\scurrent\sdirectory\svalue\sused\sby\sthe\stest\ssuite\sis\s'normalized'\sto\swhat\sthe\sparent\scommand\sshell\ssees.\s\sAlso,\sclean\sthe\stest\sdirectories\sused\sby\sthe\squota2.test\sfile. +D 2012-03-08T20:00:36.181 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in 3f79a373e57c3b92dabf76f40b065e719d31ac34 +F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc 3a5582a858b8071af43cd459bd757f7d0748f66a -F Makefile.vxworks 1deb39c8bb047296c30161ffa10c1b5423e632f9 +F Makefile.msc 7849a871b6cdb20fd51baee6bbe5965a03326be4 +F Makefile.vxworks 3b7fe7a0571fdadc61363ebc1b23732d2d6363ca F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6 F VERSION bb4c2a86abe53ea3c1d6ea515b69a426040e2414 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 @@ -105,7 +105,7 @@ F ext/rtree/tkt3363.test 142ab96eded44a3615ec79fba98c7bde7d0f96de F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 -F main.mk ac48970ca7506c9034f5c7b2212111fbeb0a1aaa +F main.mk a80771d44176a0c744d9d4e048497e7ed0b4040d F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f F mkextw.sh 4123480947681d9b434a5e7b1ee08135abe409ac @@ -194,7 +194,7 @@ F src/test2.c 711555927f1f7e8db9aab86b512bc6934a774abe F src/test3.c 91d3f1a09cfae3533ef17d8b484a160f3d1f1a21 F src/test4.c d1e5a5e904d4b444cf572391fdcb017638e36ff7 F src/test5.c a6d1ac55ac054d0b2b8f37b5e655b6c92645a013 -F src/test6.c cf6ab27a59e1ab64b011bb251ba600131e803e59 +F src/test6.c 846ed1ed2f470de9b1e205fe3878a12e237b3e19 F src/test7.c 2e0781754905c8adc3268d8f0967e7633af58843 F src/test8.c 99f70341d6ec480313775127f4cd14b4a47db557 F src/test9.c bea1e8cf52aa93695487badedd6e1886c321ea60 @@ -296,8 +296,8 @@ F test/backup_malloc.test 7162d604ec2b4683c4b3799a48657fb8b5e2d450 F test/badutf.test d5360fc31f643d37a973ab0d8b4fb85799c3169f F test/badutf2.test f5bc7f2d280670ecd79b9cf4f0f1760c607fe51f F test/between.test 16b1776c6323faadb097a52d673e8e3d8be7d070 -F test/bigfile.test a8ec8073a20207456dab01a29ad9cde42b0dd103 -F test/bigfile2.test f8e83eca9abef60692a34255a2ebcb96aff897fc +F test/bigfile.test 82dfe93ee7eb9e2e05641afa2b39ffd947a92ff1 +F test/bigfile2.test 852f948cb492aadab45b58f4d2f3b0832a115cb0 F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747 F test/bind.test 3c7b320969000c441a70952b0b15938fbb66237c F test/bindxfer.test efecd12c580c14df5f4ad3b3e83c667744a4f7e0 @@ -355,7 +355,7 @@ F test/crash.test 519dc29f6fea151f015a23236e555239353946eb F test/crash2.test 5b14d4eb58b880e231361d3b609b216acda86651 F test/crash3.test 8f5de9d32ab9ab95475a9efe7f47a940aa889418 F test/crash4.test fe2821baf37168dc59dd733dcf7dba2a401487bc -F test/crash5.test 69226a1b948d8961395b7ad2a1df084c212ce8cf +F test/crash5.test 13b9ca94e048194bca070e26160ce76b406c56be F test/crash6.test 4c56f1e40d0291e1110790a99807aa875b1647ba F test/crash7.test 6c6a369af266af2ef50ab34df8f94d719065e2c1 F test/crash8.test 38767cb504bbe491de6be4a7006b154973a2309f @@ -389,7 +389,7 @@ F test/e_resolve.test dcce9308fb13b934ce29591105d031d3e14fbba6 F test/e_select.test f5d4b81205701deacfae42051ae200969c41d2c0 F test/e_select2.test 5c3d3da19c7b3e90ae444579db2b70098599ab92 F test/e_update.test 161d5dc6a3ed9dd08f5264d13e20735d7a89f00c -F test/e_uri.test 6f35b491f80dac005c8144f38b2dfb4d96483596 +F test/e_uri.test e8b894474fdfe7b18b0c9cb2d911270de2ad64ce F test/e_vacuum.test 331da289ae186656cf5f2eb27f577a89c0c221af F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea F test/enc2.test 796c59832e2b9a52842f382ffda8f3e989db03ad @@ -404,7 +404,7 @@ F test/exec.test e949714dc127eaa5ecc7d723efec1ec27118fdd7 F test/exists.test 8f7b27b61c2fbe5822f0a1f899c715d14e416e30 F test/expr.test 67c9fd6f8f829e239dc8b0f4a08a73c08b09196d F test/fallocate.test b5d34437bd7ab01d41b1464b8117aefd4d32160e -F test/filectrl.test 4eb0178956ca25a756e6d79711a90fec7157b454 +F test/filectrl.test f0327bd804d9c7bd048fa7a151c5eab8e27df42b F test/filefmt.test ffa17b5aebc3eb4b1e3be1ccb5ee906ffbd97f6e F test/fkey1.test 01c7de578e11747e720c2d9aeef27f239853c4da F test/fkey2.test 080969fe219b3b082b0e097ac18c6af2e5b0631f @@ -610,7 +610,7 @@ F test/misc3.test fe55130a43e444ee75e2156ff75dc96e964b5738 F test/misc4.test 9c078510fbfff05a9869a0b6d8b86a623ad2c4f6 F test/misc5.test 528468b26d03303b1f047146e5eefc941b9069f5 F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91 -F test/misc7.test 6743b810884ef64ae14c07ad1f9f858c40c06100 +F test/misc7.test 4337d84e441f36cee62656f9f7ba8bc22a7ca721 F test/misuse.test ba4fb5d1a6101d1c171ea38b3c613d0661c83054 F test/multiplex.test e08cc7177bd6d85990ee1d71100bb6c684c02256 F test/multiplex2.test 580ca5817c7edbe4cc68fa150609c9473393003a @@ -625,7 +625,7 @@ F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347 F test/null.test a8b09b8ed87852742343b33441a9240022108993 F test/openv2.test 0d3040974bf402e19b7df4b783e447289d7ab394 F test/oserror.test 50417780d0e0d7cd23cf12a8277bb44024765df3 -F test/pager1.test efef0bb4035d7180ec58308f1d449475e4670b48 +F test/pager1.test 101032cb9d8093806600b343fdcf78ba51c1e3e9 F test/pager2.test 745b911dde3d1f24ae0870bd433dfa83d7c658c1 F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f F test/pagerfault.test 452f2cc23e3bfcfa935f4442aec1da4fe1dc0442 @@ -636,15 +636,15 @@ F test/pagesize.test 1dd51367e752e742f58e861e65ed7390603827a0 F test/pcache.test 065aa286e722ab24f2e51792c1f093bf60656b16 F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025 F test/permutations.test 2b5a1b64a8e5114757457fbce9010387d1fe7682 -F test/pragma.test f11c59ec935a52edb4d3d5676d456588121fcefa +F test/pragma.test c51c148defe32bf4a419a522f95d26838d5cf677 F test/pragma2.test 3a55f82b954242c642f8342b17dffc8b47472947 F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552 F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301 F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc F test/quick.test 1681febc928d686362d50057c642f77a02c62e57 F test/quota-glob.test 32901e9eed6705d68ca3faee2a06b73b57cb3c26 -F test/quota.test af47d25c166aa7b33ef25f21bb7f2afb29d82c77 -F test/quota2.test 1b8df088e604f2df573f96e726b5e518cb0cddaa +F test/quota.test c2f778dab4c7fb07bcfa962cc5c762f36d8061dc +F test/quota2.test 7e1c84f71f59388963fa8181a1292c87ae814d2d F test/quote.test 215897dbe8de1a6f701265836d6601cc6ed103e6 F test/randexpr1.tcl 40dec52119ed3a2b8b2a773bce24b63a3a746459 F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df @@ -719,7 +719,7 @@ F test/tclsqlite.test 1597d353308531527583481d14d9da52ea8ed0af F test/tempdb.test 19d0f66e2e3eeffd68661a11c83ba5e6ace9128c F test/temptable.test 51edd31c65ed1560dd600b1796e8325df96318e2 F test/temptrigger.test 26670ed7a39cf2296a7f0a9e0a1d7bdb7abe936d -F test/tester.tcl 001051eaf28c1040800f588a64c63e0bd0e1f36b +F test/tester.tcl 1fd85b1f508eab104085427c2c4b77c81ad5adb6 F test/thread001.test 7cc2ce08f9cde95964736d11e91f9ab610f82f91 F test/thread002.test e630504f8a06c00bf8bbe68528774dd96aeb2e58 F test/thread003.test ee4c9efc3b86a6a2767516a37bd64251272560a7 @@ -753,7 +753,7 @@ F test/tkt-80ba201079.test 9eb040d81c404f56838a6af93593f42790def63f F test/tkt-80e031a00f.test 9a154173461a4dbe2de49cda73963e04842d52f7 F test/tkt-8454a207b9.test c583a9f814a82a2b5ba95207f55001c9f0cd816c F test/tkt-91e2e8ba6f.test 08c4f94ae07696b05c9b822da0b4e5337a2f54c5 -F test/tkt-94c04eaadb.test be5ea61cb04dfdc047d19b5c5a9e75fa3da67a7f +F test/tkt-94c04eaadb.test fa9c71192f7e2ea2d51bf078bc34e8da6088bf71 F test/tkt-9d68c883.test 458f7d82a523d7644b54b497c986378a7d8c8b67 F test/tkt-b1d3a2e531.test 610ef582413171b379652663111b1f996d9f8f78 F test/tkt-b351d95f9.test d14a503c414c5c58fdde3e80f9a3cfef986498c0 @@ -880,7 +880,7 @@ F test/unique.test 083c7fff74695bcc27a71d75699deba3595bc9c2 F test/unixexcl.test a9870e46cc6f8390a494513d4f2bf55b5a8b3e46 F test/unordered.test f53095cee37851bf30130fa1bf299a8845e837bb F test/update.test 8bc86fd7ef1a00014f76dc6a6a7c974df4aef172 -F test/uri.test 0d289d32396bdbc491e9dc845f1a52e13f861e0b +F test/uri.test 78e869db1ff6331157b08ef089b1b3e65819c74c F test/utf16align.test 54cd35a27c005a9b6e7815d887718780b6a462ae F test/vacuum.test ce91c39f7f91a4273bf620efad21086b5aa6ef1d F test/vacuum2.test af432e6e3bfc0ea20a80cb86a03c7d9876d38324 @@ -907,7 +907,7 @@ F test/vtabF.test fd5ad376f5a34fe0891df1f3cddb4fe7c3eb077e F test/vtab_alter.test 9e374885248f69e251bdaacf480b04a197f125e5 F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8 F test/vtab_shared.test 82f463886e18d7f8395a4b6167c91815efe54839 -F test/wal.test edefe316b4125d7f68004ea53c5e73c398d436cc +F test/wal.test 2fbf4bbd0cb03aff6ada8150f29808c79370d50b F test/wal2.test 8871e7fd2c86711ff415a5817d68ea3101a15312 F test/wal3.test 6504bbf348b2d6dfade64a064f1050fd617e8706 F test/wal4.test 4744e155cd6299c6bd99d3eab1c82f77db9cdb3c @@ -917,7 +917,7 @@ F test/wal7.test 2ae8f427d240099cc4b2dfef63cff44e2a68a1bd F test/wal8.test 5ab217d21f7e5e86af2933a4ffd0d8357cc2c0bd F test/wal_common.tcl a98f17fba96206122eff624db0ab13ec377be4fe F test/walbak.test b9f68e39646375c2b877be906babcc15d38b4877 -F test/walbig.test 0ab8a430ef420a3114f7092e0f30fc9585ffa155 +F test/walbig.test f437473a16cfb314867c6b5d1dbcd519e73e3434 F test/walcksum.test f5447800a157c9e2234fbb8e80243f0813941bde F test/walcrash.test 4457436593be8c136f9148487c7dccd5e9013af2 F test/walcrash2.test 019d60b89d96c1937adb2b30b850ac7e86e5a142 @@ -992,7 +992,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 -P 99a9073b5e411ce94f38ce49608baaa15de8b850 -R d0dc4635c0ac977f7342c0a0dac9e48b -U dan -Z d6573fd4e75425ab6ee13bee3b518e09 +P b00ccda307caae597c143ab0586f90acb77f79cf +R 73d2728d68d6731f1970faf64d7b9793 +U mistachkin +Z 6e64cf730fea76ed50d0faa61eface55 diff --git a/manifest.uuid b/manifest.uuid index dda6c5d414..64173e4574 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b00ccda307caae597c143ab0586f90acb77f79cf \ No newline at end of file +82bcd7ec1531f6d71c079578434c58d3ce46a1de \ No newline at end of file diff --git a/src/test6.c b/src/test6.c index 89f4a090b0..5f64cacca0 100644 --- a/src/test6.c +++ b/src/test6.c @@ -476,7 +476,15 @@ static int cfSync(sqlite3_file *pFile, int flags){ if( nName>nCrashFile ) nName = nCrashFile; } +#ifdef TRACE_CRASHTEST + printf("cfSync(): nName = %d, nCrashFile = %d, zName = %s, zCrashFile = %s\n", + nName, nCrashFile, zName, zCrashFile); +#endif + if( nName==nCrashFile && 0==memcmp(zName, zCrashFile, nName) ){ +#ifdef TRACE_CRASHTEST + printf("cfSync(): name matched, g.iCrash = %d\n", g.iCrash); +#endif if( (--g.iCrash)==0 ) isCrash = 1; } diff --git a/test/bigfile.test b/test/bigfile.test index 52d74edbe6..d9470acfba 100644 --- a/test/bigfile.test +++ b/test/bigfile.test @@ -69,7 +69,7 @@ do_test bigfile-1.1 { # large files. So skip all of the remaining tests in this file. # db close -if {[catch {fake_big_file 4096 [pwd]/test.db} msg]} { +if {[catch {fake_big_file 4096 [get_pwd]/test.db} msg]} { puts "**** Unable to create a file larger than 4096 MB. *****" finish_test return @@ -109,7 +109,7 @@ do_test bigfile-1.4 { } $::MAGIC_SUM db close -if {[catch {fake_big_file 8192 [pwd]/test.db}]} { +if {[catch {fake_big_file 8192 [get_pwd]/test.db}]} { puts "**** Unable to create a file larger than 8192 MB. *****" finish_test return @@ -148,7 +148,7 @@ do_test bigfile-1.9 { } $::MAGIC_SUM db close -if {[catch {fake_big_file 16384 [pwd]/test.db}]} { +if {[catch {fake_big_file 16384 [get_pwd]/test.db}]} { puts "**** Unable to create a file larger than 16384 MB. *****" finish_test return diff --git a/test/bigfile2.test b/test/bigfile2.test index 9810d3a0f3..b13b75641b 100644 --- a/test/bigfile2.test +++ b/test/bigfile2.test @@ -29,7 +29,7 @@ do_execsql_test 1.1 { # are actually in use and new pages will be appended to the file. # db close -if {[catch {fake_big_file 4096 [pwd]/test.db} msg]} { +if {[catch {fake_big_file 4096 [get_pwd]/test.db} msg]} { puts "**** Unable to create a file larger than 4096 MB. *****" finish_test return diff --git a/test/crash5.test b/test/crash5.test index 42248d719e..a786712354 100644 --- a/test/crash5.test +++ b/test/crash5.test @@ -47,7 +47,7 @@ for {set ii 0} {$ii < 10} {incr ii} { do_test crash5-$ii.$jj.1 { crashsql -delay 1 -file test.db-journal -seed $ii -tclbody [join [list \ [list set iFail $jj] { - sqlite3_crashparams 0 [file join [pwd] test.db-journal] + sqlite3_crashparams 0 [file join [get_pwd] test.db-journal] # Begin a transaction and evaluate a "CREATE INDEX" statement # with the iFail'th malloc() set to fail. This operation will @@ -89,7 +89,7 @@ for {set ii 0} {$ii < 10} {incr ii} { # by writing page 4 out to the db file. If it crashes later on, # before syncing the journal... Corruption! # - sqlite3_crashparams 1 [file join [pwd] test.db-journal] + sqlite3_crashparams 1 [file join [get_pwd] test.db-journal] sqlite3_release_memory 8092 }]] {} expr 1 diff --git a/test/e_uri.test b/test/e_uri.test index 5275ec1b54..8110d70497 100644 --- a/test/e_uri.test +++ b/test/e_uri.test @@ -131,10 +131,10 @@ sqlite3_config_uri 1 if {$tcl_platform(platform) == "unix"} { set flags [list SQLITE_OPEN_READWRITE SQLITE_OPEN_CREATE SQLITE_OPEN_URI] foreach {tn uri error} " - 1 {file://localhost[pwd]/test.db} {not an error} - 2 {file://[pwd]/test.db} {not an error} - 3 {file://x[pwd]/test.db} {invalid uri authority: x} - 4 {file://invalid[pwd]/test.db} {invalid uri authority: invalid} + 1 {file://localhost[get_pwd]/test.db} {not an error} + 2 {file://[get_pwd]/test.db} {not an error} + 3 {file://x[get_pwd]/test.db} {invalid uri authority: x} + 4 {file://invalid[get_pwd]/test.db} {invalid uri authority: invalid} " { do_test 2.$tn { set DB [sqlite3_open_v2 $uri $flags ""] @@ -153,9 +153,9 @@ if {$tcl_platform(platform) == "unix"} { # parameters passed through to the VFS xOpen() methods. # foreach {tn uri parse} " - 1 {file:test.db#abc} {[pwd]/test.db {}} - 2 {file:test.db?a=b#abc} {[pwd]/test.db {a b}} - 3 {file:test.db?a=b#?c=d} {[pwd]/test.db {a b}} + 1 {file:test.db#abc} {[get_pwd]/test.db {}} + 2 {file:test.db?a=b#abc} {[get_pwd]/test.db {a b}} + 3 {file:test.db?a=b#?c=d} {[get_pwd]/test.db {a b}} " { do_filepath_test 3.$tn { parse_uri $uri } $parse } @@ -171,7 +171,7 @@ foreach {tn uri parse} " # path is interpreted as a relative path. # foreach {tn uri parse} " - 1 {file:test.db} {[pwd]/test.db {}} + 1 {file:test.db} {[get_pwd]/test.db {}} 2 {file:/test.db} {/test.db {}} 3 {file:///test.db} {/test.db {}} 4 {file://localhost/test.db} {/test.db {}} diff --git a/test/filectrl.test b/test/filectrl.test index 9f077d523c..1e4ec59853 100644 --- a/test/filectrl.test +++ b/test/filectrl.test @@ -34,7 +34,7 @@ do_test filectrl-1.4 { do_test filectrl-1.5 { db close sqlite3 db test_control_lockproxy.db - file_control_lockproxy_test db [pwd] + file_control_lockproxy_test db [get_pwd] } {} db close forcedelete .test_control_lockproxy.db-conch test.proxy diff --git a/test/misc7.test b/test/misc7.test index c69e60bb7c..146dca0412 100644 --- a/test/misc7.test +++ b/test/misc7.test @@ -483,7 +483,7 @@ do_test misc7-20.1 { # Try to open a really long file name. # do_test misc7-21.1 { - set zFile [file join [pwd] "[string repeat abcde 104].db"] + set zFile [file join [get_pwd] "[string repeat abcde 104].db"] set rc [catch {sqlite3 db2 $zFile} msg] list $rc $msg } {1 {unable to open database file}} diff --git a/test/pager1.test b/test/pager1.test index 415eb6ab81..3f3c12c541 100644 --- a/test/pager1.test +++ b/test/pager1.test @@ -535,7 +535,7 @@ proc copy_on_mj_delete {method filename args} { return SQLITE_OK } -set pwd [pwd] +set pwd [get_pwd] foreach {tn1 tcl} { 1 { set prefix "test.db" } 2 { @@ -1001,7 +1001,7 @@ do_test pager1-5.4.1 { # the master-journal name encoded as utf-8 with no nul term. # set mj_pointer [expr { - 20 + [string length [pwd]] + [string length "/test.db-mjXXXXXX9XX"] + 20 + [string length [get_pwd]] + [string length "/test.db-mjXXXXXX9XX"] }] expr {$::max_journal==(512+2*(1024+8)+$mj_pointer)} } 1 @@ -1020,7 +1020,7 @@ do_test pager1-5.4.2 { # written starting at the next (in this case 512 byte) sector boundary. # set mj_pointer [expr { - 20 + [string length [pwd]] + [string length "/test.db-mjXXXXXX9XX"] + 20 + [string length [get_pwd]] + [string length "/test.db-mjXXXXXX9XX"] }] expr {$::max_journal==(((512+2*(1024+8)+511)/512)*512 + $mj_pointer)} } 1 diff --git a/test/pragma.test b/test/pragma.test index 3f17bd742b..bb10327c3a 100644 --- a/test/pragma.test +++ b/test/pragma.test @@ -990,7 +990,7 @@ do_test pragma-9.4 { } {} ifcapable wsd { do_test pragma-9.5 { - set pwd [string map {' ''} [file nativename [pwd]]] + set pwd [string map {' ''} [file nativename [get_pwd]]] execsql " PRAGMA temp_store_directory='$pwd'; " @@ -999,7 +999,7 @@ ifcapable wsd { execsql { PRAGMA temp_store_directory; } - } [list [file nativename [pwd]]] + } [list [file nativename [get_pwd]]] do_test pragma-9.7 { catchsql { PRAGMA temp_store_directory='/NON/EXISTENT/PATH/FOOBAR'; diff --git a/test/quota.test b/test/quota.test index e12b83a429..ec89086d35 100644 --- a/test/quota.test +++ b/test/quota.test @@ -221,7 +221,7 @@ do_test quota-3.3.1 { execsql { INSERT INTO t1 VALUES(randomblob(500), randomblob(500)) } db2a execsql { INSERT INTO t1 VALUES(randomblob(500), randomblob(500)) } db2b set ::quota -} [list [file join [pwd] test.db] 5120] +} [list [file join [get_pwd] test.db] 5120] do_test quota-3.2.X { foreach db {db1a db2a db2b db1b} { catch { $db close } } diff --git a/test/quota2.test b/test/quota2.test index cf3449dafc..fae4d2dbd7 100644 --- a/test/quota2.test +++ b/test/quota2.test @@ -28,7 +28,7 @@ foreach dir {quota2a quota2a/x1 quota2a/x2 quota2b quota2c} { # that is the same across platforms. # unset -nocomplain ::quota_pwd ::quota_mapping -set ::quota_pwd [string map {\\ /} [pwd]] +set ::quota_pwd [string map {\\ /} [get_pwd]] set ::quota_mapping [list $::quota_pwd PWD] proc standard_path {x} { set x [string map {\\ /} $x] diff --git a/test/tester.tcl b/test/tester.tcl index e27a483f41..a1b61a7ae9 100644 --- a/test/tester.tcl +++ b/test/tester.tcl @@ -19,6 +19,7 @@ # # Commands to manipulate the db and the file-system at a high level: # +# get_pwd # copy_file FROM TO # delete_file FILENAME # drop_all_tables ?DB? @@ -148,6 +149,18 @@ proc getFileRetryDelay {} { return $::G(file-retry-delay) } +# Return the string representing the name of the current directory. On +# Windows, the result is "normalized" to whatever our parent command shell +# is using to prevent case-mismatch issues. +# +proc get_pwd {} { + if {$::tcl_platform(platform) eq "windows"} { + return [string trim [exec -- $::env(ComSpec) /c echo %CD%]] + } else { + return [pwd] + } +} + # Copy file $from into $to. This is used because some versions of # TCL for windows (notably the 8.4.1 binary package shipped with the # current mingw release) have a broken "file copy" command. @@ -984,7 +997,7 @@ proc crashsql {args} { # $crashfile gets compared to the native filename in # cfSync(), which can be different then what TCL uses by # default, so here we force it to the "nativename" format. - set cfile [string map {\\ \\\\} [file nativename [file join [pwd] $crashfile]]] + set cfile [string map {\\ \\\\} [file nativename [file join [get_pwd] $crashfile]]] set f [open crash.tcl w] puts $f "sqlite3_crash_enable 1" diff --git a/test/tkt-94c04eaadb.test b/test/tkt-94c04eaadb.test index cce8a98eb4..0063de664d 100644 --- a/test/tkt-94c04eaadb.test +++ b/test/tkt-94c04eaadb.test @@ -27,7 +27,7 @@ do_test tkt-94c94-1.1 { # Grow the file to larger than 4096MB (2^32 bytes) db close -if {[catch {fake_big_file 4096 [pwd]/test.db} msg]} { +if {[catch {fake_big_file 4096 [get_pwd]/test.db} msg]} { puts "**** Unable to create a file larger than 4096 MB. *****" finish_test return diff --git a/test/uri.test b/test/uri.test index 90074d0d27..93a32b773e 100644 --- a/test/uri.test +++ b/test/uri.test @@ -54,9 +54,9 @@ foreach {tn uri file} { if {$tcl_platform(platform)=="windows"} { if {$tn>14} break - set uri [string map [list PWD /[pwd]] $uri] + set uri [string map [list PWD /[get_pwd]] $uri] } else { - set uri [string map [list PWD [pwd]] $uri] + set uri [string map [list PWD [get_pwd]] $uri] } if {[file isdir $file]} {error "$file is a directory"} @@ -274,9 +274,9 @@ foreach {tn uri res} { } { if {$tcl_platform(platform)=="windows"} { - set uri [string map [list PWD [string range [pwd] 3 end]] $uri] + set uri [string map [list PWD [string range [get_pwd] 3 end]] $uri] } else { - set uri [string map [list PWD [string range [pwd] 1 end]] $uri] + set uri [string map [list PWD [string range [get_pwd] 1 end]] $uri] } do_test 6.$tn { diff --git a/test/wal.test b/test/wal.test index 3b63d3e792..9d2c6b14b4 100644 --- a/test/wal.test +++ b/test/wal.test @@ -1477,7 +1477,7 @@ foreach pgsz {512 1024 2048 4096 8192 16384 32768 65536} { # Test that when 1 or more pages are recovered from a WAL file, # sqlite3_log() is invoked to report this to the user. # -set walfile [file nativename [file join [pwd] test.db-wal]] +set walfile [file nativename [file join [get_pwd] test.db-wal]] catch {db close} forcedelete test.db do_test wal-23.1 { diff --git a/test/walbig.test b/test/walbig.test index 092db2381b..c43b7e2503 100644 --- a/test/walbig.test +++ b/test/walbig.test @@ -52,7 +52,7 @@ do_test walbig-1.0 { } {wal} db close -if {[catch {fake_big_file 5000 [pwd]/test.db}]} { +if {[catch {fake_big_file 5000 [get_pwd]/test.db}]} { puts "**** Unable to create a file larger than 5000 MB. *****" finish_test return From 533b8f6d4774970ed4d7cd1023f9db30d865279f Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 8 Mar 2012 20:28:31 +0000 Subject: [PATCH 03/11] On Windows, make sure the returned test current directory value does not contain any backslashes. FossilOrigin-Name: efee39e64bd95c284220fdb0ae8ee6c1847fadab --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/tester.tcl | 8 +++++++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 0722c0bf60..57d069eb0a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C On\sWindows,\smake\ssure\sthe\scurrent\sdirectory\svalue\sused\sby\sthe\stest\ssuite\sis\s'normalized'\sto\swhat\sthe\sparent\scommand\sshell\ssees.\s\sAlso,\sclean\sthe\stest\sdirectories\sused\sby\sthe\squota2.test\sfile. -D 2012-03-08T20:00:36.181 +C On\sWindows,\smake\ssure\sthe\sreturned\stest\scurrent\sdirectory\svalue\sdoes\snot\scontain\sany\sbackslashes. +D 2012-03-08T20:28:31.444 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -719,7 +719,7 @@ F test/tclsqlite.test 1597d353308531527583481d14d9da52ea8ed0af F test/tempdb.test 19d0f66e2e3eeffd68661a11c83ba5e6ace9128c F test/temptable.test 51edd31c65ed1560dd600b1796e8325df96318e2 F test/temptrigger.test 26670ed7a39cf2296a7f0a9e0a1d7bdb7abe936d -F test/tester.tcl 1fd85b1f508eab104085427c2c4b77c81ad5adb6 +F test/tester.tcl 7db9e90e4a9cc57ea92118ee011634f86dc8e847 F test/thread001.test 7cc2ce08f9cde95964736d11e91f9ab610f82f91 F test/thread002.test e630504f8a06c00bf8bbe68528774dd96aeb2e58 F test/thread003.test ee4c9efc3b86a6a2767516a37bd64251272560a7 @@ -992,7 +992,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 -P b00ccda307caae597c143ab0586f90acb77f79cf -R 73d2728d68d6731f1970faf64d7b9793 +P 82bcd7ec1531f6d71c079578434c58d3ce46a1de +R 481f07eae7a20043918617293f6bf255 U mistachkin -Z 6e64cf730fea76ed50d0faa61eface55 +Z e4b7999e3f65d6915663c98d5d60a2e1 diff --git a/manifest.uuid b/manifest.uuid index 64173e4574..65ab8c5d21 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -82bcd7ec1531f6d71c079578434c58d3ce46a1de \ No newline at end of file +efee39e64bd95c284220fdb0ae8ee6c1847fadab \ No newline at end of file diff --git a/test/tester.tcl b/test/tester.tcl index a1b61a7ae9..5bc7eb704d 100644 --- a/test/tester.tcl +++ b/test/tester.tcl @@ -155,7 +155,13 @@ proc getFileRetryDelay {} { # proc get_pwd {} { if {$::tcl_platform(platform) eq "windows"} { - return [string trim [exec -- $::env(ComSpec) /c echo %CD%]] + # + # NOTE: Cannot use [file normalize] here because it would alter the + # case of the result to what Tcl considers canonical, which would + # defeat the purpose of this procedure. + # + return [string map [list \\ /] \ + [string trim [exec -- $::env(ComSpec) /c echo %CD%]]] } else { return [pwd] } From 331b67c151b210d60b986af9a2cc845b90ea0221 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 9 Mar 2012 22:02:08 +0000 Subject: [PATCH 04/11] Candidate fix for the optimizer problem described in ticket [b7c8682cc17f3] which can causes a LEFT JOIN to be changed into a INNER JOIN if there are OR terms in the WHERE clause. FossilOrigin-Name: 0dc4cb935514131c99172175d57feec3a1743aa9 --- manifest | 18 +++++++++--------- manifest.uuid | 2 +- src/where.c | 24 +++++++++++++++++++++--- test/where7.test | 2 +- test/where9.test | 28 ++++++++++++++++++++++++---- 5 files changed, 56 insertions(+), 18 deletions(-) diff --git a/manifest b/manifest index 57d069eb0a..ff717fe1dd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C On\sWindows,\smake\ssure\sthe\sreturned\stest\scurrent\sdirectory\svalue\sdoes\snot\scontain\sany\sbackslashes. -D 2012-03-08T20:28:31.444 +C Candidate\sfix\sfor\sthe\soptimizer\sproblem\sdescribed\sin\sticket\s\n[b7c8682cc17f3]\swhich\scan\scauses\sa\sLEFT\sJOIN\sto\sbe\schanged\ninto\sa\sINNER\sJOIN\sif\sthere\sare\sOR\sterms\sin\sthe\sWHERE\sclause. +D 2012-03-09T22:02:08.875 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -253,7 +253,7 @@ F src/vtab.c ab90fb600a3f5e4b7c48d22a4cdb2d6b23239847 F src/wal.c 7bb3ad807afc7973406c805d5157ec7a2f65e146 F src/wal.h 29c197540b19044e6cd73487017e5e47a1d3dac6 F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f -F src/where.c f2cf59751f7facb4c422adf83ddc989aa5772874 +F src/where.c d4ce63a2887dab037d9d9830abbfcac2643e308a F test/8_3_names.test 631ea964a3edb091cf73c3b540f6bcfdb36ce823 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 @@ -937,10 +937,10 @@ F test/where3.test 667e75642102c97a00bf9b23d3cb267db321d006 F test/where4.test e9b9e2f2f98f00379e6031db6a6fca29bae782a2 F test/where5.test fdf66f96d29a064b63eb543e28da4dfdccd81ad2 F test/where6.test 5da5a98cec820d488e82708301b96cb8c18a258b -F test/where7.test 814d7373413398e074f134cff5f8872e2c08bd3b +F test/where7.test 5c566388f0cc318b0032ce860f4ac5548e3c265a F test/where8.test a6c740fd286d7883e274e17b6230a9d672a7ab1f F test/where8m.test da346596e19d54f0aba35ebade032a7c47d79739 -F test/where9.test cd4ee5e455799ddba7041e5ac539044bb24e3874 +F test/where9.test ae98dc22ef9b6f2bc81e9f164e41b38faa9bda06 F test/whereA.test 24c234263c8fe358f079d5e57d884fb569d2da0a F test/whereB.test 0def95db3bdec220a731c7e4bec5930327c1d8c5 F test/whereC.test 13ff5ec0dba407c0e0c075980c75b3275a6774e5 @@ -992,7 +992,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 -P 82bcd7ec1531f6d71c079578434c58d3ce46a1de -R 481f07eae7a20043918617293f6bf255 -U mistachkin -Z e4b7999e3f65d6915663c98d5d60a2e1 +P efee39e64bd95c284220fdb0ae8ee6c1847fadab +R bea1320a1e93f035f866bb48777a9a0b +U drh +Z baafcf2bb8e1f4793d13146917501256 diff --git a/manifest.uuid b/manifest.uuid index 65ab8c5d21..b0f211922a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -efee39e64bd95c284220fdb0ae8ee6c1847fadab \ No newline at end of file +0dc4cb935514131c99172175d57feec3a1743aa9 \ No newline at end of file diff --git a/src/where.c b/src/where.c index eda8d5fb8e..1def2db917 100644 --- a/src/where.c +++ b/src/where.c @@ -4342,10 +4342,25 @@ static Bitmask codeOneLoopStart( ** Then for every term xN, evaluate as the subexpression: xN AND z ** That way, terms in y that are factored into the disjunction will ** be picked up by the recursive calls to sqlite3WhereBegin() below. + ** + ** Actually, each subexpression is converted to "xN AND w" where w is + ** the "interesting" terms of z - terms that did not originate in the + ** ON or USING clause of a LEFT JOIN, and terms that are usable as + ** indices. */ if( pWC->nTerm>1 ){ - pAndExpr = sqlite3ExprAlloc(pParse->db, TK_AND, 0, 0); - pAndExpr->pRight = pWhere; + int ii; + for(ii=0; iinTerm; ii++){ + Expr *pExpr = pWC->a[ii].pExpr; + if( ExprHasProperty(pExpr, EP_FromJoin) ) continue; + if( pWC->a[ii].wtFlags & (TERM_VIRTUAL|TERM_ORINFO) ) continue; + if( (pWC->a[ii].eOperator & WO_ALL)==0 ) continue; + pExpr = sqlite3ExprDup(pParse->db, pExpr, 0); + pAndExpr = sqlite3ExprAnd(pParse->db, pAndExpr, pExpr); + } + if( pAndExpr ){ + pAndExpr = sqlite3PExpr(pParse, TK_AND, 0, pAndExpr, 0); + } } for(ii=0; iinTerm; ii++){ @@ -4387,7 +4402,10 @@ static Bitmask codeOneLoopStart( } } } - sqlite3DbFree(pParse->db, pAndExpr); + if( pAndExpr ){ + pAndExpr->pLeft = 0; + sqlite3ExprDelete(pParse->db, pAndExpr); + } sqlite3VdbeChangeP1(v, iRetInit, sqlite3VdbeCurrentAddr(v)); sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrBrk); sqlite3VdbeResolveLabel(v, iLoopBody); diff --git a/test/where7.test b/test/where7.test index ffb7173d21..b6cd7ccbbc 100644 --- a/test/where7.test +++ b/test/where7.test @@ -23339,7 +23339,7 @@ do_execsql_test where7-3.1 { OR t301.c8 = 1407424651264000) ORDER BY t302.c5 LIMIT 200; } { - 0 0 1 {SEARCH TABLE t301 USING COVERING INDEX t301_c4 (c4=?) (~5 rows)} + 0 0 1 {SEARCH TABLE t301 USING COVERING INDEX t301_c4 (c4=?) (~10 rows)} 0 0 1 {SEARCH TABLE t301 USING INTEGER PRIMARY KEY (rowid=?) (~1 rows)} 0 1 0 {SEARCH TABLE t302 USING INDEX t302_c8_c3 (c8=? AND c3>?) (~2 rows)} 0 0 0 {USE TEMP B-TREE FOR ORDER BY} diff --git a/test/where9.test b/test/where9.test index 8c5c96e2a8..23260a6b65 100644 --- a/test/where9.test +++ b/test/where9.test @@ -364,7 +364,7 @@ ifcapable explain { } { 0 0 0 {SEARCH TABLE t1 USING INTEGER PRIMARY KEY (rowid=?) (~1 rows)} 0 1 1 {SEARCH TABLE t2 USING INDEX t2d (d=?) (~2 rows)} - 0 1 1 {SEARCH TABLE t2 USING COVERING INDEX t2f (f=?) (~5 rows)} + 0 1 1 {SEARCH TABLE t2 USING COVERING INDEX t2f (f=?) (~10 rows)} } do_execsql_test where9-3.2 { EXPLAIN QUERY PLAN @@ -374,7 +374,7 @@ ifcapable explain { } { 0 0 0 {SEARCH TABLE t1 USING INTEGER PRIMARY KEY (rowid=?) (~1 rows)} 0 1 1 {SEARCH TABLE t2 USING INDEX t2d (d=?) (~2 rows)} - 0 1 1 {SEARCH TABLE t2 USING COVERING INDEX t2f (f=?) (~5 rows)} + 0 1 1 {SEARCH TABLE t2 USING COVERING INDEX t2f (f=?) (~10 rows)} } } @@ -453,8 +453,8 @@ ifcapable explain { do_execsql_test where9-5.1 { EXPLAIN QUERY PLAN SELECT a FROM t1 WHERE b>1000 AND (c=31031 OR d IS NULL) } { - 0 0 0 {SEARCH TABLE t1 USING INDEX t1c (c=?) (~2 rows)} - 0 0 0 {SEARCH TABLE t1 USING INDEX t1d (d=?) (~2 rows)} + 0 0 0 {SEARCH TABLE t1 USING INDEX t1c (c=?) (~3 rows)} + 0 0 0 {SEARCH TABLE t1 USING INDEX t1d (d=?) (~3 rows)} } # In contrast, b=1000 is preferred over any OR-clause. @@ -856,5 +856,25 @@ do_test where9-7.3.2 { } } {79 81} +# Fix for ticket [b7c8682cc17f32903f03a610bd0d35ffd3c1e6e4] +# "Incorrect result from LEFT JOIN with OR in the WHERE clause" +# +do_test where9-8.1 { + db eval { + CREATE TABLE t81(a INTEGER PRIMARY KEY, b, c, d); + CREATE TABLE t82(x INTEGER PRIMARY KEY, y); + CREATE TABLE t83(p INTEGER PRIMARY KEY, q); + + INSERT INTO t81 VALUES(2,3,4,5); + INSERT INTO t81 VALUES(3,4,5,6); + INSERT INTO t82 VALUES(2,4); + INSERT INTO t83 VALUES(5,55); + + SELECT * + FROM t81 LEFT JOIN t82 ON y=b JOIN t83 + WHERE c==p OR d==p + ORDER BY +a; + } +} {2 3 4 5 {} {} 5 55 3 4 5 6 2 4 5 55} finish_test From 421377e67ac7b5289c667a3ef4a23826908213b4 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 15 Mar 2012 21:28:54 +0000 Subject: [PATCH 05/11] Add the sqlite3_db_readonly() interface. This is still tentative, pending a closer look at other ideas to accomplish the same thing. FossilOrigin-Name: 254f99ea9ff1534948bdb179e69ab0c940c87ec1 --- manifest | 23 ++++++++------- manifest.uuid | 2 +- src/main.c | 75 +++++++++++++++++++++++++++--------------------- src/sqlite.h.in | 9 ++++++ src/sqliteInt.h | 1 + src/test1.c | 25 ++++++++++++++++ test/pager1.test | 18 ++++++++++++ 7 files changed, 110 insertions(+), 43 deletions(-) diff --git a/manifest b/manifest index ff717fe1dd..13a39a43c3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Candidate\sfix\sfor\sthe\soptimizer\sproblem\sdescribed\sin\sticket\s\n[b7c8682cc17f3]\swhich\scan\scauses\sa\sLEFT\sJOIN\sto\sbe\schanged\ninto\sa\sINNER\sJOIN\sif\sthere\sare\sOR\sterms\sin\sthe\sWHERE\sclause. -D 2012-03-09T22:02:08.875 +C Add\sthe\ssqlite3_db_readonly()\sinterface.\s\sThis\sis\sstill\stentative,\spending\na\scloser\slook\sat\sother\sideas\sto\saccomplish\sthe\ssame\sthing. +D 2012-03-15T21:28:54.896 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -147,7 +147,7 @@ F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f F src/lempar.c 0ee69fca0be54cd93939df98d2aca4ca46f44416 F src/loadext.c f20382fbaeec832438a1ba7797bee3d3c8a6d51d -F src/main.c dcb4a15254dca9cc59dba63e813a8c140c021832 +F src/main.c 91458c713e9b7f8dbc98d79e78f1150f0ca9c2a1 F src/malloc.c 15afac5e59b6584efe072e9933aefb4230e74f97 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c b3677415e69603d6a0e7c5410a1b3731d55beda1 @@ -182,14 +182,14 @@ F src/resolve.c 3d3e80a98f203ac6b9329e9621e29eda85ddfd40 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697 F src/select.c 44ccdcb5d2a1c48622c179b2d72167b716388581 F src/shell.c aa28f117033ba3e44b5eaaf2ad572222bcdfd66e -F src/sqlite.h.in f46e368d1a28b09d876e35444785674d170f2d62 +F src/sqlite.h.in 307317b26050634adc0e22c1db2ff071b3262088 F src/sqlite3ext.h 6904f4aadf976f95241311fbffb00823075d9477 -F src/sqliteInt.h b013dab7d43fb67c3ca2f0253d7863abb37e233c +F src/sqliteInt.h e65429a6f19b41720561b9434b2192574a91cfa2 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 4568e72dfd36b6a5911f93457364deb072e0b03a F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e F src/tclsqlite.c 2aeb69958965dad0842d5ea1456f1a958ef296e6 -F src/test1.c 328cbe4a4ee6d10d67ece2a7adaa2770569fae0f +F src/test1.c 07f30e8714bab94d8de8a88865d9c59bc512a1a8 F src/test2.c 711555927f1f7e8db9aab86b512bc6934a774abe F src/test3.c 91d3f1a09cfae3533ef17d8b484a160f3d1f1a21 F src/test4.c d1e5a5e904d4b444cf572391fdcb017638e36ff7 @@ -625,7 +625,7 @@ F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347 F test/null.test a8b09b8ed87852742343b33441a9240022108993 F test/openv2.test 0d3040974bf402e19b7df4b783e447289d7ab394 F test/oserror.test 50417780d0e0d7cd23cf12a8277bb44024765df3 -F test/pager1.test 101032cb9d8093806600b343fdcf78ba51c1e3e9 +F test/pager1.test 6e43e79d6ac1fc31b494ff3a0b56445b7eda5d2b F test/pager2.test 745b911dde3d1f24ae0870bd433dfa83d7c658c1 F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f F test/pagerfault.test 452f2cc23e3bfcfa935f4442aec1da4fe1dc0442 @@ -992,7 +992,10 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 -P efee39e64bd95c284220fdb0ae8ee6c1847fadab -R bea1320a1e93f035f866bb48777a9a0b +P 0dc4cb935514131c99172175d57feec3a1743aa9 +R 851ef17fd9b25c32052af88e7352afdb +T *branch * db-readonly-api +T *sym-db-readonly-api * +T -sym-trunk * U drh -Z baafcf2bb8e1f4793d13146917501256 +Z 348596b004b2d886ba8debcb3d4e71fa diff --git a/manifest.uuid b/manifest.uuid index b0f211922a..b7a8d8211c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0dc4cb935514131c99172175d57feec3a1743aa9 \ No newline at end of file +254f99ea9ff1534948bdb179e69ab0c940c87ec1 \ No newline at end of file diff --git a/src/main.c b/src/main.c index 3a1dff576a..d148b4b42c 100644 --- a/src/main.c +++ b/src/main.c @@ -2704,35 +2704,27 @@ int sqlite3_extended_result_codes(sqlite3 *db, int onoff){ */ int sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, void *pArg){ int rc = SQLITE_ERROR; - int iDb; + Btree *pBtree; + sqlite3_mutex_enter(db->mutex); - if( zDbName==0 ){ - iDb = 0; - }else{ - for(iDb=0; iDbnDb; iDb++){ - if( strcmp(db->aDb[iDb].zName, zDbName)==0 ) break; - } - } - if( iDbnDb ){ - Btree *pBtree = db->aDb[iDb].pBt; - if( pBtree ){ - Pager *pPager; - sqlite3_file *fd; - sqlite3BtreeEnter(pBtree); - pPager = sqlite3BtreePager(pBtree); - assert( pPager!=0 ); - fd = sqlite3PagerFile(pPager); - assert( fd!=0 ); - if( op==SQLITE_FCNTL_FILE_POINTER ){ - *(sqlite3_file**)pArg = fd; - rc = SQLITE_OK; - }else if( fd->pMethods ){ - rc = sqlite3OsFileControl(fd, op, pArg); - }else{ - rc = SQLITE_NOTFOUND; - } - sqlite3BtreeLeave(pBtree); + pBtree = sqlite3DbNameToBtree(db, zDbName); + if( pBtree ){ + Pager *pPager; + sqlite3_file *fd; + sqlite3BtreeEnter(pBtree); + pPager = sqlite3BtreePager(pBtree); + assert( pPager!=0 ); + fd = sqlite3PagerFile(pPager); + assert( fd!=0 ); + if( op==SQLITE_FCNTL_FILE_POINTER ){ + *(sqlite3_file**)pArg = fd; + rc = SQLITE_OK; + }else if( fd->pMethods ){ + rc = sqlite3OsFileControl(fd, op, pArg); + }else{ + rc = SQLITE_NOTFOUND; } + sqlite3BtreeLeave(pBtree); } sqlite3_mutex_leave(db->mutex); return rc; @@ -3028,15 +3020,34 @@ sqlite3_int64 sqlite3_uri_int64( } /* -** Return the filename of the database associated with a database -** connection. +** Return the Btree pointer identified by zDbName. Return NULL if not found. */ -const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName){ +Btree *sqlite3DbNameToBtree(sqlite3 *db, const char *zDbName){ int i; for(i=0; inDb; i++){ - if( db->aDb[i].pBt && sqlite3StrICmp(zDbName, db->aDb[i].zName)==0 ){ - return sqlite3BtreeGetFilename(db->aDb[i].pBt); + if( db->aDb[i].pBt + && (zDbName==0 || sqlite3StrICmp(zDbName, db->aDb[i].zName)==0) + ){ + return db->aDb[i].pBt; } } return 0; } + +/* +** Return the filename of the database associated with a database +** connection. +*/ +const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName){ + Btree *pBt = sqlite3DbNameToBtree(db, zDbName); + return pBt ? sqlite3BtreeGetFilename(pBt) : 0; +} + +/* +** Return 1 if database is read-only or 0 if read/write. Return -1 if +** no such database exists. +*/ +int sqlite3_db_readonly(sqlite3 *db, const char *zDbName){ + Btree *pBt = sqlite3DbNameToBtree(db, zDbName); + return pBt ? sqlite3PagerIsreadonly(sqlite3BtreePager(pBt)) : -1; +} diff --git a/src/sqlite.h.in b/src/sqlite.h.in index b43fe208f8..3c82ebd600 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -4494,6 +4494,15 @@ sqlite3 *sqlite3_db_handle(sqlite3_stmt*); */ const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName); +/* +** CAPI3REF: Determine if a database is read-only +** +** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N +** of connection D is read-only, 0 if it is read/write, and -1 if N is not +** the name of a database in connection C. +*/ +int sqlite3_db_readonly(sqlite3 *db, const char *zDbName); + /* ** CAPI3REF: Find the next prepared statement ** diff --git a/src/sqliteInt.h b/src/sqliteInt.h index cfe8fd64fb..15c3f302e2 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -2701,6 +2701,7 @@ void sqlite3AddCollateType(Parse*, Token*); void sqlite3EndTable(Parse*,Token*,Token*,Select*); int sqlite3ParseUri(const char*,const char*,unsigned int*, sqlite3_vfs**,char**,char **); +Btree *sqlite3DbNameToBtree(sqlite3*,const char*); int sqlite3CodeOnce(Parse *); Bitvec *sqlite3BitvecCreate(u32); diff --git a/src/test1.c b/src/test1.c index 281823d5a8..e1220cf11f 100644 --- a/src/test1.c +++ b/src/test1.c @@ -4665,6 +4665,30 @@ static int test_db_filename( return TCL_OK; } +/* +** Usage: sqlite3_db_readonly DB DBNAME +** +** Return 1 or 0 if DBNAME is readonly or not. Return -1 if DBNAME does +** not exist. +*/ +static int test_db_readonly( + void * clientData, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[] +){ + sqlite3 *db; + const char *zDbName; + if( objc!=3 ){ + Tcl_WrongNumArgs(interp, 1, objv, "DB DBNAME"); + return TCL_ERROR; + } + if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; + zDbName = Tcl_GetString(objv[2]); + Tcl_SetObjResult(interp, Tcl_NewIntObj(sqlite3_db_readonly(db, zDbName))); + return TCL_OK; +} + /* ** Usage: sqlite3_soft_heap_limit ?N? ** @@ -6055,6 +6079,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ { "sqlite3_release_memory", test_release_memory, 0}, { "sqlite3_db_release_memory", test_db_release_memory, 0}, { "sqlite3_db_filename", test_db_filename, 0}, + { "sqlite3_db_readonly", test_db_readonly, 0}, { "sqlite3_soft_heap_limit", test_soft_heap_limit, 0}, { "sqlite3_thread_cleanup", test_thread_cleanup, 0}, { "sqlite3_pager_refcounts", test_pager_refcounts, 0}, diff --git a/test/pager1.test b/test/pager1.test index 3f3c12c541..96fcb5ba0e 100644 --- a/test/pager1.test +++ b/test/pager1.test @@ -887,6 +887,24 @@ do_test pager1.4.7.3 { delete_file test.db-journal file exists test.db-journal } {0} +do_test pager1.4.8.1 { + catch {file attributes test.db -permissions r--------} + catch {file attributes test.db -readonly 1} + sqlite3 db test.db + db eval { SELECT * FROM t1 } + sqlite3_db_readonly db main +} {1} +do_test pager1.4.8.2 { + sqlite3_db_readonly db xyz +} {-1} +do_test pager1.4.8.3 { + db close + catch {file attributes test.db -permissions rw-rw-rw-} + catch {file attributes test.db -readonly 0} + sqlite3 db test.db + db eval { SELECT * FROM t1 } + sqlite3_db_readonly db main +} {0} #------------------------------------------------------------------------- # The following tests deal with multi-file commits. From 7a48480d0772dde6f5a7ca3c10f878c8202b9ee4 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 16 Mar 2012 00:28:11 +0000 Subject: [PATCH 06/11] Fix harmless compiler warnings. FossilOrigin-Name: 74eadeec34c4b19cf5f8b7f648db3b7ad601a00e --- ext/fts3/fts3_porter.c | 1 + ext/fts3/fts3_tokenizer1.c | 1 + manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/where.c | 15 +++++++-------- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/ext/fts3/fts3_porter.c b/ext/fts3/fts3_porter.c index 84aa132229..579745b85f 100644 --- a/ext/fts3/fts3_porter.c +++ b/ext/fts3/fts3_porter.c @@ -630,6 +630,7 @@ static const sqlite3_tokenizer_module porterTokenizerModule = { porterOpen, porterClose, porterNext, + 0 }; /* diff --git a/ext/fts3/fts3_tokenizer1.c b/ext/fts3/fts3_tokenizer1.c index d11a499766..deea06d92b 100644 --- a/ext/fts3/fts3_tokenizer1.c +++ b/ext/fts3/fts3_tokenizer1.c @@ -218,6 +218,7 @@ static const sqlite3_tokenizer_module simpleTokenizerModule = { simpleOpen, simpleClose, simpleNext, + 0, }; /* diff --git a/manifest b/manifest index b92d8e9431..839b111215 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\ssqlite3_db_readonly()\sAPI\sto\strunk. -D 2012-03-15T22:54:37.033 +C Fix\sharmless\scompiler\swarnings. +D 2012-03-16T00:28:11.282 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -71,13 +71,13 @@ F ext/fts3/fts3_expr.c dbc7ba4c3a6061adde0f38ed8e9b349568299551 F ext/fts3/fts3_hash.c 8dd2d06b66c72c628c2732555a32bc0943114914 F ext/fts3/fts3_hash.h 8331fb2206c609f9fc4c4735b9ab5ad6137c88ec F ext/fts3/fts3_icu.c 6c8f395cdf9e1e3afa7fadb7e523dbbf381c6dfa -F ext/fts3/fts3_porter.c b7e5276f9f0a5fc7018b6fa55ce0f31f269ef881 +F ext/fts3/fts3_porter.c a465b49fcb8249a755792f87516eff182efa42b3 F ext/fts3/fts3_snippet.c c9e126c20760988aa7c43c6ea1379db34738282e F ext/fts3/fts3_term.c d3466cf99432291be08e379d89645462431809d6 F ext/fts3/fts3_test.c 6b7cc68aef4efb084e1449f7d20c4b20d3bdf6b4 F ext/fts3/fts3_tokenizer.c 3da7254a9881f7e270ab28e2004e0d22b3212bce F ext/fts3/fts3_tokenizer.h 66dec98e365854b6cd2d54f1a96bb6d428fc5a68 -F ext/fts3/fts3_tokenizer1.c 0dde8f307b8045565cf63797ba9acfaff1c50c68 +F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004 F ext/fts3/fts3_write.c f87bb2d27d31cb7a7bf306747079095393c9d073 F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9 F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100 @@ -253,7 +253,7 @@ F src/vtab.c ab90fb600a3f5e4b7c48d22a4cdb2d6b23239847 F src/wal.c 7bb3ad807afc7973406c805d5157ec7a2f65e146 F src/wal.h 29c197540b19044e6cd73487017e5e47a1d3dac6 F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f -F src/where.c d4ce63a2887dab037d9d9830abbfcac2643e308a +F src/where.c 6baab5dfcf4472552c0346d04f6fd2f4f8539c78 F test/8_3_names.test 631ea964a3edb091cf73c3b540f6bcfdb36ce823 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 @@ -992,7 +992,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 -P 0dc4cb935514131c99172175d57feec3a1743aa9 254f99ea9ff1534948bdb179e69ab0c940c87ec1 -R 16a5b52f9383f81bfef8d52e60214ef8 +P fed134a5f395533de0c9d76950697c060ddb126d +R 9a71f3ab5326ee35b9bbd87536e2a1d5 U drh -Z 7730c197df8d847371e263295817abcb +Z 60cd8a049ba54606f3a162ca33790b57 diff --git a/manifest.uuid b/manifest.uuid index b419484dbc..9a63bfc3a0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fed134a5f395533de0c9d76950697c060ddb126d \ No newline at end of file +74eadeec34c4b19cf5f8b7f648db3b7ad601a00e \ No newline at end of file diff --git a/src/where.c b/src/where.c index 1def2db917..e6083f0033 100644 --- a/src/where.c +++ b/src/where.c @@ -3802,8 +3802,7 @@ static Bitmask codeOneLoopStart( WhereInfo *pWInfo, /* Complete information about the WHERE clause */ int iLevel, /* Which level of pWInfo->a[] should be coded */ u16 wctrlFlags, /* One of the WHERE_* flags defined in sqliteInt.h */ - Bitmask notReady, /* Which tables are currently available */ - Expr *pWhere /* Complete WHERE clause */ + Bitmask notReady /* Which tables are currently available */ ){ int j, k; /* Loop counters */ int iCur; /* The VDBE cursor for the table */ @@ -4349,12 +4348,12 @@ static Bitmask codeOneLoopStart( ** indices. */ if( pWC->nTerm>1 ){ - int ii; - for(ii=0; iinTerm; ii++){ - Expr *pExpr = pWC->a[ii].pExpr; + int iTerm; + for(iTerm=0; iTermnTerm; iTerm++){ + Expr *pExpr = pWC->a[iTerm].pExpr; if( ExprHasProperty(pExpr, EP_FromJoin) ) continue; - if( pWC->a[ii].wtFlags & (TERM_VIRTUAL|TERM_ORINFO) ) continue; - if( (pWC->a[ii].eOperator & WO_ALL)==0 ) continue; + if( pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_ORINFO) ) continue; + if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue; pExpr = sqlite3ExprDup(pParse->db, pExpr, 0); pAndExpr = sqlite3ExprAnd(pParse->db, pAndExpr, pExpr); } @@ -5061,7 +5060,7 @@ WhereInfo *sqlite3WhereBegin( for(i=0; ia[i]; explainOneScan(pParse, pTabList, pLevel, i, pLevel->iFrom, wctrlFlags); - notReady = codeOneLoopStart(pWInfo, i, wctrlFlags, notReady, pWhere); + notReady = codeOneLoopStart(pWInfo, i, wctrlFlags, notReady); pWInfo->iContinue = pLevel->addrCont; } From c8d7b24e939bb0fb0ddedbffb7d867b0d7af444e Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 16 Mar 2012 16:52:54 +0000 Subject: [PATCH 07/11] Cherrypick the [3475092cff] fix for 32-bit overflow with large language-ids into trunk. FossilOrigin-Name: 2755edc7f1186ba8955f2c3550a90f40a55ddae2 --- ext/fts3/fts3_write.c | 58 +++++++++++++++++------- manifest | 14 +++--- manifest.uuid | 2 +- test/fts4langid.test | 101 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 152 insertions(+), 23 deletions(-) diff --git a/ext/fts3/fts3_write.c b/ext/fts3/fts3_write.c index 8f97c8be98..bc20dfa3f3 100644 --- a/ext/fts3/fts3_write.c +++ b/ext/fts3/fts3_write.c @@ -434,16 +434,42 @@ int sqlite3Fts3ReadLock(Fts3Table *p){ return rc; } +/* +** FTS maintains a separate indexes for each language-id (a 32-bit integer). +** Within each language id, a separate index is maintained to store the +** document terms, and each configured prefix size (configured the FTS +** "prefix=" option). And each index consists of multiple levels ("relative +** levels"). +** +** All three of these values (the language id, the specific index and the +** level within the index) are encoded in 64-bit integer values stored +** in the %_segdir table on disk. This function is used to convert three +** separate component values into the single 64-bit integer value that +** can be used to query the %_segdir table. +** +** Specifically, each language-id/index combination is allocated 1024 +** 64-bit integer level values ("absolute levels"). The main terms index +** for language-id 0 is allocate values 0-1023. The first prefix index +** (if any) for language-id 0 is allocated values 1024-2047. And so on. +** Language 1 indexes are allocated immediately following language 0. +** +** So, for a system with nPrefix prefix indexes configured, the block of +** absolute levels that corresponds to language-id iLangid and index +** iIndex starts at absolute level ((iLangid * (nPrefix+1) + iIndex) * 1024). +*/ static sqlite3_int64 getAbsoluteLevel( Fts3Table *p, int iLangid, int iIndex, int iLevel ){ + sqlite3_int64 iBase; /* First absolute level for iLangid/iIndex */ assert( iLangid>=0 ); assert( p->nIndex>0 ); assert( iIndex>=0 && iIndexnIndex ); - return (iLangid * p->nIndex + iIndex) * FTS3_SEGDIR_MAXLEVEL + iLevel; + + iBase = ((sqlite3_int64)iLangid * p->nIndex + iIndex) * FTS3_SEGDIR_MAXLEVEL; + return iBase + iLevel; } @@ -468,7 +494,7 @@ int sqlite3Fts3AllSegdirs( Fts3Table *p, /* FTS3 table */ int iLangid, /* Language being queried */ int iIndex, /* Index for p->aIndex[] */ - int iLevel, /* Level to select */ + int iLevel, /* Level to select (relative level) */ sqlite3_stmt **ppStmt /* OUT: Compiled statement */ ){ int rc; @@ -483,7 +509,7 @@ int sqlite3Fts3AllSegdirs( rc = fts3SqlStmt(p, SQL_SELECT_LEVEL_RANGE, &pStmt, 0); if( rc==SQLITE_OK ){ sqlite3_bind_int64(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex, 0)); - sqlite3_bind_int(pStmt, 2, + sqlite3_bind_int64(pStmt, 2, getAbsoluteLevel(p, iLangid, iIndex, FTS3_SEGDIR_MAXLEVEL-1) ); } @@ -491,7 +517,7 @@ int sqlite3Fts3AllSegdirs( /* "SELECT * FROM %_segdir WHERE level = ? ORDER BY ..." */ rc = fts3SqlStmt(p, SQL_SELECT_LEVEL, &pStmt, 0); if( rc==SQLITE_OK ){ - sqlite3_bind_int(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex, iLevel)); + sqlite3_bind_int64(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex,iLevel)); } } *ppStmt = pStmt; @@ -1763,7 +1789,7 @@ static int fts3WriteSegment( */ static int fts3WriteSegdir( Fts3Table *p, /* Virtual table handle */ - int iLevel, /* Value for "level" field */ + sqlite3_int64 iLevel, /* Value for "level" field (absolute level) */ int iIdx, /* Value for "idx" field */ sqlite3_int64 iStartBlock, /* Value for "start_block" field */ sqlite3_int64 iLeafEndBlock, /* Value for "leaves_end_block" field */ @@ -1774,7 +1800,7 @@ static int fts3WriteSegdir( sqlite3_stmt *pStmt; int rc = fts3SqlStmt(p, SQL_INSERT_SEGDIR, &pStmt, 0); if( rc==SQLITE_OK ){ - sqlite3_bind_int(pStmt, 1, iLevel); + sqlite3_bind_int64(pStmt, 1, iLevel); sqlite3_bind_int(pStmt, 2, iIdx); sqlite3_bind_int64(pStmt, 3, iStartBlock); sqlite3_bind_int64(pStmt, 4, iLeafEndBlock); @@ -2157,7 +2183,7 @@ static int fts3SegWriterAdd( static int fts3SegWriterFlush( Fts3Table *p, /* Virtual table handle */ SegmentWriter *pWriter, /* SegmentWriter to flush to the db */ - int iLevel, /* Value for 'level' column of %_segdir */ + sqlite3_int64 iLevel, /* Value for 'level' column of %_segdir */ int iIdx /* Value for 'idx' column of %_segdir */ ){ int rc; /* Return code */ @@ -2239,7 +2265,7 @@ static int fts3SegmentMaxLevel( Fts3Table *p, int iLangid, int iIndex, - int *pnMax + sqlite3_int64 *pnMax ){ sqlite3_stmt *pStmt; int rc; @@ -2253,12 +2279,12 @@ static int fts3SegmentMaxLevel( */ rc = fts3SqlStmt(p, SQL_SELECT_SEGDIR_MAX_LEVEL, &pStmt, 0); if( rc!=SQLITE_OK ) return rc; - sqlite3_bind_int(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex, 0)); - sqlite3_bind_int(pStmt, 2, + sqlite3_bind_int64(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex, 0)); + sqlite3_bind_int64(pStmt, 2, getAbsoluteLevel(p, iLangid, iIndex, FTS3_SEGDIR_MAXLEVEL-1) ); if( SQLITE_ROW==sqlite3_step(pStmt) ){ - *pnMax = sqlite3_column_int(pStmt, 0); + *pnMax = sqlite3_column_int64(pStmt, 0); } return sqlite3_reset(pStmt); } @@ -2307,15 +2333,17 @@ static int fts3DeleteSegdir( if( iLevel==FTS3_SEGCURSOR_ALL ){ rc = fts3SqlStmt(p, SQL_DELETE_SEGDIR_RANGE, &pDelete, 0); if( rc==SQLITE_OK ){ - sqlite3_bind_int(pDelete, 1, getAbsoluteLevel(p, iLangid, iIndex, 0)); - sqlite3_bind_int(pDelete, 2, + sqlite3_bind_int64(pDelete, 1, getAbsoluteLevel(p, iLangid, iIndex, 0)); + sqlite3_bind_int64(pDelete, 2, getAbsoluteLevel(p, iLangid, iIndex, FTS3_SEGDIR_MAXLEVEL-1) ); } }else{ rc = fts3SqlStmt(p, SQL_DELETE_SEGDIR_LEVEL, &pDelete, 0); if( rc==SQLITE_OK ){ - sqlite3_bind_int(pDelete, 1, getAbsoluteLevel(p, iLangid, iIndex,iLevel)); + sqlite3_bind_int64( + pDelete, 1, getAbsoluteLevel(p, iLangid, iIndex, iLevel) + ); } } @@ -2792,7 +2820,7 @@ static int fts3SegmentMerge( ){ int rc; /* Return code */ int iIdx = 0; /* Index of new segment */ - int iNewLevel = 0; /* Level/index to create new segment at */ + sqlite3_int64 iNewLevel = 0; /* Level/index to create new segment at */ SegmentWriter *pWriter = 0; /* Used to write the new, merged, segment */ Fts3SegFilter filter; /* Segment term filter condition */ Fts3MultiSegReader csr; /* Cursor to iterate through level(s) */ diff --git a/manifest b/manifest index 839b111215..4f001824a3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sharmless\scompiler\swarnings. -D 2012-03-16T00:28:11.282 +C Cherrypick\sthe\s[3475092cff]\sfix\sfor\s32-bit\soverflow\swith\slarge\slanguage-ids\ninto\strunk. +D 2012-03-16T16:52:54.032 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -78,7 +78,7 @@ F ext/fts3/fts3_test.c 6b7cc68aef4efb084e1449f7d20c4b20d3bdf6b4 F ext/fts3/fts3_tokenizer.c 3da7254a9881f7e270ab28e2004e0d22b3212bce F ext/fts3/fts3_tokenizer.h 66dec98e365854b6cd2d54f1a96bb6d428fc5a68 F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004 -F ext/fts3/fts3_write.c f87bb2d27d31cb7a7bf306747079095393c9d073 +F ext/fts3/fts3_write.c 8eedfeb2e61114cfd94fd1d917daf3658203332c F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9 F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100 F ext/icu/README.txt bf8461d8cdc6b8f514c080e4e10dc3b2bbdfefa9 @@ -496,7 +496,7 @@ F test/fts3snippet.test 8e956051221a34c7daeb504f023cb54d5fa5a8b2 F test/fts3sort.test 95be0b19d7e41c44b29014f13ea8bddd495fd659 F test/fts4aa.test 6e7f90420b837b2c685f3bcbe84c868492d40a68 F test/fts4content.test 17b2360f7d1a9a7e5aa8022783f5c5731b6dfd4f -F test/fts4langid.test fabdd5a8db0fa00292e0704809f566e3fb6dba3a +F test/fts4langid.test 2081c357bb6f170f34ef8e08c6abb88002b95c69 F test/func.test 6c5ce11e3a0021ca3c0649234e2d4454c89110ca F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f F test/func3.test 001021e5b88bd02a3b365a5c5fd8f6f49d39744a @@ -992,7 +992,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 -P fed134a5f395533de0c9d76950697c060ddb126d -R 9a71f3ab5326ee35b9bbd87536e2a1d5 +P 74eadeec34c4b19cf5f8b7f648db3b7ad601a00e +R da59c6040c440e1d087c29c77d94171a U drh -Z 60cd8a049ba54606f3a162ca33790b57 +Z 86f53efe49c877ef67da98d4e974121b diff --git a/manifest.uuid b/manifest.uuid index 9a63bfc3a0..3b6c5ce27f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -74eadeec34c4b19cf5f8b7f648db3b7ad601a00e \ No newline at end of file +2755edc7f1186ba8955f2c3550a90f40a55ddae2 \ No newline at end of file diff --git a/test/fts4langid.test b/test/fts4langid.test index 08f1a21c17..8ad06766b7 100644 --- a/test/fts4langid.test +++ b/test/fts4langid.test @@ -382,4 +382,105 @@ do_catchsql_test 4.1.5 { INSERT INTO t4(content, lid) VALUES('hello world', 101) } {1 {SQL logic error or missing database}} +#------------------------------------------------------------------------- +# Test cases 5.* +# +# The following test cases are designed to detect a 32-bit overflow bug +# that existed at one point. +# +proc build_multilingual_db_3 {db} { + $db eval { + CREATE VIRTUAL TABLE t5 USING fts4(languageid=lid); + } + set languages [list 0 1 2 [expr 1<<30]] + + foreach lid $languages { + execsql { + INSERT INTO t5(docid, content, lid) VALUES( + $lid, 'My language is ' || $lid, $lid + ) + } + } +} + +do_test 5.1.0 { + reset_db + build_multilingual_db_3 db +} {} + +do_execsql_test 5.1.1 { + SELECT level FROM t5_segdir; +} [list 0 1024 2048 [expr 1<<40]] + +do_execsql_test 5.1.2 {SELECT docid FROM t5 WHERE t5 MATCH 'language'} 0 +foreach langid [list 0 1 2 [expr 1<<30]] { + do_execsql_test 5.2.$langid { + SELECT docid FROM t5 WHERE t5 MATCH 'language' AND lid = $langid + } $langid +} + +set lid [expr 1<<30] +do_execsql_test 5.3.1 { + CREATE VIRTUAL TABLE t6 USING fts4(languageid=lid); + INSERT INTO t6 VALUES('I belong to language 0!'); +} +do_test 5.3.2 { + for {set i 0} {$i < 20} {incr i} { + execsql { + INSERT INTO t6(content, lid) VALUES( + 'I (row '||$i||') belong to langauge N!', $lid + ); + } + } + execsql { SELECT docid FROM t6 WHERE t6 MATCH 'belong' } +} {1} + +do_test 5.3.3 { + execsql { SELECT docid FROM t6 WHERE t6 MATCH 'belong' AND lid=$lid} +} {2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21} + +do_execsql_test 5.3.4 { INSERT INTO t6(t6) VALUES('optimize') } {} +do_execsql_test 5.3.5 { SELECT docid FROM t6 WHERE t6 MATCH 'belong' } {1} +do_execsql_test 5.3.6 { + SELECT docid FROM t6 WHERE t6 MATCH 'belong' AND lid=$lid +} {2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21} + + +set lid [expr 1<<30] +foreach lid [list 4 [expr 1<<30]] { + do_execsql_test 5.4.$lid.1 { + DELETE FROM t6; + SELECT count(*) FROM t6_segdir; + SELECT count(*) FROM t6_segments; + } {0 0} + do_execsql_test 5.4.$lid.2 { + INSERT INTO t6(content, lid) VALUES('zero zero zero', $lid); + INSERT INTO t6(content, lid) VALUES('zero zero one', $lid); + INSERT INTO t6(content, lid) VALUES('zero one zero', $lid); + INSERT INTO t6(content, lid) VALUES('zero one one', $lid); + INSERT INTO t6(content, lid) VALUES('one zero zero', $lid); + INSERT INTO t6(content, lid) VALUES('one zero one', $lid); + INSERT INTO t6(content, lid) VALUES('one one zero', $lid); + INSERT INTO t6(content, lid) VALUES('one one one', $lid); + + SELECT docid FROM t6 WHERE t6 MATCH '"zero zero"' AND lid=$lid; + } {1 2 5} + + do_execsql_test 5.4.$lid.3 { + SELECT count(*) FROM t6_segdir; + SELECT count(*) FROM t6_segments; + } {8 0} + + do_execsql_test 5.4.$lid.4 { + INSERT INTO t6(t6) VALUES('optimize'); + SELECT docid FROM t6 WHERE t6 MATCH '"zero zero"' AND lid=$lid; + } {1 2 5} + + do_execsql_test 5.4.$lid.5 { + SELECT count(*) FROM t6_segdir; + SELECT count(*) FROM t6_segments; + } {1 0} +} + + finish_test From 1a342a4a73fa77abd61064f11893041ed38f61f1 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 16 Mar 2012 17:00:49 +0000 Subject: [PATCH 08/11] Update the trace2.test script for languageid. FossilOrigin-Name: a11528ac575fa20fd8022756d042a32fe1272e12 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/trace2.test | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 4f001824a3..c4d9e8ea38 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Cherrypick\sthe\s[3475092cff]\sfix\sfor\s32-bit\soverflow\swith\slarge\slanguage-ids\ninto\strunk. -D 2012-03-16T16:52:54.032 +C Update\sthe\strace2.test\sscript\sfor\slanguageid. +D 2012-03-16T17:00:49.764 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -855,7 +855,7 @@ F test/tkt3997.test a335fa41ca3985660a139df7b734a26ef53284bd F test/tkt4018.test 7c2c9ba4df489c676a0a7a0e809a1fb9b2185bd1 F test/tokenize.test ce430a7aed48fc98301611429595883fdfcab5d7 F test/trace.test 4b36a41a3e9c7842151af6da5998f5080cdad9e5 -F test/trace2.test 962175290996d5f06dc4402ca218bbfc7df4cb20 +F test/trace2.test 37c3a05701e7f133ebdf078a61aa9479a23a73b0 F test/trans.test 6e1b4c6a42dba31bd65f8fa5e61a2708e08ddde6 F test/trans2.test d5337e61de45e66b1fcbf9db833fa8c82e624b22 F test/trans3.test 373ac5183cc56be69f48ae44090e7f672939f732 @@ -992,7 +992,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 -P 74eadeec34c4b19cf5f8b7f648db3b7ad601a00e -R da59c6040c440e1d087c29c77d94171a +P 2755edc7f1186ba8955f2c3550a90f40a55ddae2 +R ec577cf791cfb44b791ae9dc3e0f7343 U drh -Z 86f53efe49c877ef67da98d4e974121b +Z d80fb6c4fb859b25e151c85bda23f682 diff --git a/manifest.uuid b/manifest.uuid index 3b6c5ce27f..8412294df1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2755edc7f1186ba8955f2c3550a90f40a55ddae2 \ No newline at end of file +a11528ac575fa20fd8022756d042a32fe1272e12 \ No newline at end of file diff --git a/test/trace2.test b/test/trace2.test index 42738db3aa..0e3130ec00 100644 --- a/test/trace2.test +++ b/test/trace2.test @@ -141,6 +141,7 @@ ifcapable fts3 { INSERT INTO x1(x1) VALUES('optimize'); } { "INSERT INTO x1(x1) VALUES('optimize');" + "-- SELECT DISTINCT level / (1024 * ?) FROM 'main'.'x1_segdir'" "-- SELECT idx, start_block, leaves_end_block, end_block, root FROM 'main'.'x1_segdir' WHERE level BETWEEN ? AND ?ORDER BY level DESC, idx ASC" "-- SELECT max(level) FROM 'main'.'x1_segdir' WHERE level BETWEEN ? AND ?" "-- SELECT coalesce((SELECT max(blockid) FROM 'main'.'x1_segments') + 1, 1)" From a2e85abaa293d86408fc07300b3b5cc8341d8e0e Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 17 Mar 2012 09:43:09 +0000 Subject: [PATCH 09/11] Modify a test in ioerr2.test to account for the new SQLITE_ABORT_ROLLBACK extended error code. FossilOrigin-Name: affaebde109e8dd851474ffe7b7d48b1aae8c7ed --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/ioerr2.test | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index c4d9e8ea38..2aba70d878 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sthe\strace2.test\sscript\sfor\slanguageid. -D 2012-03-16T17:00:49.764 +C Modify\sa\stest\sin\sioerr2.test\sto\saccount\sfor\sthe\snew\sSQLITE_ABORT_ROLLBACK\sextended\serror\scode. +D 2012-03-17T09:43:09.270 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -538,7 +538,7 @@ F test/interrupt.test 42e7cf98646fd9cb4a3b131a93ed3c50b9e149f1 F test/intpkey.test 537669fd535f62632ca64828e435b9e54e8d677f F test/io.test b278aa8fa609ed0dcc825df31b2d9f526c5a52bd F test/ioerr.test 40bb2cfcab63fb6aa7424cd97812a84bc16b5fb8 -F test/ioerr2.test 1b56cb80d5b0726ee3ba325ca175734541e32955 +F test/ioerr2.test 9d71166f8466eda510f1af6137bdabaa82b5408d F test/ioerr3.test d3cec5e1a11ad6d27527d0d38573fbff14c71bdd F test/ioerr4.test f130fe9e71008577b342b8874d52984bd04ede2c F test/ioerr5.test 2edfa4fb0f896f733071303b42224df8bedd9da4 @@ -992,7 +992,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 -P 2755edc7f1186ba8955f2c3550a90f40a55ddae2 -R ec577cf791cfb44b791ae9dc3e0f7343 -U drh -Z d80fb6c4fb859b25e151c85bda23f682 +P a11528ac575fa20fd8022756d042a32fe1272e12 +R bf459f233481ca6a2e168e0f56c2e565 +U dan +Z da996c893d138c803cabbc3bbda32cec diff --git a/manifest.uuid b/manifest.uuid index 8412294df1..c800cbab77 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a11528ac575fa20fd8022756d042a32fe1272e12 \ No newline at end of file +affaebde109e8dd851474ffe7b7d48b1aae8c7ed \ No newline at end of file diff --git a/test/ioerr2.test b/test/ioerr2.test index 325c0baded..5150ace3ab 100644 --- a/test/ioerr2.test +++ b/test/ioerr2.test @@ -130,7 +130,7 @@ do_test ioerr2-5 { } } msg] list $rc $msg -} {1 {callback requested query abort}} +} {1 {abort due to ROLLBACK}} if {$::tcl_platform(platform) == "unix"} { # Cause the call to xAccess used by [pragma temp_store_directory] to From db0ad5f204f0358f298c87d7cd4b8eac73412580 Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 17 Mar 2012 15:12:16 +0000 Subject: [PATCH 10/11] In pager1.test, use "file attr test.db -readonly 0" before "file attr test.db -perm rw-rw-rw-", not after. FossilOrigin-Name: 4f5283f18f570a09b95c26e5aa14885ada518dd2 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/pager1.test | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 2aba70d878..520e3fc8a7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Modify\sa\stest\sin\sioerr2.test\sto\saccount\sfor\sthe\snew\sSQLITE_ABORT_ROLLBACK\sextended\serror\scode. -D 2012-03-17T09:43:09.270 +C In\spager1.test,\suse\s"file\sattr\stest.db\s-readonly\s0"\sbefore\s"file\sattr\stest.db\s-perm\srw-rw-rw-",\snot\safter. +D 2012-03-17T15:12:16.594 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -625,7 +625,7 @@ F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347 F test/null.test a8b09b8ed87852742343b33441a9240022108993 F test/openv2.test 0d3040974bf402e19b7df4b783e447289d7ab394 F test/oserror.test 50417780d0e0d7cd23cf12a8277bb44024765df3 -F test/pager1.test 6e43e79d6ac1fc31b494ff3a0b56445b7eda5d2b +F test/pager1.test cf8f40cf77b5c4f762b1e8492390d61b46a81623 F test/pager2.test 745b911dde3d1f24ae0870bd433dfa83d7c658c1 F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f F test/pagerfault.test 452f2cc23e3bfcfa935f4442aec1da4fe1dc0442 @@ -992,7 +992,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 -P a11528ac575fa20fd8022756d042a32fe1272e12 -R bf459f233481ca6a2e168e0f56c2e565 +P affaebde109e8dd851474ffe7b7d48b1aae8c7ed +R c4a04a92e8486010645a44f1a08a5af3 U dan -Z da996c893d138c803cabbc3bbda32cec +Z 7e2f94cd0ef8dfee62915c8ab2714a0c diff --git a/manifest.uuid b/manifest.uuid index c800cbab77..cef18d967d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -affaebde109e8dd851474ffe7b7d48b1aae8c7ed \ No newline at end of file +4f5283f18f570a09b95c26e5aa14885ada518dd2 \ No newline at end of file diff --git a/test/pager1.test b/test/pager1.test index 96fcb5ba0e..45253857c3 100644 --- a/test/pager1.test +++ b/test/pager1.test @@ -899,8 +899,8 @@ do_test pager1.4.8.2 { } {-1} do_test pager1.4.8.3 { db close - catch {file attributes test.db -permissions rw-rw-rw-} catch {file attributes test.db -readonly 0} + catch {file attributes test.db -permissions rw-rw-rw-} msg sqlite3 db test.db db eval { SELECT * FROM t1 } sqlite3_db_readonly db main From 0d1614c731704f98943eb8aa34edf615532a6b4a Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 19 Mar 2012 10:21:37 +0000 Subject: [PATCH 11/11] Ensure that compatible malloc and free functions are used with stat3 data if SQLITE_ENABLE_STAT3 is defined. FossilOrigin-Name: 32bb1ecee4e43a4683512dbca047abf735afd313 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/analyze.c | 8 ++++++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 520e3fc8a7..179517c1c1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\spager1.test,\suse\s"file\sattr\stest.db\s-readonly\s0"\sbefore\s"file\sattr\stest.db\s-perm\srw-rw-rw-",\snot\safter. -D 2012-03-17T15:12:16.594 +C Ensure\sthat\scompatible\smalloc\sand\sfree\sfunctions\sare\sused\swith\sstat3\sdata\sif\sSQLITE_ENABLE_STAT3\sis\sdefined. +D 2012-03-19T10:21:37.927 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -119,7 +119,7 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc F sqlite3.pc.in ae6f59a76e862f5c561eb32a380228a02afc3cad F src/alter.c 149cc80d9257971b0bff34e58fb2263e01998289 -F src/analyze.c f32ff304da413851eefa562b04e61ff6cb88248b +F src/analyze.c 70c46504c0d2543ea5cdca01140b2cd3e1d886e7 F src/attach.c 12c6957996908edc31c96d7c68d4942c2474405f F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34 F src/backup.c 6be23a344d3301ae38e92fddb3a33b91c309fce4 @@ -992,7 +992,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 -P affaebde109e8dd851474ffe7b7d48b1aae8c7ed -R c4a04a92e8486010645a44f1a08a5af3 +P 4f5283f18f570a09b95c26e5aa14885ada518dd2 +R 86b82af92d1239c76d6157fdd039db02 U dan -Z 7e2f94cd0ef8dfee62915c8ab2714a0c +Z fc0fdf7e77db24e47eb9fd009ed1d240 diff --git a/manifest.uuid b/manifest.uuid index cef18d967d..41bdf79e8d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4f5283f18f570a09b95c26e5aa14885ada518dd2 \ No newline at end of file +32bb1ecee4e43a4683512dbca047abf735afd313 \ No newline at end of file diff --git a/src/analyze.c b/src/analyze.c index cbfdc8587e..4dfc331bef 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -932,6 +932,7 @@ static int loadStat3(sqlite3 *db, const char *zDb){ int eType; /* Datatype of a sample */ IndexSample *pSample; /* A slot in pIdx->aSample[] */ + assert( db->lookaside.bEnabled==0 ); if( !sqlite3FindTable(db, "sqlite_stat3", zDb) ){ return SQLITE_OK; } @@ -958,7 +959,7 @@ static int loadStat3(sqlite3 *db, const char *zDb){ if( pIdx==0 ) continue; assert( pIdx->nSample==0 ); pIdx->nSample = nSample; - pIdx->aSample = sqlite3MallocZero( nSample*sizeof(IndexSample) ); + pIdx->aSample = sqlite3DbMallocZero(db, nSample*sizeof(IndexSample)); pIdx->avgEq = pIdx->aiRowEst[1]; if( pIdx->aSample==0 ){ db->mallocFailed = 1; @@ -1031,7 +1032,7 @@ static int loadStat3(sqlite3 *db, const char *zDb){ if( n < 1){ pSample->u.z = 0; }else{ - pSample->u.z = sqlite3Malloc(n); + pSample->u.z = sqlite3DbMallocRaw(db, n); if( pSample->u.z==0 ){ db->mallocFailed = 1; sqlite3_finalize(pStmt); @@ -1107,7 +1108,10 @@ int sqlite3AnalysisLoad(sqlite3 *db, int iDb){ /* Load the statistics from the sqlite_stat3 table. */ #ifdef SQLITE_ENABLE_STAT3 if( rc==SQLITE_OK ){ + int lookasideEnabled = db->lookaside.bEnabled; + db->lookaside.bEnabled = 0; rc = loadStat3(db, sInfo.zDatabase); + db->lookaside.bEnabled = lookasideEnabled; } #endif