~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
# include/index_merge_2sweeps.inc
2
#
3
# 2-sweeps read Index_merge test
4
#
5
# The variable
6
#     $engine_type       -- storage engine to be tested
7
# has to be set before sourcing this script.
8
#
9
# Last update:
10
# 2006-08-02 ML test refactored
11
#               old name was index_merge_innodb2.test
12
#               main code went into include/index_merge_2sweeps.inc
13
#
14
15
--echo #---------------- 2-sweeps read Index merge test 2 -------------------------------
16
17
eval SET SESSION STORAGE_ENGINE = $engine_type;
18
19
--disable_warnings
20
drop table if exists t1;
21
--enable_warnings
22
23
create table t1 (
24
  pk int primary key,
25
  key1 int,
26
  key2 int,
27
  filler char(200),
28
  filler2 char(200),
29
  index(key1),
30
  index(key2)
31
);
32
33
34
--disable_query_log
35
let $1=1000;
36
while ($1)
37
{
38
  eval insert into t1 values($1, $1, $1, 'filler-data','filler-data-2');
39
  dec $1;
40
}
41
--enable_query_log
42
43
select * from t1 where (key1 >= 2 and key1 <= 10) or (pk >= 4 and pk <=8 );
44
45
set @maxv=1000;
46
47
select * from t1 where
48
  (pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
49
  or key1=18 or key1=60;
50
51
select * from t1 where
52
  (pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
53
  or key1 < 3 or key1 > @maxv-11;
54
55
select * from t1 where
56
  (pk < 5) or (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 ) or (pk > @maxv-10)
57
  or
58
  (key1 < 5) or (key1 > 10 and key1 < 15) or (key1 >= 50 and key1 < 55 ) or (key1 > @maxv-10);
59
60
select * from t1 where
61
  (pk > 10 and pk < 15) or (pk >= 50 and pk < 55 )
62
  or
63
  (key1 < 5) or (key1 > @maxv-10);
64
65
drop table t1;