1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
|
--source include/have_tokudb.inc
SET DEFAULT_STORAGE_ENGINE = 'tokudb';
--disable_warnings
DROP TABLE IF EXISTS t1,t2;
--enable_warnings
#
# test create and drop
#
create table t1 (a int, b int, c int, key(a), key(b));
DROP TABLE t1;
create table t1 (a int, b int, c int, primary key(a), key(b));
DROP TABLE t1;
#
# test create, open and drop
#
create table t1 (a int, b int, c int, key(a), key(b));
insert into t1 values (1,10,100);
select * from t1;
DROP TABLE t1;
create table t1 (a int, b int, c int, primary key(a), key(b));
insert into t1 values (1,10,100);
select * from t1;
DROP TABLE t1;
#
# test create, rename, drop
#
create table t1 (a int, b int, c int, key(a), key(b));
rename table t1 to t2;
DROP TABLE t2;
create table t1 (a int, b int, c int, primary key(a), key(b));
rename table t1 to t2;
DROP TABLE t2;
#
# test create, open, rename, drop
#
create table t1 (a int, b int, c int, key(a), key(b));
insert into t1 values (1,10,100);
select * from t1;
rename table t1 to t2;
select * from t2;
DROP TABLE t2;
create table t1 (a int, b int, c int, primary key(a), key(b));
insert into t1 values (1,10,100);
select * from t1;
rename table t1 to t2;
select * from t2;
DROP TABLE t2;
#
# test create, rename, open, drop
#
create table t1 (a int, b int, c int, key(a), key(b));
rename table t1 to t2;
insert into t2 values (1,10,100);
select * from t2;
DROP TABLE t2;
create table t1 (a int, b int, c int, primary key(a), key(b));
rename table t1 to t2;
insert into t2 values (1,10,100);
select * from t2;
DROP TABLE t2;
#
# test create, add index, drop
#
create table t1 (a int, b int, c int, key(a), key(b));
alter table t1 add index (c), add index (a,b);
DROP TABLE t1;
create table t1 (a int, b int, c int, primary key(a), key(b));
alter table t1 add index (c), add index (a,b);
DROP TABLE t1;
#
# test create, drop index, drop
#
create table t1 (a int, b int, c int, key(a), key(b));
alter table t1 drop index b;
DROP TABLE t1;
create table t1 (a int, b int, c int, primary key(a), key(b));
alter table t1 drop index b;
DROP TABLE t1;
#
# test add index, but with elements inserted and checked
#
create table t1 (a int, b int, c int, key(a), key(b));
insert into t1 values (1,10,100);
alter table t1 add index (c), add index (a,b);
select c from t1;
select a,b from t1;
DROP TABLE t1;
create table t1 (a int, b int, c int, primary key(a), key(b));
insert into t1 values (1,10,100);
alter table t1 add index (c), add index (a,b);
select c from t1;
select a,b from t1;
DROP TABLE t1;
#
# test create, add index, drop index, drop
#
create table t1 (a int, b int, c int, key(a), key(b));
alter table t1 add index (c), add index (a,b), drop index b;
DROP TABLE t1;
create table t1 (a int, b int, c int, primary key(a), key(b));
alter table t1 add index (c), add index (a,b), drop index b;
DROP TABLE t1;
#
# test create, add index, drop index, drop, with elements
#
create table t1 (a int, b int, c int, key(a), key(b));
insert into t1 values (1,10,100);
alter table t1 add index (c), add index foo (a,b), drop index b;
select c from t1;
select a,b from t1 use index (foo);
DROP TABLE t1;
create table t1 (a int, b int, c int, primary key(a), key(b));
insert into t1 values (1,10,100);
alter table t1 add index (c), add index foo (a,b), drop index b;
select c from t1;
select a,b from t1 use index (foo);
DROP TABLE t1;
#
# truncate
#
create table t1 (a int, b int, c int, key(a), key(b));
insert into t1 values (1,10,100);
select * from t1;
truncate table t1;
insert into t1 values (2,20,200);
select * from t1;
DROP TABLE t1;
create table t1 (a int, b int, c int, primary key(a), key(b));
insert into t1 values (1,10,100);
select * from t1;
truncate table t1;
insert into t1 values (2,20,200);
select * from t1;
DROP TABLE t1;
#
# do everything
#
create table t1 (a int, b int, c int, key(a), key(b));
insert into t1 values (1,10,100);
select * from t1;
alter table t1 add index (c), drop index b;
select c from t1;
rename table t1 to t2;
select * from t2;
alter table t2 add index (b), drop index c;
select b from t2;
truncate table t2;
insert into t2 values (2,20,200);
select * From t2;
drop table t2;
|