MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DeleteQueryAllPrimitivesTest.java
1 /*
2  Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 package testsuite.clusterj;
19 
20 import testsuite.clusterj.model.AllPrimitives;
21 import testsuite.clusterj.model.IdBase;
22 
24 
25  @Override
26  public Class getInstanceType() {
27  return AllPrimitives.class;
28  }
29 
30  @Override
31  void createInstances(int number) {
32  createAllPrimitivesInstances(10);
33  }
34 
78  deleteEqualQuery("id", "PRIMARY", 8, 1);
79  deleteEqualQuery("id", "PRIMARY", 8, 0);
80  equalQuery("id", "PRIMARY", 8);
81  failOnError();
82  }
83 
84  public void testDeleteEqualByUniqueKey() {
85  deleteEqualQuery("int_not_null_hash", "idx_int_not_null_hash", 8, 1);
86  deleteEqualQuery("int_not_null_hash", "idx_int_not_null_hash", 8, 0);
87  equalQuery("int_not_null_hash", "idx_int_not_null_hash", 8);
88  failOnError();
89  }
90 
91  public void testDeleteEqualByBtreeIndex() {
92  deleteEqualQuery("int_not_null_btree", "idx_int_not_null_btree", 8, 1);
93  deleteEqualQuery("int_not_null_btree", "idx_int_not_null_btree", 8, 0);
94  equalQuery("int_not_null_btree", "idx_int_not_null_btree", 8);
95  failOnError();
96  }
97 
98  public void testDeleteEqualByTableScan() {
99  deleteEqualQuery("int_not_null_none", "none", 8, 1);
100  deleteEqualQuery("int_not_null_none", "none", 8, 0);
101  equalQuery("int_not_null_none", "none", 8);
102  failOnError();
103  }
104 
105  public void testDeleteRangeByBtreeIndex() {
106  deleteGreaterThanAndLessThanQuery("int_not_null_btree", "idx_int_not_null_btree", 4, 7, 2);
107  deleteGreaterThanAndLessThanQuery("int_not_null_btree", "idx_int_not_null_btree", 4, 7, 0);
108  betweenQuery("int_not_null_btree", "idx_int_not_null_btree", 3, 8, 3, 4, 7, 8);
109  failOnError();
110  }
111 
112  public void testDeleteRangeByTableScan() {
113  deleteGreaterThanAndLessThanQuery("int_not_null_none", "none", 4, 7, 2);
114  deleteGreaterThanAndLessThanQuery("int_not_null_none", "none", 4, 7, 0);
115  betweenQuery("int_not_null_btree", "idx_int_not_null_btree", 3, 8, 3, 4, 7, 8);
116  failOnError();
117  }
118 
119  public void testDeleteEqualByPrimaryKeyAutotransaction() {
120  setAutotransaction(true);
121  deleteEqualQuery("id", "PRIMARY", 8, 1);
122  deleteEqualQuery("id", "PRIMARY", 8, 0);
123  equalQuery("id", "PRIMARY", 8);
124  failOnError();
125  }
126 
127  public void testDeleteEqualByUniqueKeyAutotransaction() {
128  setAutotransaction(true);
129  deleteEqualQuery("int_not_null_hash", "idx_int_not_null_hash", 8, 1);
130  deleteEqualQuery("int_not_null_hash", "idx_int_not_null_hash", 8, 0);
131  equalQuery("int_not_null_hash", "idx_int_not_null_hash", 8);
132  failOnError();
133  }
134 
135  public void testDeleteEqualByBtreeIndexAutotransaction() {
136  setAutotransaction(true);
137  deleteEqualQuery("int_not_null_btree", "idx_int_not_null_btree", 8, 1);
138  deleteEqualQuery("int_not_null_btree", "idx_int_not_null_btree", 8, 0);
139  equalQuery("int_not_null_btree", "idx_int_not_null_btree", 8);
140  failOnError();
141  }
142 
143  public void testDeleteEqualByTableScanAutotransaction() {
144  setAutotransaction(true);
145  deleteEqualQuery("int_not_null_none", "none", 8, 1);
146  deleteEqualQuery("int_not_null_none", "none", 8, 0);
147  equalQuery("int_not_null_none", "none", 8);
148  failOnError();
149  }
150 
151  public void testDeleteRangeByBtreeIndexAutotransaction() {
152  setAutotransaction(true);
153  deleteGreaterThanAndLessThanQuery("int_not_null_btree", "idx_int_not_null_btree", 4, 7, 2);
154  deleteGreaterThanAndLessThanQuery("int_not_null_btree", "idx_int_not_null_btree", 4, 7, 0);
155  betweenQuery("int_not_null_btree", "idx_int_not_null_btree", 3, 8, 3, 4, 7, 8);
156  failOnError();
157  }
158 
159  public void testDeleteRangeByTableScanAutotransaction() {
160  setAutotransaction(true);
161  deleteGreaterThanAndLessThanQuery("int_not_null_none", "none", 4, 7, 2);
162  deleteGreaterThanAndLessThanQuery("int_not_null_none", "none", 4, 7, 0);
163  betweenQuery("int_not_null_btree", "idx_int_not_null_btree", 3, 8, 3, 4, 7, 8);
164  failOnError();
165  }
166 
167 }