OLD | NEW |
1 # 2008 October 4 | 1 # 2008 October 4 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } {1 {no such index: sqlite_autoindex_t3_2}} | 116 } {1 {no such index: sqlite_autoindex_t3_2}} |
117 | 117 |
118 # Tests for multiple table cases. | 118 # Tests for multiple table cases. |
119 # | 119 # |
120 do_test indexedby-4.1 { | 120 do_test indexedby-4.1 { |
121 EQP { SELECT * FROM t1, t2 WHERE a = c } | 121 EQP { SELECT * FROM t1, t2 WHERE a = c } |
122 } {0 0 {TABLE t1} 1 1 {TABLE t2 WITH INDEX i3}} | 122 } {0 0 {TABLE t1} 1 1 {TABLE t2 WITH INDEX i3}} |
123 do_test indexedby-4.2 { | 123 do_test indexedby-4.2 { |
124 EQP { SELECT * FROM t1 INDEXED BY i1, t2 WHERE a = c } | 124 EQP { SELECT * FROM t1 INDEXED BY i1, t2 WHERE a = c } |
125 } {0 1 {TABLE t2} 1 0 {TABLE t1 WITH INDEX i1}} | 125 } {0 1 {TABLE t2} 1 0 {TABLE t1 WITH INDEX i1}} |
| 126 do_test indexedby-4.3 { |
| 127 catchsql { |
| 128 SELECT * FROM t1 INDEXED BY i1, t2 INDEXED BY i3 WHERE a=c |
| 129 } |
| 130 } {1 {cannot use index: i1}} |
| 131 do_test indexedby-4.4 { |
| 132 catchsql { |
| 133 SELECT * FROM t2 INDEXED BY i3, t1 INDEXED BY i1 WHERE a=c |
| 134 } |
| 135 } {1 {cannot use index: i3}} |
126 | 136 |
127 # Test embedding an INDEXED BY in a CREATE VIEW statement. This block | 137 # Test embedding an INDEXED BY in a CREATE VIEW statement. This block |
128 # also tests that nothing bad happens if an index refered to by | 138 # also tests that nothing bad happens if an index refered to by |
129 # a CREATE VIEW statement is dropped and recreated. | 139 # a CREATE VIEW statement is dropped and recreated. |
130 # | 140 # |
131 do_test indexedby-5.1 { | 141 do_test indexedby-5.1 { |
132 execsql { | 142 execsql { |
133 CREATE VIEW v2 AS SELECT * FROM t1 INDEXED BY i1 WHERE a > 5; | 143 CREATE VIEW v2 AS SELECT * FROM t1 INDEXED BY i1 WHERE a > 5; |
134 } | 144 } |
135 EQP { SELECT * FROM v2 } | 145 EQP { SELECT * FROM v2 } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 execsql { | 255 execsql { |
246 DROP TABLE indexed; | 256 DROP TABLE indexed; |
247 CREATE TABLE t10(indexed INTEGER); | 257 CREATE TABLE t10(indexed INTEGER); |
248 INSERT INTO t10 VALUES(1); | 258 INSERT INTO t10 VALUES(1); |
249 CREATE INDEX indexed ON t10(indexed); | 259 CREATE INDEX indexed ON t10(indexed); |
250 SELECT * FROM t10 indexed by indexed WHERE indexed>0 | 260 SELECT * FROM t10 indexed by indexed WHERE indexed>0 |
251 } | 261 } |
252 } {1} | 262 } {1} |
253 | 263 |
254 finish_test | 264 finish_test |
OLD | NEW |