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, version 2.0, 7 as published by the Free Software Foundation. 8 9 This program is also distributed with certain software (including 10 but not limited to OpenSSL) that is licensed under separate terms, 11 as designated in a particular file or component or in included license 12 documentation. The authors of MySQL hereby grant you an additional 13 permission to link the program and your derivative works with the 14 separately licensed software that they have included with MySQL. 15 16 This program is distributed in the hope that it will be useful, 17 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 GNU General Public License, version 2.0, for more details. 20 21 You should have received a copy of the GNU General Public License 22 along with this program; if not, write to the Free Software 23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 24 */ 25 26 package testsuite.clusterj; 27 28 import testsuite.clusterj.model.AllPrimitives; 29 30 public class QueryNotTest extends AbstractQueryTest { 31 32 @Override getInstanceType()33 public Class<?> getInstanceType() { 34 return AllPrimitives.class; 35 } 36 37 @Override createInstances(int number)38 void createInstances(int number) { 39 createAllPrimitivesInstances(10); 40 } 41 42 /** Test "not" queries using AllPrimitives. 43 drop table if exists allprimitives; 44 create table allprimitives ( 45 id int not null primary key, 46 47 int_not_null_hash int not null, 48 int_not_null_btree int not null, 49 int_not_null_both int not null, 50 int_not_null_none int not null, 51 int_null_hash int, 52 int_null_btree int, 53 int_null_both int, 54 int_null_none int, 55 56 byte_not_null_hash tinyint not null, 57 byte_not_null_btree tinyint not null, 58 byte_not_null_both tinyint not null, 59 byte_not_null_none tinyint not null, 60 byte_null_hash tinyint, 61 byte_null_btree tinyint, 62 byte_null_both tinyint, 63 byte_null_none tinyint, 64 65 short_not_null_hash smallint not null, 66 short_not_null_btree smallint not null, 67 short_not_null_both smallint not null, 68 short_not_null_none smallint not null, 69 short_null_hash smallint, 70 short_null_btree smallint, 71 short_null_both smallint, 72 short_null_none smallint, 73 74 long_not_null_hash bigint not null, 75 long_not_null_btree bigint not null, 76 long_not_null_both bigint not null, 77 long_not_null_none bigint not null, 78 long_null_hash bigint, 79 long_null_btree bigint, 80 long_null_both bigint, 81 long_null_none bigint 82 */ 83 test()84 public void test() { 85 btreeIndexScanInt(); 86 failOnError(); 87 } 88 btreeIndexScanInt()89 public void btreeIndexScanInt() { 90 notEqualQuery("int_not_null_btree", "none", 8, 0, 1, 2, 3, 4, 5, 6, 7, 9); 91 notNotEqualQuery("int_not_null_btree", "none", 8, 8); 92 notNotNotEqualQuery("int_not_null_btree", "none", 8, 0, 1, 2, 3, 4, 5, 6, 7, 9); 93 notGreaterEqualQuery("int_not_null_btree", "none", 7, 0, 1, 2, 3, 4, 5, 6); 94 notGreaterThanQuery("int_not_null_btree", "none", 6, 0, 1, 2, 3, 4, 5, 6); 95 notLessEqualQuery("int_not_null_btree", "none", 4, 5, 6, 7, 8, 9); 96 notLessThanQuery("int_not_null_btree", "none", 4, 4, 5, 6, 7, 8, 9); 97 notBetweenQuery("int_not_null_btree", "none", 4, 6, 0, 1, 2, 3, 7, 8, 9); 98 greaterEqualAndNotGreaterEqualQuery("int_not_null_btree", "idx_int_not_null_btree", 4, 6, 4, 5); 99 greaterThanAndNotGreaterEqualQuery("int_not_null_btree", "idx_int_not_null_btree", 4, 6, 5); 100 greaterEqualAndNotGreaterThanQuery("int_not_null_btree", "idx_int_not_null_btree", 4, 6, 4, 5, 6); 101 greaterThanAndNotGreaterThanQuery("int_not_null_btree", "idx_int_not_null_btree", 4, 6, 5, 6); 102 103 notEqualQuery("int_null_btree", "none", 8, 0, 1, 2, 3, 4, 5, 6, 7, 9); 104 notNotEqualQuery("int_null_btree", "none", 8, 8); 105 notNotNotEqualQuery("int_null_btree", "none", 8, 0, 1, 2, 3, 4, 5, 6, 7, 9); 106 notGreaterEqualQuery("int_null_btree", "none", 7, 0, 1, 2, 3, 4, 5, 6); 107 notGreaterThanQuery("int_null_btree", "none", 6, 0, 1, 2, 3, 4, 5, 6); 108 notLessEqualQuery("int_null_btree", "none", 4, 5, 6, 7, 8, 9); 109 notLessThanQuery("int_null_btree", "none", 4, 4, 5, 6, 7, 8, 9); 110 notBetweenQuery("int_null_btree", "none", 4, 6, 0, 1, 2, 3, 7, 8, 9); 111 greaterEqualAndNotGreaterEqualQuery("int_null_btree", "idx_int_null_btree", 4, 6, 4, 5); 112 greaterThanAndNotGreaterEqualQuery("int_null_btree", "idx_int_null_btree", 4, 6, 5); 113 greaterEqualAndNotGreaterThanQuery("int_null_btree", "idx_int_null_btree", 4, 6, 4, 5, 6); 114 greaterThanAndNotGreaterThanQuery("int_null_btree", "idx_int_null_btree", 4, 6, 5, 6); 115 } 116 117 } 118