From 7c5d8fb7303c895ac8cc2b8ecbb53079de6c7fc7 Mon Sep 17 00:00:00 2001 From: shaneh Date: Wed, 22 Jun 2011 14:21:31 +0000 Subject: [PATCH 1/8] Add a flush of stdout so some test code reading from a command pipe works correctly on Windows. FossilOrigin-Name: 6705f21effaa2f72dc5e17e888d679b8d35c2c3a --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/test1.c | 5 +++++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index bb6eff7db1..ab5444fc1d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\sa\stest\scase\sin\stypes3.test\sslightly\sso\sthat\sit\sworks\swith\sthe\slatest\sversions\sof\sTcl. -D 2011-06-22T10:56:54.742 +C Add\sa\sflush\sof\sstdout\sso\ssome\stest\scode\sreading\sfrom\sa\scommand\spipe\sworks\scorrectly\son\sWindows. +D 2011-06-22T14:21:31.932 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -188,7 +188,7 @@ F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 7ac64842c86cec2fc1a1d0e5c16d3beb8ad332bf F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e F src/tclsqlite.c 5db825be61708b1a2b3f8f6e185e9b753829acef -F src/test1.c ce2fab9e36932f5771c35291539366c9af229df3 +F src/test1.c 669b8fde7f3c72250d59fef1adda5e040f7baae0 F src/test2.c 80d323d11e909cf0eb1b6fbb4ac22276483bcf31 F src/test3.c 124ff9735fb6bb7d41de180d6bac90e7b1509432 F src/test4.c d1e5a5e904d4b444cf572391fdcb017638e36ff7 @@ -948,7 +948,7 @@ F tool/symbols.sh bc2a3709940d47c8ac8e0a1fdf17ec801f015a00 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 347d974d143cf132f953b565fbc03026f19fcb4d -P 065e5a5ea4f82f0d3fbb2e80d3a977af96c95683 -R bb24e8ea6743b27a72518b27f4017512 -U dan -Z 83a2b05b96f2ad1cc32e9a94b3d4ad63 +P 6e1f4df51ad32e36715cba16f9df0d17a08dc653 +R f419aa12fb8154184260ed77fe4da08c +U shaneh +Z 359a9455871f477fa2aa903e2701f33c diff --git a/manifest.uuid b/manifest.uuid index 9ca9b68227..4799754faa 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6e1f4df51ad32e36715cba16f9df0d17a08dc653 \ No newline at end of file +6705f21effaa2f72dc5e17e888d679b8d35c2c3a \ No newline at end of file diff --git a/src/test1.c b/src/test1.c index dbe9dd3aee..acb6d67d7a 100644 --- a/src/test1.c +++ b/src/test1.c @@ -5517,6 +5517,11 @@ static int test_print_eqp( } if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR; rc = printExplainQueryPlan(pStmt); + /* This is needed on Windows so that a test case using this + ** function can open a read pipe and get the output of + ** printExplainQueryPlan() immediately. + */ + fflush(stdout); Tcl_SetResult(interp, (char *)t1ErrorName(rc), 0); return TCL_OK; } From f9032cbc2d78d78064809157c23ff9174cfc2c81 Mon Sep 17 00:00:00 2001 From: shaneh Date: Wed, 22 Jun 2011 14:43:59 +0000 Subject: [PATCH 2/8] Adjust a test case in triggerC.test to handle non-default SQLITE_MAX_TRIGGER_DEPTH settings. FossilOrigin-Name: f14339c54bdeabc68c1e05b2c63ee95226f184e0 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/triggerC.test | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index ab5444fc1d..57f92c9756 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\sflush\sof\sstdout\sso\ssome\stest\scode\sreading\sfrom\sa\scommand\spipe\sworks\scorrectly\son\sWindows. -D 2011-06-22T14:21:31.932 +C Adjust\sa\stest\scase\sin\striggerC.test\sto\shandle\snon-default\sSQLITE_MAX_TRIGGER_DEPTH\ssettings. +D 2011-06-22T14:43:59.375 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -838,7 +838,7 @@ F test/trigger8.test 30cb0530bd7c4728055420e3f739aa00412eafa4 F test/trigger9.test 5b0789f1c5c4600961f8e68511b825b87be53e31 F test/triggerA.test eaf11a29db2a11967d2d4b49d37f92bce598194e F test/triggerB.test 56780c031b454abac2340dbb3b71ac5c56c3d7fe -F test/triggerC.test 811ab569af9e6fc894afbcc0d77d14500b2406c5 +F test/triggerC.test 02c690febf608ae20b9af86184a9867f79855b1d F test/triggerD.test c6add3817351451e419f6ff9e9a259b02b6e2de7 F test/tt3_checkpoint.c 415eccce672d681b297485fc20f44cdf0eac93af F test/types.test bf816ce73c7dfcfe26b700c19f97ef4050d194ff @@ -948,7 +948,7 @@ F tool/symbols.sh bc2a3709940d47c8ac8e0a1fdf17ec801f015a00 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 347d974d143cf132f953b565fbc03026f19fcb4d -P 6e1f4df51ad32e36715cba16f9df0d17a08dc653 -R f419aa12fb8154184260ed77fe4da08c +P 6705f21effaa2f72dc5e17e888d679b8d35c2c3a +R 87da11704e690d7cf704bfee15761e8a U shaneh -Z 359a9455871f477fa2aa903e2701f33c +Z 7c44dac3b62246a10bc140e2fc2fcdfe diff --git a/manifest.uuid b/manifest.uuid index 4799754faa..5bee5deb53 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6705f21effaa2f72dc5e17e888d679b8d35c2c3a \ No newline at end of file +f14339c54bdeabc68c1e05b2c63ee95226f184e0 \ No newline at end of file diff --git a/test/triggerC.test b/test/triggerC.test index a54aa62fae..e5a492a412 100644 --- a/test/triggerC.test +++ b/test/triggerC.test @@ -228,22 +228,22 @@ foreach {n tdefn rc} { } do_test triggerC-2.2 { - execsql { + execsql " CREATE TABLE t22(x); CREATE TRIGGER t22a AFTER INSERT ON t22 BEGIN INSERT INTO t22 SELECT x + (SELECT max(x) FROM t22) FROM t22; END; CREATE TRIGGER t22b BEFORE INSERT ON t22 BEGIN - SELECT CASE WHEN (SELECT count(*) FROM t22) >= 100 + SELECT CASE WHEN (SELECT count(*) FROM t22) >= [expr $SQLITE_MAX_TRIGGER_DEPTH / 2] THEN RAISE(IGNORE) ELSE NULL END; END; INSERT INTO t22 VALUES(1); SELECT count(*) FROM t22; - } -} {100} + " +} [list [expr $SQLITE_MAX_TRIGGER_DEPTH / 2]] do_test triggerC-2.3 { execsql " From 843ee82a30b3e3995949cc7d91a87ecf4336cbd2 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 22 Jun 2011 15:21:48 +0000 Subject: [PATCH 3/8] Print a warning in oserror-1.1.1 that a valgrind warning might occur but that it is benign. FossilOrigin-Name: 13e96376e11d71d203f7b67c12272e8762200876 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/oserror.test | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 57f92c9756..5ea54e5a81 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Adjust\sa\stest\scase\sin\striggerC.test\sto\shandle\snon-default\sSQLITE_MAX_TRIGGER_DEPTH\ssettings. -D 2011-06-22T14:43:59.375 +C Print\sa\swarning\sin\soserror-1.1.1\sthat\sa\svalgrind\swarning\smight\soccur\sbut\sthat\nit\sis\sbenign. +D 2011-06-22T15:21:48.838 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -604,7 +604,7 @@ F test/notify3.test d60923e186e0900f4812a845fcdfd8eea096e33a F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347 F test/null.test a8b09b8ed87852742343b33441a9240022108993 F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec -F test/oserror.test 498d8337e9d15543eb7b004fef8594bf204ff43c +F test/oserror.test 3fe52e0bd2891a9bf7cdeb639554992453d46301 F test/pager1.test 228a831060dab96bc91b03ba2a85cedefd1ab38a F test/pager2.test 745b911dde3d1f24ae0870bd433dfa83d7c658c1 F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f @@ -948,7 +948,7 @@ F tool/symbols.sh bc2a3709940d47c8ac8e0a1fdf17ec801f015a00 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 347d974d143cf132f953b565fbc03026f19fcb4d -P 6705f21effaa2f72dc5e17e888d679b8d35c2c3a -R 87da11704e690d7cf704bfee15761e8a -U shaneh -Z 7c44dac3b62246a10bc140e2fc2fcdfe +P f14339c54bdeabc68c1e05b2c63ee95226f184e0 +R 890c7962dd3d85c2a0f6fce86cc02c53 +U drh +Z c9a73b92d17c2dd3d2a6771a3a00914f diff --git a/manifest.uuid b/manifest.uuid index 5bee5deb53..676789b6a2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f14339c54bdeabc68c1e05b2c63ee95226f184e0 \ No newline at end of file +13e96376e11d71d203f7b67c12272e8762200876 \ No newline at end of file diff --git a/test/oserror.test b/test/oserror.test index 2d3a24a8f5..bdeb868425 100644 --- a/test/oserror.test +++ b/test/oserror.test @@ -51,6 +51,7 @@ proc do_re_test {tn script expression} { # a call to getcwd() may fail if there are no free file descriptors. So # an error may be reported for either open() or getcwd() here. # +puts "Possible valgrind error about invalid file descriptor follows:" do_test 1.1.1 { set ::log [list] list [catch { From 68e528ff45252fff36614b9d72ee86f79026c81b Mon Sep 17 00:00:00 2001 From: shaneh Date: Wed, 22 Jun 2011 15:40:19 +0000 Subject: [PATCH 4/8] Update a test case for Windows that failed because of size_hint implementation differences. FossilOrigin-Name: f853fa63c357b78f93e553eb81cd79d4c3e06850 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/wal5.test | 9 ++++++++- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 5ea54e5a81..3612534c1f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Print\sa\swarning\sin\soserror-1.1.1\sthat\sa\svalgrind\swarning\smight\soccur\sbut\sthat\nit\sis\sbenign. -D 2011-06-22T15:21:48.838 +C Update\sa\stest\scase\sfor\sWindows\sthat\sfailed\sbecause\sof\ssize_hint\simplementation\sdifferences. +D 2011-06-22T15:40:19.354 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -878,7 +878,7 @@ F test/wal.test 5617ad308bfdb8a8885220d8a261a6096a8d7e57 F test/wal2.test aa0fb2314b3235be4503c06873e41ebfc0757782 F test/wal3.test 5c396cc22497244d627306f4c1d360167353f8dd F test/wal4.test 3404b048fa5e10605facaf70384e6d2943412e30 -F test/wal5.test 1bbfaa316dc2a1d0d1fac3f4500c38a90055a41b +F test/wal5.test f06a0427e06db00347e32eb9fa99d6a5c0f2d088 F test/wal6.test 07aa31ca8892d0527f2c5c5a9a2a87aa421dfaa8 F test/wal7.test 2ae8f427d240099cc4b2dfef63cff44e2a68a1bd F test/wal_common.tcl a98f17fba96206122eff624db0ab13ec377be4fe @@ -948,7 +948,7 @@ F tool/symbols.sh bc2a3709940d47c8ac8e0a1fdf17ec801f015a00 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 347d974d143cf132f953b565fbc03026f19fcb4d -P f14339c54bdeabc68c1e05b2c63ee95226f184e0 -R 890c7962dd3d85c2a0f6fce86cc02c53 -U drh -Z c9a73b92d17c2dd3d2a6771a3a00914f +P 13e96376e11d71d203f7b67c12272e8762200876 +R 0f9edd221a28a4b18bfff2393e67da75 +U shaneh +Z 89c72c5e482a74abfd113068f7363d86 diff --git a/manifest.uuid b/manifest.uuid index 676789b6a2..65bfddf103 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -13e96376e11d71d203f7b67c12272e8762200876 \ No newline at end of file +f853fa63c357b78f93e553eb81cd79d4c3e06850 \ No newline at end of file diff --git a/test/wal5.test b/test/wal5.test index ad6bcfc7d8..0c700dfc50 100644 --- a/test/wal5.test +++ b/test/wal5.test @@ -235,7 +235,14 @@ foreach {testprefix do_wal_checkpoint} { do_test 2.3.$tn.5 { sql1 { INSERT INTO t2 VALUES(3, 4) } } {} do_test 2.3.$tn.6 { file_page_counts } {1 7 1 7} do_test 2.3.$tn.7 { code1 { do_wal_checkpoint db -mode full } } {1 7 5} - do_test 2.3.$tn.8 { file_page_counts } {1 7 2 7} + if {$tcl_platform(platform) == "windows"} { + # on unix, the size_hint is a no-op if no chunk size is set. + # the windows implementation does not have a similar check, + # and because of this, the db file size has an extra page. + do_test 2.3.$tn.8 { file_page_counts } {2 7 2 7} + } { + do_test 2.3.$tn.8 { file_page_counts } {1 7 2 7} + } } # Check that checkpoints block on the correct locks. And respond correctly From 5e0855c6a1151c5787c829194591657b583c9800 Mon Sep 17 00:00:00 2001 From: shaneh Date: Wed, 22 Jun 2011 20:14:09 +0000 Subject: [PATCH 5/8] Added limited support to omittest.tcl for nmake makefile. FossilOrigin-Name: f5f46dc7b8c23e77fd1ff792b7d0cf070de47ca3 --- manifest | 12 ++++++------ manifest.uuid | 2 +- tool/omittest.tcl | 22 ++++++++++++++-------- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/manifest b/manifest index 3612534c1f..72883e03d5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sa\stest\scase\sfor\sWindows\sthat\sfailed\sbecause\sof\ssize_hint\simplementation\sdifferences. -D 2011-06-22T15:40:19.354 +C Added\slimited\ssupport\sto\somittest.tcl\sfor\snmake\smakefile. +D 2011-06-22T20:14:09.429 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -923,7 +923,7 @@ F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 F tool/mksqlite3c.tcl 1fa0ed9cfdc768bf5de7e65fda8d97a46dd2a7e6 F tool/mksqlite3h.tcl 78013ad79a5e492e5f764f3c7a8ef834255061f8 F tool/mksqlite3internalh.tcl 7b43894e21bcb1bb39e11547ce7e38a063357e87 -F tool/omittest.tcl b1dd290c1596e0f31fd335160a74ec5dfea3df4a +F tool/omittest.tcl 8086c014cbae90f1f2b564d59d05a5e4ac1783c9 F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c F tool/restore_jrnl.tcl 6957a34f8f1f0f8285e07536225ec3b292a9024a F tool/rollback-test.c 9fc98427d1e23e84429d7e6d07d9094fbdec65a5 @@ -948,7 +948,7 @@ F tool/symbols.sh bc2a3709940d47c8ac8e0a1fdf17ec801f015a00 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 347d974d143cf132f953b565fbc03026f19fcb4d -P 13e96376e11d71d203f7b67c12272e8762200876 -R 0f9edd221a28a4b18bfff2393e67da75 +P f853fa63c357b78f93e553eb81cd79d4c3e06850 +R ddc3e17983db538a7697328fd62bb1d7 U shaneh -Z 89c72c5e482a74abfd113068f7363d86 +Z 53ee1769a28d0b67b6ec5c95bb5607ec diff --git a/manifest.uuid b/manifest.uuid index 65bfddf103..467483d7d7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f853fa63c357b78f93e553eb81cd79d4c3e06850 \ No newline at end of file +f5f46dc7b8c23e77fd1ff792b7d0cf070de47ca3 \ No newline at end of file diff --git a/tool/omittest.tcl b/tool/omittest.tcl index f1963ff13d..33a71cee26 100644 --- a/tool/omittest.tcl +++ b/tool/omittest.tcl @@ -31,8 +31,8 @@ should work. The following properties are required: More precisely, the following two invocations must be supported: - make -f $::MAKEFILE testfixture OPTS="-DSQLITE_OMIT_ALTERTABLE=1" - make -f $::MAKEFILE test + $::MAKEBIN -f $::MAKEFILE testfixture OPTS="-DSQLITE_OMIT_ALTERTABLE=1" + $::MAKEBIN -f $::MAKEFILE test Makefiles generated by the sqlite configure program cannot be used as they do not respect the OPTS variable. @@ -73,7 +73,7 @@ catch { file copy -force ./libtool $dir } set rc [catch { - exec make -C $dir -f $::MAKEFILE $target OPTS=$opts >& $dir/build.log + exec $::MAKEBIN -C $dir -f $::MAKEFILE clean $target OPTS=$opts >& $dir/build.log }] if {$rc} { puts "No good. See $dir/build.log." @@ -102,7 +102,7 @@ catch { puts -nonewline "Testing $dir..." flush stdout set rc [catch { - exec make -C $dir -f $::MAKEFILE test OPTS=$opts >& $dir/test.log + exec $::MAKEBIN -C $dir -f $::MAKEFILE test OPTS=$opts >& $dir/test.log }] if {$rc} { puts "No good. See $dir/test.log." @@ -119,8 +119,9 @@ catch { # option. # proc process_options {argv} { + set ::MAKEBIN make ;# Default value if {$::tcl_platform(platform)=="windows" || $::tcl_platform(platform)=="os2"} { - set ::MAKEFILE ./Makefile ;# Default value + set ::MAKEFILE ./Makefile ;# Default value on Windows and OS2 } else { set ::MAKEFILE ./Makefile.linux-gcc ;# Default value } @@ -133,6 +134,11 @@ proc process_options {argv} { set ::MAKEFILE [lindex $argv $i] } + -nmake { + set ::MAKEBIN nmake + set ::MAKEFILE ./Makefile.msc + } + -skip_run { set ::SKIP_RUN 1 } @@ -251,7 +257,7 @@ proc main {argv} { exit -1 } - set dirname "test_[string range $sym 7 end]" + set dirname "test_[regsub -nocase {^x*SQLITE_} $sym {}]" run_quick_test $dirname $sym } else { # First try a test with all OMIT symbols except SQLITE_OMIT_FLOATING_POINT @@ -270,14 +276,14 @@ proc main {argv} { # are the OMIT_FLOATING_POINT and OMIT_PRAGMA symbols, even though we # know they will fail. It's good to be reminded of this from time to time. foreach sym $::OMIT_SYMBOLS { - set dirname "test_[string range $sym 7 end]" + set dirname "test_[regsub -nocase {^x*SQLITE_} $sym {}]" run_quick_test $dirname $sym } # Try the ENABLE/DISABLE symbols one at a time. # We don't do them all at once since some are conflicting. foreach sym $::ENABLE_SYMBOLS { - set dirname "test_[string range $sym 7 end]" + set dirname "test_[regsub -nocase {^x*SQLITE_} $sym {}]" run_quick_test $dirname $sym } } From 45de8d5f0fd9c4484ef558dea339f50acc2b3a37 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 23 Jun 2011 00:59:41 +0000 Subject: [PATCH 6/8] If "PRAGMA page_size" commands are not authorized, the FTS module will assume a page size of 1024. FossilOrigin-Name: ba39382ef546b4c4ae15ed90ef0b6c87762bffef --- ext/fts3/fts3.c | 3 ++ manifest | 16 +++---- manifest.uuid | 2 +- test/fts4aa.test | 117 +++++++++++++++++++++++++++++++++++++++++++---- 4 files changed, 119 insertions(+), 19 deletions(-) diff --git a/ext/fts3/fts3.c b/ext/fts3/fts3.c index 2cbcbff89e..67a0ea2096 100644 --- a/ext/fts3/fts3.c +++ b/ext/fts3/fts3.c @@ -644,6 +644,9 @@ static void fts3DatabasePageSize(int *pRc, Fts3Table *p){ sqlite3_step(pStmt); p->nPgsz = sqlite3_column_int(pStmt, 0); rc = sqlite3_finalize(pStmt); + }else if( rc==SQLITE_AUTH ){ + p->nPgsz = 1024; + rc = SQLITE_OK; } } assert( p->nPgsz>0 || rc!=SQLITE_OK ); diff --git a/manifest b/manifest index 72883e03d5..3895c7a5fd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Added\slimited\ssupport\sto\somittest.tcl\sfor\snmake\smakefile. -D 2011-06-22T20:14:09.429 +C If\s"PRAGMA\spage_size"\scommands\sare\snot\sauthorized,\sthe\sFTS\smodule\swill\sassume\na\spage\ssize\sof\s1024. +D 2011-06-23T00:59:41.395 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -62,7 +62,7 @@ F ext/fts2/mkfts2amal.tcl 974d5d438cb3f7c4a652639262f82418c1e4cff0 F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a F ext/fts3/README.tokenizers 998756696647400de63d5ba60e9655036cb966e9 F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d -F ext/fts3/fts3.c 1c8a45dfd6836e7dea0307008079793ac0fc3b68 +F ext/fts3/fts3.c ca776037493d0081da70a6afc0df80f5ce347cb7 F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe F ext/fts3/fts3Int.h fa493ccbad78a2c99ad1c984f651c0c202e68536 F ext/fts3/fts3_aux.c 0ebfa7b86cf8ff6a0861605fcc63b83ec1b70691 @@ -482,7 +482,7 @@ F test/fts3rnd.test 1320d8826a845e38a96e769562bf83d7a92a15d0 F test/fts3shared.test 8bb266521d7c5495c0ae522bb4d376ad5387d4a2 F test/fts3snippet.test a12f22a3ba4dd59751a57c79b031d07ab5f51ddd F test/fts3sort.test 63d52c1812904b751f9e1ff487472e44833f5402 -F test/fts4aa.test b99ad4d9a43a00efd096ef4d0b082de58d848d41 +F test/fts4aa.test 148d9eb54901af23b5d402b1f388f43e559e1728 F test/func.test 6c5ce11e3a0021ca3c0649234e2d4454c89110ca F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f F test/func3.test 7ba2ca5a1e9bca900ba2c230cf04bd67184bc1bc @@ -948,7 +948,7 @@ F tool/symbols.sh bc2a3709940d47c8ac8e0a1fdf17ec801f015a00 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 347d974d143cf132f953b565fbc03026f19fcb4d -P f853fa63c357b78f93e553eb81cd79d4c3e06850 -R ddc3e17983db538a7697328fd62bb1d7 -U shaneh -Z 53ee1769a28d0b67b6ec5c95bb5607ec +P f5f46dc7b8c23e77fd1ff792b7d0cf070de47ca3 +R 75bcfe449226b3d5c48d659bee0c9f49 +U drh +Z 3a2cb80a9cc46dd7ad3b57ead9348db1 diff --git a/manifest.uuid b/manifest.uuid index 467483d7d7..d75b641e50 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f5f46dc7b8c23e77fd1ff792b7d0cf070de47ca3 \ No newline at end of file +ba39382ef546b4c4ae15ed90ef0b6c87762bffef \ No newline at end of file diff --git a/test/fts4aa.test b/test/fts4aa.test index f20d07660b..1131df3bec 100644 --- a/test/fts4aa.test +++ b/test/fts4aa.test @@ -22,9 +22,11 @@ ifcapable !fts3 { return } -do_test fts4aa-1.0 { +# This procedure fills an existing FTS3/FTS4 table with many entries. +# The table needs to have a single column (other than docid) named "words". +# +proc fts4aa_fill_table {} { db eval { -CREATE VIRTUAL TABLE t1 USING fts4(words, tokenize porter); BEGIN TRANSACTION; INSERT INTO t1(docid,words) VALUES(1001001,'In the beginning God created the heaven and the earth.'); INSERT INTO t1(docid,words) VALUES(1001002,'And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved upon the face of the waters.'); @@ -1561,9 +1563,41 @@ INSERT INTO t1(docid,words) VALUES(1050025,'And Joseph took an oath of the child INSERT INTO t1(docid,words) VALUES(1050026,'So Joseph died, being an hundred and ten years old: and they embalmed him, and he was put in a coffin in Egypt.'); COMMIT; } +} + +# The following is a list of queries to perform against the above +# FTS3/FTS4 database. We will be trying these queries in various +# configurations to ensure that they always return the same answers. +# +set fts4aa_queries { + {abraham} + {the king} + {"the king"} + {abraham OR joseph} + {ab* OR jos*} + {lived t*} + {spake hebrew} + {melchizedek} + {t* melchizedek} + {melchizedek t*} +} +unset -nocomplain fts4aa_res + +# Set up the baseline results +# +do_test fts4aa-1.0 { + db eval { + CREATE VIRTUAL TABLE t1 USING fts4(words, tokenize porter); + } + fts4aa_fill_table + foreach q $::fts4aa_queries { + set r [db eval {SELECT docid FROM t1 WHERE words MATCH $q ORDER BY docid}] + set ::fts4aa_res($q) $r + } } {} - +# Legacy test cases +# do_test fts4aa-1.1 { db eval { SELECT docid FROM t1 EXCEPT SELECT docid FROM t1_docsize @@ -1583,19 +1617,19 @@ proc mit {blob} { } db func mit mit -do_test fts4aa-2.1 { +do_test fts4aa-1.3 { db eval { SELECT docid, mit(matchinfo(t1, 'pcxnal')) FROM t1 WHERE t1 MATCH 'melchizedek'; } } {1014018 {1 1 1 1 1 1533 25 20}} -do_test fts4aa-2.2 { +do_test fts4aa-1.4 { db eval { SELECT docid, mit(matchinfo(t1, 'pcxnal')) FROM t1 WHERE t1 MATCH 'spake hebrew' ORDER BY docid; } } {1039014 {2 1 1 40 40 1 6 6 1533 25 42} 1039017 {2 1 1 40 40 1 6 6 1533 25 26}} -do_test fts4aa-2.3 { +do_test fts4aa-1.5 { db eval { SELECT docid, mit(matchinfo(t1, 'pcxnal')) FROM t1 WHERE t1 MATCH 'laban overtook jacob' @@ -1603,7 +1637,7 @@ do_test fts4aa-2.3 { } } {1031025 {3 1 2 54 46 1 3 3 2 181 160 1533 25 24}} -do_test fts4aa-9.1 { +do_test fts4aa-1.6 { db eval { DELETE FROM t1 WHERE docid!=1050026; SELECT hex(size) FROM t1_docsize; @@ -1611,17 +1645,17 @@ do_test fts4aa-9.1 { } } {17 01176F} -do_test fts4aa-9.2 { +do_test fts4aa-1.7 { db eval { SELECT docid FROM t1 EXCEPT SELECT docid FROM t1_docsize } } {} -do_test fts4aa-9.3 { +do_test fts4aa-1.8 { db eval { SELECT docid FROM t1_docsize EXCEPT SELECT docid FROM t1 } } {} -do_test fts4aa-9.4 { +do_test fts4aa-1.9 { # Note: Token 'in' is being deferred in the following query. db eval { SELECT docid, mit(matchinfo(t1, 'pcxnal')) FROM t1 @@ -1630,4 +1664,67 @@ do_test fts4aa-9.4 { } } {1050026 {4 1 1 1 1 1 1 1 2 1 1 1 1 1 1 23 23}} +# Should get the same search results from FTS3 +# +do_test fts4aa-2.0 { + db eval { + DROP TABLE t1; + CREATE VIRTUAL TABLE t1 USING fts3(words, tokenize porter); + } + fts4aa_fill_table +} {} +unset -nocomplain ii +set ii 0 +foreach {q r} [array get fts4aa_res] { + incr ii + do_test fts4aa-2.$ii { + db eval {SELECT docid FROM t1 WHERE words MATCH $::q ORDER BY docid} + } $r +} + +# Should get the same search results when the page size is very large +# +do_test fts4aa-3.0 { + db close + file delete -force test.db + sqlite3 db test.db + db eval { + PRAGMA page_size=65536; + CREATE VIRTUAL TABLE t1 USING fts4(words, tokenize porter); + } + fts4aa_fill_table +} {} +unset -nocomplain ii +set ii 0 +foreach {q r} [array get fts4aa_res] { + incr ii + do_test fts4aa-3.$ii { + db eval {SELECT docid FROM t1 WHERE words MATCH $::q ORDER BY docid} + } $r +} + +# Should get the same search results when an authorizer prevents +# all PRAGMA statements. +# +proc no_pragma_auth {code arg1 arg2 arg3 arg4} { + if {$code=="SQLITE_PRAGMA"} {return SQLITE_DENY} + return SQLITE_OK; +} +do_test fts4aa-4.0 { + db auth ::no_pragma_auth + db eval { + DROP TABLE t1; + CREATE VIRTUAL TABLE t1 USING fts4(words, tokenize porter); + } + fts4aa_fill_table +} {} +unset -nocomplain ii +set ii 0 +foreach {q r} [array get fts4aa_res] { + incr ii + do_test fts4aa-4.$ii { + db eval {SELECT docid FROM t1 WHERE words MATCH $::q ORDER BY docid} + } $r +} + finish_test From e3f031686db740cc776a8565f873ed09af8c6cd2 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 23 Jun 2011 01:07:49 +0000 Subject: [PATCH 7/8] Remove unused variables from test_vfs.c FossilOrigin-Name: 07884cc218e6899efd163448ab116f296722f7b8 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/test_vfs.c | 2 -- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 3895c7a5fd..1f5515455f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C If\s"PRAGMA\spage_size"\scommands\sare\snot\sauthorized,\sthe\sFTS\smodule\swill\sassume\na\spage\ssize\sof\s1024. -D 2011-06-23T00:59:41.395 +C Remove\sunused\svariables\sfrom\stest_vfs.c +D 2011-06-23T01:07:49.019 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -228,7 +228,7 @@ F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd F src/test_syscall.c 162c4ec0137a549c009bb9ecab550527743cfc5d F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa F src/test_thread.c fe9a7803fc1d69cccb60f016f28c1cedf2d9fcfa -F src/test_vfs.c 1d82aee93e644188179da2165f4fe3ad6b62782c +F src/test_vfs.c 956cb3f5cbd2a0d09129540e615bb0fb761c083d F src/test_vfstrace.c 0b884e06094a746da729119a2cabdc7aa790063d F src/test_wholenumber.c 6129adfbe7c7444f2e60cc785927f3aa74e12290 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 @@ -948,7 +948,7 @@ F tool/symbols.sh bc2a3709940d47c8ac8e0a1fdf17ec801f015a00 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 347d974d143cf132f953b565fbc03026f19fcb4d -P f5f46dc7b8c23e77fd1ff792b7d0cf070de47ca3 -R 75bcfe449226b3d5c48d659bee0c9f49 +P ba39382ef546b4c4ae15ed90ef0b6c87762bffef +R a2e4da6d4f37b715c700de568f5ee337 U drh -Z 3a2cb80a9cc46dd7ad3b57ead9348db1 +Z a27503cdff9ca0289ec2563bb6165861 diff --git a/manifest.uuid b/manifest.uuid index d75b641e50..c7300f7bbc 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ba39382ef546b4c4ae15ed90ef0b6c87762bffef \ No newline at end of file +07884cc218e6899efd163448ab116f296722f7b8 \ No newline at end of file diff --git a/src/test_vfs.c b/src/test_vfs.c index bc8c4d3260..a8b53526d4 100644 --- a/src/test_vfs.c +++ b/src/test_vfs.c @@ -1070,7 +1070,6 @@ static int testvfs_obj_cmd( if( objc==3 ){ int nByte; if( p->pScript ){ - int i; Tcl_DecrRefCount(p->pScript); p->pScript = 0; } @@ -1223,7 +1222,6 @@ static int testvfs_obj_cmd( static void testvfs_obj_del(ClientData cd){ Testvfs *p = (Testvfs *)cd; - int i; if( p->pScript ) Tcl_DecrRefCount(p->pScript); sqlite3_vfs_unregister(p->pVfs); ckfree((char *)p->pVfs); From 24e713d9b32c8b45dee0516f49a34e93d2806d39 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 23 Jun 2011 01:42:53 +0000 Subject: [PATCH 8/8] Provide the SQLITE_MAX_SCHEMA_RETRY compile-time parameter for adjusting the number of reparse attempts after a schema change. FossilOrigin-Name: 8dca748b23fa6f9abf47a186dcd1766f4dcf3ab7 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbeapi.c | 10 +++++++++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 1f5515455f..aaff29d2eb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sunused\svariables\sfrom\stest_vfs.c -D 2011-06-23T01:07:49.019 +C Provide\sthe\sSQLITE_MAX_SCHEMA_RETRY\scompile-time\sparameter\sfor\sadjusting\sthe\nnumber\sof\sreparse\sattempts\safter\sa\sschema\schange. +D 2011-06-23T01:42:53.188 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -241,7 +241,7 @@ F src/vacuum.c 05513dca036a1e7848fe18d5ed1265ac0b32365e F src/vdbe.c 50b5b4ef29d928a4f60905f820ee1ab2f8ced29f F src/vdbe.h 5cf09e7ee8a3f7d93bc51f196a96550786afe7a1 F src/vdbeInt.h ad84226cc0adcb1185c22b70696b235a1678bb45 -F src/vdbeapi.c 0eeadc75e44a30efd996d6af6e7c5a2488e35be8 +F src/vdbeapi.c 2f908c65337b16c6249ab378d477e74492cf759b F src/vdbeaux.c 0b2e2880f13af400a27c92a7673287c3eaec8b21 F src/vdbeblob.c f024f0bf420f36b070143c32b15cc7287341ffd3 F src/vdbemem.c 0498796b6ffbe45e32960d6a1f5adfb6e419883b @@ -948,7 +948,7 @@ F tool/symbols.sh bc2a3709940d47c8ac8e0a1fdf17ec801f015a00 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh 347d974d143cf132f953b565fbc03026f19fcb4d -P ba39382ef546b4c4ae15ed90ef0b6c87762bffef -R a2e4da6d4f37b715c700de568f5ee337 +P 07884cc218e6899efd163448ab116f296722f7b8 +R 1ebb2dce4c03a2b8c248fc12b488baac U drh -Z a27503cdff9ca0289ec2563bb6165861 +Z ee2965e68946933dec7ceb7c99aa065f diff --git a/manifest.uuid b/manifest.uuid index c7300f7bbc..fe91914370 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -07884cc218e6899efd163448ab116f296722f7b8 \ No newline at end of file +8dca748b23fa6f9abf47a186dcd1766f4dcf3ab7 \ No newline at end of file diff --git a/src/vdbeapi.c b/src/vdbeapi.c index 5923a4c01f..a87b5c9acd 100644 --- a/src/vdbeapi.c +++ b/src/vdbeapi.c @@ -459,6 +459,14 @@ end_of_step: return (rc&db->errMask); } +/* +** The maximum number of times that a statement will try to reparse +** itself before giving up and returning SQLITE_SCHEMA. +*/ +#ifndef SQLITE_MAX_SCHEMA_RETRY +# define SQLITE_MAX_SCHEMA_RETRY 5 +#endif + /* ** This is the top-level implementation of sqlite3_step(). Call ** sqlite3Step() to do most of the work. If a schema error occurs, @@ -477,7 +485,7 @@ int sqlite3_step(sqlite3_stmt *pStmt){ db = v->db; sqlite3_mutex_enter(db->mutex); while( (rc = sqlite3Step(v))==SQLITE_SCHEMA - && cnt++ < 5 + && cnt++ < SQLITE_MAX_SCHEMA_RETRY && (rc2 = rc = sqlite3Reprepare(v))==SQLITE_OK ){ sqlite3_reset(pStmt); v->expired = 0;