2 Copyright 2010 Sun Microsystems, Inc.
3 All rights reserved. Use is subject to license terms.
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.
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.
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
19 package testsuite.clusterj;
21 import testsuite.clusterj.model.AllPrimitives;
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
27 * This test is based on AbstractQueryTest.
29 public class QueryOrTest extends AbstractQueryTest {
31 drop table if exists allprimitives;
32 create table allprimitives (
33 id int not null primary key,
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,
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,
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,
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,
73 public Class<?> getInstanceType() {
74 return AllPrimitives.class;
78 void createInstances(int number) {
79 createAllPrimitivesInstances(10);
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);
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);
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);
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);