]> review.fuel-infra Code Review - packages/trusty/mysql-wsrep-5.6.git/blob
6f6bd559841169e94da5747e0e4ec61f0ba4489a
[packages/trusty/mysql-wsrep-5.6.git] /
1 /*
2 Copyright 2010 Sun Microsystems, Inc.
3 All rights reserved. Use is subject to license terms.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; version 2 of the License.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
17 */
18
19 package testsuite.clusterj;
20
21 import testsuite.clusterj.model.AllPrimitives;
22
23 /** Query for columns compared via OR.
24  * Predicates using OR cannot use indexes, although indexes can 
25  * be used for AND predicates where some of the predicates are OR
26  * predicates.
27  * This test is based on AbstractQueryTest.
28  */
29 public class QueryOrTest extends AbstractQueryTest {
30     /*
31     drop table if exists allprimitives;
32     create table allprimitives (
33     id int not null primary key,
34
35     int_not_null_hash int not null,
36     int_not_null_btree int not null,
37     int_not_null_both int not null,
38     int_not_null_none int not null,
39     int_null_hash int,
40     int_null_btree int,
41     int_null_both int,
42     int_null_none int,
43
44     byte_not_null_hash tinyint not null,
45     byte_not_null_btree tinyint not null,
46     byte_not_null_both tinyint not null,
47     byte_not_null_none tinyint not null,
48     byte_null_hash tinyint,
49     byte_null_btree tinyint,
50     byte_null_both tinyint,
51     byte_null_none tinyint,
52
53     short_not_null_hash smallint not null,
54     short_not_null_btree smallint not null,
55     short_not_null_both smallint not null,
56     short_not_null_none smallint not null,
57     short_null_hash smallint,
58     short_null_btree smallint,
59     short_null_both smallint,
60     short_null_none smallint,
61
62     long_not_null_hash bigint not null,
63     long_not_null_btree bigint not null,
64     long_not_null_both bigint not null,
65     long_not_null_none bigint not null,
66     long_null_hash bigint,
67     long_null_btree bigint,
68     long_null_both bigint,
69     long_null_none bigint
70       */
71
72     @Override
73     public Class<?> getInstanceType() {
74         return AllPrimitives.class;
75     }
76
77     @Override
78     void createInstances(int number) {
79         createAllPrimitivesInstances(10);
80     }
81
82     public void testBtreeEqualOrEqual() {
83         equalOrEqualQuery("int_not_null_btree", 4, "int_null_none", 6, "none", 4, 6);
84         equalOrEqualQuery("int_null_btree", 4, "int_null_none", 6, "none", 4, 6);
85         failOnError();        
86     }
87
88     public void testHashEqualOrEqual() {
89         equalOrEqualQuery("int_not_null_hash", 4, "int_null_both", 6, "none", 4, 6);
90         equalOrEqualQuery("int_null_hash", 4, "int_null_both", 6, "none", 4, 6);
91         failOnError();        
92     }
93
94     public void testBothEqualOrEqual() {
95         equalOrEqualQuery("int_not_null_both", 4, "int_null_hash", 6, "none", 4, 6);
96         equalOrEqualQuery("int_null_both", 4, "int_null_hash", 6, "none", 4, 6);
97         failOnError();        
98     }
99
100     public void testNoneEqualOrEqual() {
101         equalOrEqualQuery("int_not_null_none", 4, "int_null_btree", 6, "none", 4, 6);
102         equalOrEqualQuery("int_null_none", 4, "int_null_btree", 6, "none", 4, 6);
103         failOnError();        
104     }
105
106 }