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 public class QueryNotTest extends AbstractQueryTest {
26 public Class<?> getInstanceType() {
27 return AllPrimitives.class;
31 void createInstances(int number) {
32 createAllPrimitivesInstances(10);
35 /** Test "not" queries using AllPrimitives.
36 drop table if exists allprimitives;
37 create table allprimitives (
38 id int not null primary key,
40 int_not_null_hash int not null,
41 int_not_null_btree int not null,
42 int_not_null_both int not null,
43 int_not_null_none int not null,
49 byte_not_null_hash tinyint not null,
50 byte_not_null_btree tinyint not null,
51 byte_not_null_both tinyint not null,
52 byte_not_null_none tinyint not null,
53 byte_null_hash tinyint,
54 byte_null_btree tinyint,
55 byte_null_both tinyint,
56 byte_null_none tinyint,
58 short_not_null_hash smallint not null,
59 short_not_null_btree smallint not null,
60 short_not_null_both smallint not null,
61 short_not_null_none smallint not null,
62 short_null_hash smallint,
63 short_null_btree smallint,
64 short_null_both smallint,
65 short_null_none smallint,
67 long_not_null_hash bigint not null,
68 long_not_null_btree bigint not null,
69 long_not_null_both bigint not null,
70 long_not_null_none bigint not null,
71 long_null_hash bigint,
72 long_null_btree bigint,
73 long_null_both bigint,
82 public void btreeIndexScanInt() {
83 notEqualQuery("int_not_null_btree", "none", 8, 0, 1, 2, 3, 4, 5, 6, 7, 9);
84 notNotEqualQuery("int_not_null_btree", "none", 8, 8);
85 notNotNotEqualQuery("int_not_null_btree", "none", 8, 0, 1, 2, 3, 4, 5, 6, 7, 9);
86 notGreaterEqualQuery("int_not_null_btree", "none", 7, 0, 1, 2, 3, 4, 5, 6);
87 notGreaterThanQuery("int_not_null_btree", "none", 6, 0, 1, 2, 3, 4, 5, 6);
88 notLessEqualQuery("int_not_null_btree", "none", 4, 5, 6, 7, 8, 9);
89 notLessThanQuery("int_not_null_btree", "none", 4, 4, 5, 6, 7, 8, 9);
90 notBetweenQuery("int_not_null_btree", "none", 4, 6, 0, 1, 2, 3, 7, 8, 9);
91 greaterEqualAndNotGreaterEqualQuery("int_not_null_btree", "idx_int_not_null_btree", 4, 6, 4, 5);
92 greaterThanAndNotGreaterEqualQuery("int_not_null_btree", "idx_int_not_null_btree", 4, 6, 5);
93 greaterEqualAndNotGreaterThanQuery("int_not_null_btree", "idx_int_not_null_btree", 4, 6, 4, 5, 6);
94 greaterThanAndNotGreaterThanQuery("int_not_null_btree", "idx_int_not_null_btree", 4, 6, 5, 6);
96 notEqualQuery("int_null_btree", "none", 8, 0, 1, 2, 3, 4, 5, 6, 7, 9);
97 notNotEqualQuery("int_null_btree", "none", 8, 8);
98 notNotNotEqualQuery("int_null_btree", "none", 8, 0, 1, 2, 3, 4, 5, 6, 7, 9);
99 notGreaterEqualQuery("int_null_btree", "none", 7, 0, 1, 2, 3, 4, 5, 6);
100 notGreaterThanQuery("int_null_btree", "none", 6, 0, 1, 2, 3, 4, 5, 6);
101 notLessEqualQuery("int_null_btree", "none", 4, 5, 6, 7, 8, 9);
102 notLessThanQuery("int_null_btree", "none", 4, 4, 5, 6, 7, 8, 9);
103 notBetweenQuery("int_null_btree", "none", 4, 6, 0, 1, 2, 3, 7, 8, 9);
104 greaterEqualAndNotGreaterEqualQuery("int_null_btree", "idx_int_null_btree", 4, 6, 4, 5);
105 greaterThanAndNotGreaterEqualQuery("int_null_btree", "idx_int_null_btree", 4, 6, 5);
106 greaterEqualAndNotGreaterThanQuery("int_null_btree", "idx_int_null_btree", 4, 6, 4, 5, 6);
107 greaterThanAndNotGreaterThanQuery("int_null_btree", "idx_int_null_btree", 4, 6, 5, 6);