Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: third_party/sqlite/src/test/where9.test

Issue 6990047: Import SQLite 3.7.6.3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/src/test/where8.test ('k') | third_party/sqlite/src/test/whereA.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/where9.test
diff --git a/third_party/sqlite/src/test/where9.test b/third_party/sqlite/src/test/where9.test
index bf72a7169d37c221af85d196eeb0b50513e092e0..9a180116a83947fc9a2ccb44d5c0c9798b1d5509 100644
--- a/third_party/sqlite/src/test/where9.test
+++ b/third_party/sqlite/src/test/where9.test
@@ -358,32 +358,25 @@ do_test where9-2.8 {
ifcapable explain {
- do_test where9-3.1 {
- set r [db eval {
- EXPLAIN QUERY PLAN
- SELECT t2.a FROM t1, t2
- WHERE t1.a=80
- AND ((t1.c=t2.c AND t1.d=t2.d) OR t1.f=t2.f)
- }]
- set a [expr {[lsearch $r {TABLE t2 VIA MULTI-INDEX UNION}]>=0}]
- set b [expr {[lsearch $r {TABLE t2 WITH INDEX t2f}]>=0}]
- set c [expr {([lsearch $r {TABLE t2 WITH INDEX t2c}]>=0)+
- [lsearch $r {TABLE t2 WITH INDEX t2d}]>=0}]
- concat $a $b $c
- } {1 1 1}
- do_test where9-3.2 {
- set r [db eval {
- EXPLAIN QUERY PLAN
- SELECT coalesce(t2.a,9999)
- FROM t1 LEFT JOIN t2 ON (t1.c+1=t2.c AND t1.d=t2.d) OR (t1.f||'x')=t2.f
- WHERE t1.a=80
- }]
- set a [expr {[lsearch $r {TABLE t2 VIA MULTI-INDEX UNION}]>=0}]
- set b [expr {[lsearch $r {TABLE t2 WITH INDEX t2f}]>=0}]
- set c [expr {([lsearch $r {TABLE t2 WITH INDEX t2c}]>=0)+
- [lsearch $r {TABLE t2 WITH INDEX t2d}]>=0}]
- concat $a $b $c
- } {1 1 1}
+ do_execsql_test where9-3.1 {
+ EXPLAIN QUERY PLAN
+ SELECT t2.a FROM t1, t2
+ WHERE t1.a=80 AND ((t1.c=t2.c AND t1.d=t2.d) OR t1.f=t2.f)
+ } {
+ 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=?) (~10 rows)}
+ }
+ do_execsql_test where9-3.2 {
+ EXPLAIN QUERY PLAN
+ SELECT coalesce(t2.a,9999)
+ FROM t1 LEFT JOIN t2 ON (t1.c+1=t2.c AND t1.d=t2.d) OR (t1.f||'x')=t2.f
+ WHERE t1.a=80
+ } {
+ 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=?) (~10 rows)}
+ }
}
# Make sure that INDEXED BY and multi-index OR clauses play well with
@@ -458,46 +451,29 @@ ifcapable explain {
# The (c=31031 OR d IS NULL) clause is preferred over b>1000 because
# the former is an equality test which is expected to return fewer rows.
#
- do_test where9-5.1 {
- set r [db eval {
- EXPLAIN QUERY PLAN
- SELECT a FROM t1
- WHERE b>1000
- AND (c=31031 OR d IS NULL)
- }]
- set a [expr {[lsearch $r {TABLE t1 VIA MULTI-INDEX UNION}]>=0}]
- set b [expr {[lsearch $r {TABLE t1 WITH INDEX t1b}]>=0}]
- concat $a $b
- } {1 0}
+ 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=?) (~10 rows)}
+ 0 0 0 {SEARCH TABLE t1 USING INDEX t1d (d=?) (~10 rows)}
+ }
# In contrast, b=1000 is preferred over any OR-clause.
#
- do_test where9-5.2 {
- set r [db eval {
- EXPLAIN QUERY PLAN
- SELECT a FROM t1
- WHERE b=1000
- AND (c=31031 OR d IS NULL)
- }]
- set a [expr {[lsearch $r {TABLE t1 VIA MULTI-INDEX UNION}]>=0}]
- set b [expr {[lsearch $r {TABLE t1 WITH INDEX t1b}]>=0}]
- concat $a $b
- } {0 1}
+ do_execsql_test where9-5.2 {
+ 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 t1b (b=?) (~5 rows)}
+ }
# Likewise, inequalities in an AND are preferred over inequalities in
# an OR.
#
- do_test where9-5.3 {
- set r [db eval {
- EXPLAIN QUERY PLAN
- SELECT a FROM t1
- WHERE b>1000
- AND (c>=31031 OR d IS NULL)
- }]
- set a [expr {[lsearch $r {TABLE t1 VIA MULTI-INDEX UNION}]>=0}]
- set b [expr {[lsearch $r {TABLE t1 WITH INDEX t1b}]>=0}]
- concat $a $b
- } {0 1}
+ do_execsql_test where9-5.3 {
+ 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 t1b (b>?) (~125000 rows)}
+ }
}
############################################################################
« no previous file with comments | « third_party/sqlite/src/test/where8.test ('k') | third_party/sqlite/src/test/whereA.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698