⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 innodb.test

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 TEST
📖 第 1 页 / 共 5 页
字号:
checksum table t1;drop table t1;connection default;disconnect a;disconnect b;# tests for bugs #9802 and #13778# test that FKs between invalid types are not acceptedset foreign_key_checks=0;create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb;--replace_result $MYSQLTEST_VARDIR . master-data/ ''-- error 1005create table t1(a char(10) primary key, b varchar(20)) engine = innodb;set foreign_key_checks=1;drop table t2;# test that FKs between different charsets are not accepted in CREATE even# when f_k_c is 0set foreign_key_checks=0;create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;--replace_result $MYSQLTEST_VARDIR . master-data/ ''-- error 1005create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8;set foreign_key_checks=1;drop table t1;# test that invalid datatype conversions with ALTER are not allowedset foreign_key_checks=0;create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb;create table t1(a varchar(10) primary key) engine = innodb;-- error 1025,1025alter table t1 modify column a int;set foreign_key_checks=1;drop table t2,t1;# test that charset conversions with ALTER are allowed when f_k_c is 0set foreign_key_checks=0;create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;alter table t1 convert to character set utf8;set foreign_key_checks=1;drop table t2,t1;# test that RENAME does not allow invalid charsets when f_k_c is 0set foreign_key_checks=0;create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8;--replace_result $MYSQLTEST_VARDIR . master-data/ ''-- error 1025rename table t3 to t1;set foreign_key_checks=1;drop table t2,t3;# test that foreign key errors are reported correctly (Bug #15550)create table t1(a int primary key) row_format=redundant engine=innodb;create table t2(a int primary key,constraint foreign key(a)references t1(a)) row_format=compact engine=innodb;create table t3(a int primary key) row_format=compact engine=innodb;create table t4(a int primary key,constraint foreign key(a)references t3(a)) row_format=redundant engine=innodb;insert into t1 values(1);insert into t3 values(1);-- error 1452insert into t2 values(2);-- error 1452insert into t4 values(2);insert into t2 values(1);insert into t4 values(1);-- error 1451update t1 set a=2;-- error 1452update t2 set a=2;-- error 1451update t3 set a=2;-- error 1452update t4 set a=2;-- error 1451truncate t1;-- error 1451truncate t3;truncate t2;truncate t4;truncate t1;truncate t3;drop table t4,t3,t2,t1;## Test that we can create a large (>1K) key#create table t1 (a varchar(255) character set utf8,                 b varchar(255) character set utf8,                 c varchar(255) character set utf8,                 d varchar(255) character set utf8,                 key (a,b,c,d)) engine=innodb;drop table t1;--error ER_TOO_LONG_KEYcreate table t1 (a varchar(255) character set utf8,                 b varchar(255) character set utf8,                 c varchar(255) character set utf8,                 d varchar(255) character set utf8,                 e varchar(255) character set utf8,                 key (a,b,c,d,e)) engine=innodb;# test the padding of BINARY types and collations (Bug #14189)create table t1 (s1 varbinary(2),primary key (s1)) engine=innodb;create table t2 (s1 binary(2),primary key (s1)) engine=innodb;create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb;create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb;insert into t1 values (0x41),(0x4120),(0x4100);-- error 1062insert into t2 values (0x41),(0x4120),(0x4100);insert into t2 values (0x41),(0x4120);-- error 1062insert into t3 values (0x41),(0x4120),(0x4100);insert into t3 values (0x41),(0x4100);-- error 1062insert into t4 values (0x41),(0x4120),(0x4100);insert into t4 values (0x41),(0x4100);select hex(s1) from t1;select hex(s1) from t2;select hex(s1) from t3;select hex(s1) from t4;drop table t1,t2,t3,t4;create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=innodb;create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42);-- error 1452insert into t2 values(0x42);insert into t2 values(0x41);select hex(s1) from t2;update t1 set s1=0x123456 where a=2;select hex(s1) from t2;-- error 1451update t1 set s1=0x12 where a=1;-- error 1451update t1 set s1=0x12345678 where a=1;-- error 1451update t1 set s1=0x123457 where a=1;update t1 set s1=0x1220 where a=1;select hex(s1) from t2;update t1 set s1=0x1200 where a=1;select hex(s1) from t2;update t1 set s1=0x4200 where a=1;select hex(s1) from t2;-- error 1451delete from t1 where a=1;delete from t1 where a=2;update t2 set s1=0x4120;-- error 1451delete from t1;delete from t1 where a!=3;select a,hex(s1) from t1;select hex(s1) from t2;drop table t2,t1;create table t1 (a int primary key,s1 varchar(2) binary not null unique) engine=innodb;create table t2 (s1 char(2) binary not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;insert into t1 values(1,0x4100),(2,0x41);insert into t2 values(0x41);select hex(s1) from t2;update t1 set s1=0x1234 where a=1;select hex(s1) from t2;update t1 set s1=0x12 where a=2;select hex(s1) from t2;delete from t1 where a=1;-- error 1451delete from t1 where a=2;select a,hex(s1) from t1;select hex(s1) from t2;drop table t2,t1;# Ensure that <tablename>_ibfk_0 is not mistreated as a# generated foreign key identifier.  (Bug #16387)CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB;CREATE TABLE t2(a INT) ENGINE=InnoDB;ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a);ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1;ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a);ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0;SHOW CREATE TABLE t2;DROP TABLE t2,t1;## Test case for bug #16229: MySQL/InnoDB uses full explicit table locks in trigger processing#connect (a,localhost,root,,);connect (b,localhost,root,,);connection a;create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;insert into t1(a) values (1),(2),(3);commit;connection b;set autocommit = 0;update t1 set b = 5 where a = 2;connection a;delimiter |;create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |delimiter ;|set autocommit = 0;connection a;insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100),(11),(21),(31),(41),(51),(61),(71),(81),(91),(101),(12),(22),(32),(42),(52),(62),(72),(82),(92),(102),(13),(23),(33),(43),(53),(63),(73),(83),(93),(103),(14),(24),(34),(44),(54),(64),(74),(84),(94),(104);connection b;commit;connection a;commit;drop trigger t1t;drop table t1;disconnect a;disconnect b;## Another trigger test#connect (a,localhost,root,,);connect (b,localhost,root,,);connection a;create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;create table t2(a int not null, b int, c int, d int, primary key(a)) engine=innodb;create table t3(a int not null, b int, c int, d int, primary key(a)) engine=innodb;create table t4(a int not null, b int, c int, d int, primary key(a)) engine=innodb;create table t5(a int not null, b int, c int, d int, primary key(a)) engine=innodb;insert into t1(a) values (1),(2),(3);insert into t2(a) values (1),(2),(3);insert into t3(a) values (1),(2),(3);insert into t4(a) values (1),(2),(3);insert into t3(a) values (5),(7),(8);insert into t4(a) values (5),(7),(8);insert into t5(a) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12);delimiter |;create trigger t1t before insert on t1 for each row begin     INSERT INTO t2 SET a = NEW.a;end |create trigger t2t before insert on t2 for each row begin    DELETE FROM t3 WHERE a = NEW.a;end |create trigger t3t before delete on t3 for each row begin      UPDATE t4 SET b = b + 1 WHERE a = OLD.a;end |create trigger t4t before update on t4 for each row begin    UPDATE t5 SET b = b + 1 where a = NEW.a;end |delimiter ;|commit;set autocommit = 0;update t1 set b = b + 5 where a = 1;update t2 set b = b + 5 where a = 1;update t3 set b = b + 5 where a = 1;update t4 set b = b + 5 where a = 1;insert into t5(a) values(20);connection b;set autocommit = 0;insert into t1(a) values(7);insert into t2(a) values(8);delete from t2 where a = 3;update t4 set b = b + 1 where a = 3;commit;drop trigger t1t;drop trigger t2t;drop trigger t3t;drop trigger t4t;drop table t1, t2, t3, t4, t5;connection default;disconnect a;disconnect b;## Bug #14360: problem with intervals#create table t1(a date) engine=innodb;create table t2(a date, key(a)) engine=innodb;insert into t1 values('2005-10-01');insert into t2 values('2005-10-01');select * from t1, t2  where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;drop table t1, t2;# bug 18934, "InnoDB crashes when table uses column names like DB_ROW_ID"--replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ /--error 1005CREATE TABLE t1 (DB_ROW_ID int) engine=innodb;## Bug #17152: Wrong result with BINARY comparison on aliased column#CREATE TABLE t1 (   a BIGINT(20) NOT NULL,    PRIMARY KEY  (a) ) ENGINE=INNODB DEFAULT CHARSET=UTF8;CREATE TABLE t2 (  a BIGINT(20) NOT NULL,  b VARCHAR(128) NOT NULL,  c TEXT NOT NULL,  PRIMARY KEY  (a,b),  KEY idx_t2_b_c (b,c(200)),  CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a)    ON DELETE CASCADE ) ENGINE=INNODB DEFAULT CHARSET=UTF8;INSERT INTO t1 VALUES (1);INSERT INTO t2 VALUES (1, 'bar', 'vbar');INSERT INTO t2 VALUES (1, 'BAR2', 'VBAR');INSERT INTO t2 VALUES (1, 'bar_bar', 'bibi');INSERT INTO t2 VALUES (1, 'customer_over', '1');SELECT * FROM t2 WHERE b = 'customer_over';SELECT * FROM t2 WHERE BINARY b = 'customer_over';SELECT DISTINCT p0.a FROM t2 p0 WHERE p0.b = 'customer_over';/* Bang: Empty result set, above was expected: */SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';drop table t2, t1;## Bug #15680 (SPATIAL key in innodb)#--error ER_TABLE_CANT_HANDLE_SPKEYScreate table t1 (g geometry not null, spatial gk(g)) engine=innodb;## Bug #25927: Prevent ALTER TABLE ... MODIFY ... NOT NULL on columns# for which there is a foreign key constraint ON ... SET NULL.#CREATE TABLE t1 (a INT, INDEX(a)) ENGINE=InnoDB;CREATE TABLE t2 (a INT, INDEX(a)) ENGINE=InnoDB;INSERT INTO t1 VALUES (1);INSERT INTO t2 VALUES (1);ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL;--replace_regex /'\.\/test\/#sql-[0-9a-f_]*'/'#sql-temporary'/--error 1025ALTER TABLE t2 MODIFY a INT NOT NULL;DELETE FROM t1;DROP TABLE t2,t1;## Bug #26835: table corruption after delete+insert#CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY)ENGINE=InnoDB;INSERT INTO t1 VALUES (0xEFBCA4EFBCA4EFBCA4);DELETE FROM t1;INSERT INTO t1 VALUES ('DDD');SELECT * FROM t1;DROP TABLE t1;## Bug #23313 (AUTO_INCREMENT=# not reported back for InnoDB tables)# Bug #21404 (AUTO_INCREMENT value reset when Adding FKEY (or ALTER?))#CREATE TABLE t1 (id int PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDBAUTO_INCREMENT=42;INSERT INTO t1 VALUES (0),(347),(0);SELECT * FROM t1;SHOW CREATE TABLE t1;CREATE TABLE t2 (id int PRIMARY KEY) ENGINE=InnoDB;INSERT INTO t2 VALUES(42),(347),(348);ALTER TABLE t1 ADD CONSTRAINT t1_t2 FOREIGN KEY (id) REFERENCES t2(id);SHOW CREATE TABLE t1;DROP TABLE t1,t2;########################################################################                                                                     ## Please, DO NOT TOUCH this file as well as the innodb.result file.   ## These files are to be modified ONLY BY INNOBASE guys.               ##                                                                     ## Use innodb_mysql.[test|result] files instead.                       ##                                                                     ## If nevertheless you need to make some changes here, please, forward ## your commit message To: dev@innodb.com Cc: dev-innodb@mysql.com     ## (otherwise your changes may be erased).                             ##                                                                     ########################################################################

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -