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 jdbctest;
19 
21 
64  @Override
65  public String tableName() {
66  return "allprimitives";
67  }
68 
69  @Override
70  public void createInstances(int numberOfInstances) {
71  for (int i = 0; i < numberOfInstances; ++i) {
72  createAllPrimitiveInstance(i);
73  }
74  }
75 
76  public void testDeleteEqualByPrimaryKey() {
77  deleteEqualQuery("id", "PRIMARY", 8, 1);
78  deleteEqualQuery("id", "PRIMARY", 8, 0);
79  equalQuery("id", "PRIMARY", 8);
80  failOnError();
81  }
82 
83  public void testDeleteEqualByUniqueKey() {
84  deleteEqualQuery("int_not_null_hash", "idx_int_not_null_hash", 8, 1);
85  deleteEqualQuery("int_not_null_hash", "idx_int_not_null_hash", 8, 0);
86  equalQuery("int_not_null_hash", "idx_int_not_null_hash", 8);
87  failOnError();
88  }
89 
90  public void testDeleteEqualByBtreeIndex() {
91  deleteEqualQuery("int_not_null_btree", "idx_int_not_null_btree", 8, 1);
92  deleteEqualQuery("int_not_null_btree", "idx_int_not_null_btree", 8, 0);
93  equalQuery("int_not_null_btree", "idx_int_not_null_btree", 8);
94  failOnError();
95  }
96 
97  public void testDeleteEqualByTableScan() {
98  deleteEqualQuery("int_not_null_none", "none", 8, 1);
99  deleteEqualQuery("int_not_null_none", "none", 8, 0);
100  equalQuery("int_not_null_none", "none", 8);
101  failOnError();
102  }
103 
104  public void testDeleteRangeByBtreeIndex() {
105  deleteGreaterThanAndLessThanQuery("int_not_null_btree", "idx_int_not_null_btree", 4, 7, 2);
106  deleteGreaterThanAndLessThanQuery("int_not_null_btree", "idx_int_not_null_btree", 4, 7, 0);
107  betweenQuery("int_not_null_btree", "idx_int_not_null_btree", 3, 8, 3, 4, 7, 8);
108  failOnError();
109  }
110 
111  public void testDeleteRangeByTableScan() {
112  deleteGreaterThanAndLessThanQuery("int_not_null_none", "none", 4, 7, 2);
113  deleteGreaterThanAndLessThanQuery("int_not_null_none", "none", 4, 7, 0);
114  betweenQuery("int_not_null_btree", "idx_int_not_null_btree", 3, 8, 3, 4, 7, 8);
115  failOnError();
116  }
117 
118 }