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

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

Issue 1610963002: Import SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/index7.test ('k') | third_party/sqlite/src/test/indexexpr1.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/indexedby.test
diff --git a/third_party/sqlite/src/test/indexedby.test b/third_party/sqlite/src/test/indexedby.test
index f95c167f6411c0fb5f003ca4d9bc93995ec95c18..83c7a5ccccc4e7e0eadfb30c87321af6e31dd53d 100644
--- a/third_party/sqlite/src/test/indexedby.test
+++ b/third_party/sqlite/src/test/indexedby.test
@@ -1,4 +1,4 @@
-# 2008 October 4
+# 2008-10-04
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
@@ -9,7 +9,6 @@
#
#***********************************************************************
#
-# $Id: indexedby.test,v 1.5 2009/03/22 20:36:19 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -58,20 +57,45 @@ do_execsql_test indexedby-1.4 {
# attached to a table in the FROM clause, but not to a sub-select or
# SQL view. Also test that specifying an index that does not exist or
# is attached to a different table is detected as an error.
+#
+# EVIDENCE-OF: R-07004-11522 -- syntax diagram qualified-table-name
#
+# EVIDENCE-OF: R-58230-57098 The "INDEXED BY index-name" phrase
+# specifies that the named index must be used in order to look up values
+# on the preceding table.
+#
do_test indexedby-2.1 {
execsql { SELECT * FROM t1 NOT INDEXED WHERE a = 'one' AND b = 'two'}
} {}
+do_test indexedby-2.1b {
+ execsql { SELECT * FROM main.t1 NOT INDEXED WHERE a = 'one' AND b = 'two'}
+} {}
do_test indexedby-2.2 {
execsql { SELECT * FROM t1 INDEXED BY i1 WHERE a = 'one' AND b = 'two'}
} {}
+do_test indexedby-2.2b {
+ execsql { SELECT * FROM main.t1 INDEXED BY i1 WHERE a = 'one' AND b = 'two'}
+} {}
do_test indexedby-2.3 {
execsql { SELECT * FROM t1 INDEXED BY i2 WHERE a = 'one' AND b = 'two'}
} {}
-
+# EVIDENCE-OF: R-44699-55558 The INDEXED BY clause does not give the
+# optimizer hints about which index to use; it gives the optimizer a
+# requirement of which index to use.
+# EVIDENCE-OF: R-15800-25719 If index-name does not exist or cannot be
+# used for the query, then the preparation of the SQL statement fails.
+#
do_test indexedby-2.4 {
catchsql { SELECT * FROM t1 INDEXED BY i3 WHERE a = 'one' AND b = 'two'}
} {1 {no such index: i3}}
+
+# EVIDENCE-OF: R-62112-42456 If the query optimizer is unable to use the
+# index specified by the INDEX BY clause, then the query will fail with
+# an error.
+do_test indexedby-2.4.1 {
+ catchsql { SELECT b FROM t1 INDEXED BY i1 WHERE b = 'two' }
+} {1 {no query solution}}
+
do_test indexedby-2.5 {
catchsql { SELECT * FROM t1 INDEXED BY i5 WHERE a = 'one' AND b = 'two'}
} {1 {no such index: i5}}
@@ -82,11 +106,26 @@ do_test indexedby-2.7 {
catchsql { SELECT * FROM v1 INDEXED BY i1 WHERE a = 'one' }
} {1 {no such index: i1}}
+
# Tests for single table cases.
#
+# EVIDENCE-OF: R-37002-28871 The "NOT INDEXED" clause specifies that no
+# index shall be used when accessing the preceding table, including
+# implied indices create by UNIQUE and PRIMARY KEY constraints. However,
+# the rowid can still be used to look up entries even when "NOT INDEXED"
+# is specified.
+#
do_execsql_test indexedby-3.1 {
+ EXPLAIN QUERY PLAN SELECT * FROM t1 WHERE a = 'one' AND b = 'two'
+} {/SEARCH TABLE t1 USING INDEX/}
+do_execsql_test indexedby-3.1.1 {
EXPLAIN QUERY PLAN SELECT * FROM t1 NOT INDEXED WHERE a = 'one' AND b = 'two'
} {0 0 0 {SCAN TABLE t1}}
+do_execsql_test indexedby-3.1.2 {
+ EXPLAIN QUERY PLAN SELECT * FROM t1 NOT INDEXED WHERE rowid=1
+} {/SEARCH TABLE t1 USING INTEGER PRIMARY KEY .rowid=/}
+
+
do_execsql_test indexedby-3.2 {
EXPLAIN QUERY PLAN
SELECT * FROM t1 INDEXED BY i1 WHERE a = 'one' AND b = 'two'
@@ -184,17 +223,21 @@ do_execsql_test indexedby-6.2 {
EXPLAIN QUERY PLAN SELECT * FROM t1 NOT INDEXED WHERE b = 10 ORDER BY rowid
} {0 0 0 {SCAN TABLE t1}}
+# EVIDENCE-OF: R-40297-14464 The INDEXED BY phrase forces the SQLite
+# query planner to use a particular named index on a DELETE, SELECT, or
+# UPDATE statement.
+#
# Test that "INDEXED BY" can be used in a DELETE statement.
#
do_execsql_test indexedby-7.1 {
EXPLAIN QUERY PLAN DELETE FROM t1 WHERE a = 5
-} {0 0 0 {SEARCH TABLE t1 USING COVERING INDEX i1 (a=?)}}
+} {0 0 0 {SEARCH TABLE t1 USING INDEX i1 (a=?)}}
do_execsql_test indexedby-7.2 {
EXPLAIN QUERY PLAN DELETE FROM t1 NOT INDEXED WHERE a = 5
} {0 0 0 {SCAN TABLE t1}}
do_execsql_test indexedby-7.3 {
EXPLAIN QUERY PLAN DELETE FROM t1 INDEXED BY i1 WHERE a = 5
-} {0 0 0 {SEARCH TABLE t1 USING COVERING INDEX i1 (a=?)}}
+} {0 0 0 {SEARCH TABLE t1 USING INDEX i1 (a=?)}}
do_execsql_test indexedby-7.4 {
EXPLAIN QUERY PLAN DELETE FROM t1 INDEXED BY i1 WHERE a = 5 AND b = 10
} {0 0 0 {SEARCH TABLE t1 USING INDEX i1 (a=?)}}
« no previous file with comments | « third_party/sqlite/src/test/index7.test ('k') | third_party/sqlite/src/test/indexexpr1.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698