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 to not null.
24 * Predicates using equal null cannot use indexes, although indexes can
25 * be used for non-null comparisons.
26 * This test is based on QueryExtraConditionsTest.
28 public class QueryNotNullTest extends AbstractQueryTest {
30 drop table if exists allprimitives;
31 create table allprimitives (
32 id int not null primary key,
34 int_not_null_hash int not null,
35 int_not_null_btree int not null,
36 int_not_null_both int not null,
37 int_not_null_none int not null,
43 byte_not_null_hash tinyint not null,
44 byte_not_null_btree tinyint not null,
45 byte_not_null_both tinyint not null,
46 byte_not_null_none tinyint not null,
47 byte_null_hash tinyint,
48 byte_null_btree tinyint,
49 byte_null_both tinyint,
50 byte_null_none tinyint,
52 short_not_null_hash smallint not null,
53 short_not_null_btree smallint not null,
54 short_not_null_both smallint not null,
55 short_not_null_none smallint not null,
56 short_null_hash smallint,
57 short_null_btree smallint,
58 short_null_both smallint,
59 short_null_none smallint,
61 long_not_null_hash bigint not null,
62 long_not_null_btree bigint not null,
63 long_not_null_both bigint not null,
64 long_not_null_none bigint not null,
65 long_null_hash bigint,
66 long_null_btree bigint,
67 long_null_both bigint,
72 public Class<?> getInstanceType() {
73 return AllPrimitives.class;
77 void createInstances(int number) {
78 createAllPrimitivesInstances(10);
81 public void testExtraEqualNotEqualNull() {
82 equalAnd1ExtraQuery("int_not_null_btree", 8, "int_null_none", extraNotEqualPredicateProvider, null, "idx_int_not_null_btree", 8);
83 equalAnd1ExtraQuery("int_not_null_hash", 8, "int_null_none", extraNotEqualPredicateProvider, null, "none", 8);
84 equalAnd1ExtraQuery("int_not_null_both", 8, "int_null_none", extraNotEqualPredicateProvider, null, "idx_int_not_null_both", 8);
85 equalAnd1ExtraQuery("int_not_null_none", 8, "int_null_none", extraNotEqualPredicateProvider, null, "none", 8);
89 public void testBtreeNotEqualNull() {
90 notEqualQuery("int_not_null_btree", "none", null, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
91 notEqualQuery("int_null_btree", "none", null, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
95 public void testHashNotEqualNull() {
96 notEqualQuery("int_not_null_hash", "none", null, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
97 notEqualQuery("int_null_hash", "none", null, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
101 public void testBothNotEqualNull() {
102 notEqualQuery("int_not_null_both", "none", null, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
103 notEqualQuery("int_null_both", "none", null, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
107 public void testNoneNotEqualNull() {
108 notEqualQuery("int_not_null_none", "none", null, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
109 notEqualQuery("int_null_none", "none", null, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);