OLD | NEW |
1 # 2008 December 23 | 1 # 2008 December 23 |
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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 execsql_status { | 279 execsql_status { |
280 SELECT c FROM t1 WHERE a > (SELECT d FROM t2 WHERE e = b) OR a = 5 | 280 SELECT c FROM t1 WHERE a > (SELECT d FROM t2 WHERE e = b) OR a = 5 |
281 } | 281 } |
282 } {IV V 9 0} | 282 } {IV V 9 0} |
283 | 283 |
284 do_test where8-3.15 { | 284 do_test where8-3.15 { |
285 execsql_status { | 285 execsql_status { |
286 SELECT c FROM t1, t2 WHERE a BETWEEN 1 AND 2 OR a = ( | 286 SELECT c FROM t1, t2 WHERE a BETWEEN 1 AND 2 OR a = ( |
287 SELECT sum(e IS NULL) FROM t2 AS inner WHERE t2.d>inner.d | 287 SELECT sum(e IS NULL) FROM t2 AS inner WHERE t2.d>inner.d |
288 ) | 288 ) |
| 289 ORDER BY c |
289 } | 290 } |
290 } {I II I II I II I II I II I II III I II III I II III I II III I II III 9 0} | 291 } {I I I I I I I I I I II II II II II II II II II II III III III III III 9 1} |
291 | 292 |
292 #----------------------------------------------------------------------- | 293 #----------------------------------------------------------------------- |
293 # The following tests - where8-4.* - verify that adding or removing | 294 # The following tests - where8-4.* - verify that adding or removing |
294 # indexes does not change the results returned by various queries. | 295 # indexes does not change the results returned by various queries. |
295 # | 296 # |
296 do_test where8-4.1 { | 297 do_test where8-4.1 { |
297 execsql { | 298 execsql { |
298 BEGIN; | 299 BEGIN; |
299 CREATE TABLE t3(a INTEGER, b REAL, c TEXT); | 300 CREATE TABLE t3(a INTEGER, b REAL, c TEXT); |
300 CREATE TABLE t4(f INTEGER, g REAL, h TEXT); | 301 CREATE TABLE t4(f INTEGER, g REAL, h TEXT); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 INSERT INTO t4 VALUES(5028841971, 6939937510, 'light'); | 392 INSERT INTO t4 VALUES(5028841971, 6939937510, 'light'); |
392 INSERT INTO t4 VALUES('sometimes', 'peak', 'peak'); | 393 INSERT INTO t4 VALUES('sometimes', 'peak', 'peak'); |
393 INSERT INTO t4 VALUES(378678316.5, 5028841971, 'an'); | 394 INSERT INTO t4 VALUES(378678316.5, 5028841971, 'an'); |
394 INSERT INTO t4 VALUES(378678316.5, 'his', 'Alpine'); | 395 INSERT INTO t4 VALUES(378678316.5, 'his', 'Alpine'); |
395 INSERT INTO t4 VALUES('from', 'of', 'all'); | 396 INSERT INTO t4 VALUES('from', 'of', 'all'); |
396 INSERT INTO t4 VALUES(0938446095, 'same', NULL); | 397 INSERT INTO t4 VALUES(0938446095, 'same', NULL); |
397 INSERT INTO t4 VALUES(0938446095, 'Alpine', NULL); | 398 INSERT INTO t4 VALUES(0938446095, 'Alpine', NULL); |
398 INSERT INTO t4 VALUES('his', 'of', 378678316.5); | 399 INSERT INTO t4 VALUES('his', 'of', 378678316.5); |
399 INSERT INTO t4 VALUES(271.2019091, 'viewed', 3282306647); | 400 INSERT INTO t4 VALUES(271.2019091, 'viewed', 3282306647); |
400 INSERT INTO t4 VALUES('hills', 'all', 'peak'); | 401 INSERT INTO t4 VALUES('hills', 'all', 'peak'); |
| 402 CREATE TABLE t5(s); |
| 403 INSERT INTO t5 VALUES('tab-t5'); |
| 404 CREATE TABLE t6(t); |
| 405 INSERT INTO t6 VALUES(123456); |
401 COMMIT; | 406 COMMIT; |
402 } | 407 } |
403 } {} | 408 } {} |
404 | 409 |
405 catch {unset results} | 410 catch {unset results} |
406 catch {unset A} | 411 catch {unset A} |
407 catch {unset B} | 412 catch {unset B} |
408 | 413 |
409 set A 2 | 414 set A 2 |
410 foreach idxsql { | 415 foreach idxsql { |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 190 { SELECT * FROM t3, t4 WHERE c >= f OR c = 'and' } | 637 190 { SELECT * FROM t3, t4 WHERE c >= f OR c = 'and' } |
633 191 { SELECT * FROM t3, t4 WHERE f >= 'peak' AND g > f AND h > g } | 638 191 { SELECT * FROM t3, t4 WHERE f >= 'peak' AND g > f AND h > g } |
634 192 { SELECT * FROM t3, t4 WHERE a >= 8979323846 AND 'same' > b OR c = 'and' } | 639 192 { SELECT * FROM t3, t4 WHERE a >= 8979323846 AND 'same' > b OR c = 'and' } |
635 193 { SELECT * FROM t3, t4 WHERE c >= g OR 'writings' >= c AND b = 'all' } | 640 193 { SELECT * FROM t3, t4 WHERE c >= g OR 'writings' >= c AND b = 'all' } |
636 194 { SELECT * FROM t3, t4 WHERE 'remarkably' < g } | 641 194 { SELECT * FROM t3, t4 WHERE 'remarkably' < g } |
637 195 { SELECT * FROM t3, t4 WHERE a BETWEEN 'or' AND 'paintings' AND g <= f } | 642 195 { SELECT * FROM t3, t4 WHERE a BETWEEN 'or' AND 'paintings' AND g <= f } |
638 196 { SELECT * FROM t3, t4 WHERE 0938446095 > b OR g <= a OR h > b } | 643 196 { SELECT * FROM t3, t4 WHERE 0938446095 > b OR g <= a OR h > b } |
639 197 { SELECT * FROM t3, t4 WHERE g = 2643383279 AND f = g } | 644 197 { SELECT * FROM t3, t4 WHERE g = 2643383279 AND f = g } |
640 198 { SELECT * FROM t3, t4 WHERE g < 8979323846 } | 645 198 { SELECT * FROM t3, t4 WHERE g < 8979323846 } |
641 199 { SELECT * FROM t3, t4 WHERE 'are' <= b } | 646 199 { SELECT * FROM t3, t4 WHERE 'are' <= b } |
| 647 200 { SELECT * FROM t3, t4 WHERE (a=1415926535 AND f=8628034825) |
| 648 OR (a=6939937510 AND f=2643383279) } |
| 649 201 { SELECT * FROM t3, t4, t5, t6 |
| 650 WHERE (a=1415926535 AND f=8628034825 AND s!='hello' AND t!=5) |
| 651 OR (a=6939937510 AND f=2643383279 AND s='tab-t5' AND t=123456) } |
| 652 202 { SELECT * FROM t3, t4, t5, t6 |
| 653 WHERE (a=1415926535 AND f=8628034825 AND s!='hello' AND t==5) |
| 654 OR (a=6939937510 AND f=2643383279 AND s='tab-t5' AND t!=123456) } |
642 | 655 |
643 } { | 656 } { |
644 do_test where8-4.$A.$B.1 { | 657 do_test where8-4.$A.$B.1 { |
| 658 unset -nocomplain R |
645 set R [execsql $sql] | 659 set R [execsql $sql] |
646 if {![info exists results($B)]} { | 660 if {![info exists results($B)]} { |
647 set results($B) $R | 661 set results($B) $R |
648 } | 662 } |
649 list | 663 list |
650 } {} | 664 } {} |
651 | 665 |
652 do_test where8-4.$A.$B.2 { lsort $R } [lsort $results($B)] | 666 do_test where8-4.$A.$B.2 { lsort $R } [lsort $results($B)] |
653 } | 667 } |
654 incr A | 668 incr A |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 execsql { | 710 execsql { |
697 SELECT a, x FROM tA LEFT JOIN tB ON ( | 711 SELECT a, x FROM tA LEFT JOIN tB ON ( |
698 a=1 AND b=2 AND c=3 AND d=4 AND e=5 AND f=6 AND g=7 AND h=8 AND | 712 a=1 AND b=2 AND c=3 AND d=4 AND e=5 AND f=6 AND g=7 AND h=8 AND |
699 i=1 AND j=2 AND k=3 AND l=4 AND m=5 AND n=6 AND o=7 AND | 713 i=1 AND j=2 AND k=3 AND l=4 AND m=5 AND n=6 AND o=7 AND |
700 (p = 1 OR p = 2 OR p = 3) | 714 (p = 1 OR p = 2 OR p = 3) |
701 ) | 715 ) |
702 } | 716 } |
703 } {1 {}} | 717 } {1 {}} |
704 | 718 |
705 finish_test | 719 finish_test |
OLD | NEW |