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 #*********************************************************************** |
11 # This file implements regression tests for SQLite library. The focus | 11 # This file implements regression tests for SQLite library. The focus |
12 # is testing of where.c. More specifically, the focus is the optimization | 12 # is testing of where.c. More specifically, the focus is on handling OOM |
13 # of WHERE clauses that feature the OR operator. | 13 # errors within the code that optimizes WHERE clauses that feature the |
| 14 # OR operator. |
14 # | 15 # |
15 # $Id: where8m.test,v 1.3 2009/06/05 17:09:12 drh Exp $ | |
16 | 16 |
17 set testdir [file dirname $argv0] | 17 set testdir [file dirname $argv0] |
18 source $testdir/tester.tcl | 18 source $testdir/tester.tcl |
19 | 19 |
20 source $testdir/malloc_common.tcl | 20 source $testdir/malloc_common.tcl |
21 | 21 |
22 do_malloc_test where8m-1 -sqlprep { | 22 set testprefix wherefault |
| 23 |
| 24 do_malloc_test 1 -sqlprep { |
23 CREATE TABLE t1(a, b, c); | 25 CREATE TABLE t1(a, b, c); |
24 CREATE INDEX i1 ON t1(a); | 26 CREATE INDEX i1 ON t1(a); |
25 CREATE INDEX i2 ON t1(b); | 27 CREATE INDEX i2 ON t1(b); |
26 } -sqlbody { | 28 } -sqlbody { |
27 SELECT c FROM t1 | 29 SELECT c FROM t1 |
28 WHERE | 30 WHERE |
29 a = 2 OR b = 'three' OR a = 4 OR b = 'five' OR a = 6 OR | 31 a = 2 OR b = 'three' OR a = 4 OR b = 'five' OR a = 6 OR |
30 b = 'seven' OR a = 8 OR b = 'nine' OR a = 10 | 32 b = 'seven' OR a = 8 OR b = 'nine' OR a = 10 |
31 ORDER BY rowid; | 33 ORDER BY rowid; |
32 | 34 |
33 SELECT c FROM t1 WHERE | 35 SELECT c FROM t1 WHERE |
34 a = 1 OR a = 2 OR a = 3 OR a = 4 OR a = 5 OR a = 6; | 36 a = 1 OR a = 2 OR a = 3 OR a = 4 OR a = 5 OR a = 6; |
35 | 37 |
36 SELECT c FROM t1 WHERE | 38 SELECT c FROM t1 WHERE |
37 a BETWEEN 1 AND 3 AND b < 5 AND b > 2 AND c = 4; | 39 a BETWEEN 1 AND 3 AND b < 5 AND b > 2 AND c = 4; |
38 } | 40 } |
39 | 41 |
40 do_malloc_test where8m-2 -tclprep { | 42 do_malloc_test 2 -tclprep { |
41 db eval { | 43 db eval { |
42 BEGIN; | 44 BEGIN; |
43 CREATE TABLE t1(a, b, c); | 45 CREATE TABLE t1(a, b, c); |
44 CREATE INDEX i1 ON t1(a); | 46 CREATE INDEX i1 ON t1(a); |
45 CREATE INDEX i2 ON t1(b); | 47 CREATE INDEX i2 ON t1(b); |
46 } | 48 } |
47 for {set i 0} {$i < 1000} {incr i} { | 49 for {set i 0} {$i < 1000} {incr i} { |
48 set ii [expr $i*$i] | 50 set ii [expr $i*$i] |
49 set iii [expr $i*$i] | 51 set iii [expr $i*$i] |
50 db eval { INSERT INTO t1 VALUES($i, $ii, $iii) } | 52 db eval { INSERT INTO t1 VALUES($i, $ii, $iii) } |
51 } | 53 } |
52 db eval COMMIT | 54 db eval COMMIT |
53 } -sqlbody { | 55 } -sqlbody { |
54 SELECT count(*) FROM t1 WHERE a BETWEEN 5 AND 995 OR b BETWEEN 5 AND 900000; | 56 SELECT count(*) FROM t1 WHERE a BETWEEN 5 AND 995 OR b BETWEEN 5 AND 900000; |
55 } | 57 } |
56 | 58 |
57 finish_test | 59 finish_test |
OLD | NEW |