]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add extra tests to whereD.test.
authordan <dan@noemail.net>
Fri, 24 Aug 2012 19:52:25 +0000 (19:52 +0000)
committerdan <dan@noemail.net>
Fri, 24 Aug 2012 19:52:25 +0000 (19:52 +0000)
FossilOrigin-Name: 7e961eef6b7260dd8deb8b3812218a874c382885

manifest
manifest.uuid
test/whereD.test

index c92077aba09f6794dc8066775ba31db38bf00c3d..cb3aee71fc010de06856660c0f6f028edb99cc98 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sproblem\sto\sdo\swith\smulti-or\squeries\sand\sautomatic\sindexes.
-D 2012-08-24T18:44:56.189
+C Add\sextra\stests\sto\swhereD.test.
+D 2012-08-24T19:52:25.350
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in abd5c10d21d1395f140d9e50ea999df8fa4d6376
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -965,7 +965,7 @@ F test/where9.test ae98dc22ef9b6f2bc81e9f164e41b38faa9bda06
 F test/whereA.test 24c234263c8fe358f079d5e57d884fb569d2da0a
 F test/whereB.test 0def95db3bdec220a731c7e4bec5930327c1d8c5
 F test/whereC.test 13ff5ec0dba407c0e0c075980c75b3275a6774e5
-F test/whereD.test 1322fdcfbcc5e6eb6bb3b5d69930e231da388cc6
+F test/whereD.test 85b8aa329439b81e6844f65763eec84ae8db1604
 F test/wherelimit.test 5e9fd41e79bb2b2d588ed999d641d9c965619b31
 F test/win32lock.test b2a539e85ae6b2d78475e016a9636b4451dc7fb9
 F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688
@@ -1013,7 +1013,7 @@ F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
 F tool/win/sqlite.vsix 67d8a99aceb56384a81b3f30d6c71743146d2cc9
-P e5c3190c27b69dc50f348c849a81b79031b2fb67
-R 1a9f451faf8fb885437a56c112ab8ef2
+P a3e26038a1d9f3331239f777c67d1920d904aab0
+R 818ec06d567f4218c34d00c712e0fbb7
 U dan
-Z 18419d426568216b7681f94d1ac9fe1c
+Z 17fe6aa0374a8f5f1fd6fa7c61adf7ad
index fc85ed8c69f4f6f3658c3036d93028e6231ae112..d1c3e69140e81649324e29d1ff033e1c87a305c1 100644 (file)
@@ -1 +1 @@
-a3e26038a1d9f3331239f777c67d1920d904aab0
\ No newline at end of file
+7e961eef6b7260dd8deb8b3812218a874c382885
\ No newline at end of file
index e9269232a4b9cc21a3ce70a11f7c8a0add2e481d..8bc8ef986f5bf9c91981699216c3b3f7b2e47e44 100644 (file)
@@ -96,4 +96,63 @@ do_execsql_test 2.2 {
   SELECT a, x FROM t1 JOIN t2 ON y=d OR x=7 ORDER BY a, x;
 } {1 3}
 
+
+# Similar to [do_execsql_test], except that two elements are appended
+# to the result - the string "search" and the number of times test variable
+# sqlite3_search_count is incremented by running the supplied SQL. e.g.
+# 
+#   do_searchcount_test 1.0 { SELECT * FROM t1 } {x y search 2}
+#
+proc do_searchcount_test {tn sql res} {
+  uplevel [subst -nocommands {
+    do_test $tn {
+      set ::sqlite_search_count 0
+      concat [db eval {$sql}] search [set ::sqlite_search_count]
+    } [list $res]
+  }] 
+}
+
+do_execsql_test 3.0 {
+  CREATE TABLE t3(a, b, c);
+  CREATE UNIQUE INDEX i3 ON t3(a, b);
+  INSERT INTO t3 VALUES(1, 'one', 'i');
+  INSERT INTO t3 VALUES(3, 'three', 'iii');
+  INSERT INTO t3 VALUES(6, 'six', 'vi');
+  INSERT INTO t3 VALUES(2, 'two', 'ii');
+  INSERT INTO t3 VALUES(4, 'four', 'iv');
+  INSERT INTO t3 VALUES(5, 'five', 'v');
+
+  CREATE TABLE t4(x PRIMARY KEY, y);
+  INSERT INTO t4 VALUES('a', 'one');
+  INSERT INTO t4 VALUES('b', 'two');
+}
+
+do_searchcount_test 3.1 {
+  SELECT a, b FROM t3 WHERE (a=1 AND b='one') OR (a=2 AND b='two')
+} {1 one 2 two search 2}
+
+do_searchcount_test 3.2 {
+  SELECT a, c FROM t3 WHERE (a=1 AND b='one') OR (a=2 AND b='two')
+} {1 i 2 ii search 4}
+
+do_searchcount_test 3.4.1 {
+  SELECT y FROM t4 WHERE x='a'
+} {one search 2}
+do_searchcount_test 3.4.2 {
+  SELECT a, b FROM t3 WHERE 
+        (a=1 AND b=(SELECT y FROM t4 WHERE x='a')) 
+     OR (a=2 AND b='two')
+} {1 one 2 two search 4}
+do_searchcount_test 3.4.3 {
+  SELECT a, b FROM t3 WHERE 
+        (a=2 AND b='two')
+     OR (a=1 AND b=(SELECT y FROM t4 WHERE x='a')) 
+} {2 two 1 one search 4}
+do_searchcount_test 3.4.4 {
+  SELECT a, b FROM t3 WHERE 
+        (a=2 AND b=(SELECT y FROM t4 WHERE x='b')) 
+     OR (a=1 AND b=(SELECT y FROM t4 WHERE x='a')) 
+} {2 two 1 one search 6}
+
+
 finish_test