diff options
author | Hans-Christoph Steiner <hans@eds.org> | 2012-03-30 20:42:12 -0400 |
---|---|---|
committer | Hans-Christoph Steiner <hans@eds.org> | 2012-03-30 20:42:12 -0400 |
commit | 7bb481fda9ecb134804b49c2ce77ca28f7eea583 (patch) | |
tree | 31b520b9914d3e2453968abe375f2c102772c3dc /test/where8m.test |
Imported Upstream version 2.0.3
Diffstat (limited to 'test/where8m.test')
-rw-r--r-- | test/where8m.test | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/test/where8m.test b/test/where8m.test new file mode 100644 index 0000000..4fce3db --- /dev/null +++ b/test/where8m.test @@ -0,0 +1,57 @@ +# 2008 December 23 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# This file implements regression tests for SQLite library. The focus +# is testing of where.c. More specifically, the focus is the optimization +# of WHERE clauses that feature the OR operator. +# +# $Id: where8m.test,v 1.3 2009/06/05 17:09:12 drh Exp $ + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +source $testdir/malloc_common.tcl + +do_malloc_test where8m-1 -sqlprep { + CREATE TABLE t1(a, b, c); + CREATE INDEX i1 ON t1(a); + CREATE INDEX i2 ON t1(b); +} -sqlbody { + SELECT c FROM t1 + WHERE + a = 2 OR b = 'three' OR a = 4 OR b = 'five' OR a = 6 OR + b = 'seven' OR a = 8 OR b = 'nine' OR a = 10 + ORDER BY rowid; + + SELECT c FROM t1 WHERE + a = 1 OR a = 2 OR a = 3 OR a = 4 OR a = 5 OR a = 6; + + SELECT c FROM t1 WHERE + a BETWEEN 1 AND 3 AND b < 5 AND b > 2 AND c = 4; +} + +do_malloc_test where8m-2 -tclprep { + db eval { + BEGIN; + CREATE TABLE t1(a, b, c); + CREATE INDEX i1 ON t1(a); + CREATE INDEX i2 ON t1(b); + } + for {set i 0} {$i < 1000} {incr i} { + set ii [expr $i*$i] + set iii [expr $i*$i] + db eval { INSERT INTO t1 VALUES($i, $ii, $iii) } + } + db eval COMMIT +} -sqlbody { + SELECT count(*) FROM t1 WHERE a BETWEEN 5 AND 995 OR b BETWEEN 5 AND 900000; +} + +finish_test |