SQLite

Check-in [eb9ba5fe70]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Still more test cases in where7.test. (CVS 6080)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: eb9ba5fe70df56ee00828f7dbaf71ae6f825737d
User & Date: drh 2008-12-30 14:40:07.000
Context
2008-12-30
15:26
Add a few more tests to where8.test. (CVS 6081) (check-in: ac28aa8b61 user: danielk1977 tags: trunk)
14:40
Still more test cases in where7.test. (CVS 6080) (check-in: eb9ba5fe70 user: drh tags: trunk)
14:14
Add many new test cases to where7.test. (CVS 6079) (check-in: 174985831f user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/where7.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 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 of this file is testing the multi-index OR clause optimizer.
#
# $Id: where7.test,v 1.4 2008/12/30 14:14:04 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable !or_opt {
  finish_test
  return













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 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 of this file is testing the multi-index OR clause optimizer.
#
# $Id: where7.test,v 1.5 2008/12/30 14:40:07 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable !or_opt {
  finish_test
  return
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110

















































111
112
113
114
115
116
117
} {2 4 5 scan 0 sort 0}
do_test where7-1.11 {
  count_steps {
    SELECT a FROM t1 WHERE (d=5 AND b=3) OR c==100 ORDER BY a;
  }
} {2 5 scan 0 sort 0}
do_test where7-1.12 {
breakpoint
  count_steps {
    SELECT a FROM t1 WHERE (b BETWEEN 2 AND 4) OR c=100 ORDER BY a
  }
} {1 2 3 5 scan 0 sort 0}
do_test where7-1.13 {
breakpoint
  count_steps {
    SELECT a FROM t1 WHERE (b BETWEEN 0 AND 2) OR (c BETWEEN 9 AND 999)
    ORDER BY a DESC
  }
} {5 4 1 scan 0 sort 1}



















































# Lots of randomly generated OR-clause processing tests.
#
do_test where7-2.1 {
  db eval {
    CREATE TABLE t2(a INTEGER PRIMARY KEY,b,c,d,e,f,g);
    INSERT INTO t2 VALUES(1,11,1001,1.001,100.1,'bcdefghij','yxwvuts');







<





<






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







91
92
93
94
95
96
97

98
99
100
101
102

103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
} {2 4 5 scan 0 sort 0}
do_test where7-1.11 {
  count_steps {
    SELECT a FROM t1 WHERE (d=5 AND b=3) OR c==100 ORDER BY a;
  }
} {2 5 scan 0 sort 0}
do_test where7-1.12 {

  count_steps {
    SELECT a FROM t1 WHERE (b BETWEEN 2 AND 4) OR c=100 ORDER BY a
  }
} {1 2 3 5 scan 0 sort 0}
do_test where7-1.13 {

  count_steps {
    SELECT a FROM t1 WHERE (b BETWEEN 0 AND 2) OR (c BETWEEN 9 AND 999)
    ORDER BY a DESC
  }
} {5 4 1 scan 0 sort 1}

do_test where7-1.20 {
  set sql "SELECT a FROM t1 WHERE a=11 OR b=11"
  for {set i 12} {$i<400} {incr i} {
    append sql " OR a=$i OR b=$i"
  }
  append sql " ORDER BY a"
  count_steps $sql
} {scan 0 sort 0}
do_test where7-1.21 {
  set sql "SELECT a FROM t1 WHERE b=11 OR c=11"
  for {set i 12} {$i<400} {incr i} {
    append sql " OR b=$i OR c=$i"
  }
  append sql " ORDER BY a"
  count_steps $sql
} {5 scan 0 sort 0}
do_test where7-1.22 {
  set sql "SELECT a FROM t1 WHERE (b=11 OR c=11"
  for {set i 12} {$i<400} {incr i} {
    append sql " OR b=$i OR c=$i"
  }
  append sql ") AND d>=0 AND d<9999 ORDER BY a"
  count_steps $sql
} {5 scan 0 sort 0}
do_test where7-1.23 {
  set sql "SELECT a FROM t1 WHERE (b=11 OR c=11"
  for {set i 12} {$i<400} {incr i} {
    append sql " OR (b=$i AND d!=0) OR (c=$i AND d IS NOT NULL)"
  }
  append sql ") AND d>=0 AND d<9999 ORDER BY a"
  count_steps $sql
} {5 scan 0 sort 0}

do_test where7-1.31 {
  set sql "SELECT a FROM t1 WHERE (a=11 AND b=11)"
  for {set i 12} {$i<400} {incr i} {
    append sql " OR (a=$i AND b=$i)"
  }
  append sql " ORDER BY a"
  count_steps $sql
} {scan 0 sort 0}
do_test where7-1.32 {
  set sql "SELECT a FROM t1 WHERE (b=11 AND c=11)"
  for {set i 12} {$i<400} {incr i} {
    append sql " OR (b=$i AND c=$i)"
  }
  append sql " ORDER BY a"
  count_steps $sql
} {scan 0 sort 0}

# Lots of randomly generated OR-clause processing tests.
#
do_test where7-2.1 {
  db eval {
    CREATE TABLE t2(a INTEGER PRIMARY KEY,b,c,d,e,f,g);
    INSERT INTO t2 VALUES(1,11,1001,1.001,100.1,'bcdefghij','yxwvuts');