Loading mysql-test/r/ndb_alter_table.result +45 −0 Original line number Diff line number Diff line Loading @@ -354,3 +354,48 @@ select * from t1 where a = 12; a b c 12 403 NULL drop table t1; create table t1 (a int not null, b varchar(10)) engine=ndb; show index from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment alter table t1 add primary key (a); show index from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 0 PRIMARY 1 a A 0 NULL NULL BTREE alter table t1 drop primary key; show index from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment drop table t1; create table t1 (a int not null primary key, b int not null default 0, c varchar(254)) engine=ndb; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` int(11) NOT NULL DEFAULT '0', `c` varchar(254) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 alter table t1 alter b set default 1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` int(11) NOT NULL DEFAULT '1', `c` varchar(254) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int not null, b int not null) engine=ndb; insert into t1 values (1, 300), (2, 200), (3, 100); select * from t1; a b 3 100 2 200 1 300 alter table t1 order by b; select * from t1; a b 1 300 2 200 3 100 drop table t1; End of 5.1 tests mysql-test/r/ndb_basic.result +76 −0 Original line number Diff line number Diff line Loading @@ -773,4 +773,80 @@ a b 2 2 3 3 drop table t1, t2; create table t1 (a int not null primary key, b int not null default 0, c varchar(254)) engine=ndb; create table if not exists t1 (a int not null primary key, b int not null default 0, c varchar(254)) engine=ndb; create table t2 like t1; rename table t1 to t10, t2 to t20; drop table t10,t20; create table t1 (a int not null primary key, b int not null) engine=ndb; create table t2 (a int not null primary key, b int not null) engine=ndb; insert into t1 values (1,10), (2,20), (3,30); insert into t2 values (1,10), (2,20), (3,30); select * from t1 order by a; a b 1 10 2 20 3 30 delete from t1 where a > 0 order by a desc limit 1; select * from t1 order by a; a b 1 10 2 20 delete from t1,t2 using t1,t2 where t1.a = t2.a; select * from t2 order by a; a b 3 30 drop table t1,t2; create table t1 (a int not null primary key, b int not null) engine=ndb; insert into t1 values (1,10), (2,20), (3,30); insert into t1 set a=1, b=100; ERROR 23000: Duplicate entry '1' for key 'PRIMARY' insert ignore into t1 set a=1, b=100; select * from t1 order by a; a b 1 10 2 20 3 30 insert into t1 set a=1, b=1000 on duplicate key update b=b+1; select * from t1 order by a; a b 1 11 2 20 3 30 drop table t1; create table t1 (a int not null primary key, b int not null) engine=ndb; create table t2 (c int not null primary key, d int not null) engine=ndb; insert into t1 values (1,10), (2,10), (3,30), (4, 30); insert into t2 values (1,10), (2,10), (3,30), (4, 30); update t1 set a = 1 where a = 3; ERROR 23000: Duplicate entry '1' for key 'PRIMARY' select * from t1 order by a; a b 1 10 2 10 3 30 4 30 update t1 set b = 1 where a > 1 order by a desc limit 1; select * from t1 order by a; a b 1 10 2 10 3 30 4 1 update t1,t2 set a = 1, c = 1 where a = 3 and c = 3; ERROR 23000: Duplicate entry '1' for key 'PRIMARY' select * from t1 order by a; a b 1 10 2 10 3 30 4 1 update ignore t1,t2 set a = 1, c = 1 where a = 3 and c = 3; select * from t1 order by a; a b 1 10 2 10 3 1 4 1 drop table t1,t2; End of 5.1 tests mysql-test/r/ndb_cursor.result 0 → 100644 +39 −0 Original line number Diff line number Diff line drop table if exists t1; drop table if exists t2; create table t1 ( a int not null primary key, b int not null ) engine=ndb; create table t2 ( a int not null primary key, b int not null ) engine=ndb; insert into t1 values (1,10), (2,20), (3,30), (4, 40); create procedure test_cursor () begin declare done int default 0; declare temp_a int; declare temp_b int; declare cur1 cursor for select a,b from t1; declare continue handler for sqlstate '02000' set done = 1; open cur1; repeat fetch cur1 into temp_a, temp_b; if not done then insert into t2 values (temp_a, temp_b); end if; until done end repeat; close cur1; end; // select * from t2 order by a; a b call test_cursor(); select * from t2 order by a; a b 1 10 2 20 3 30 4 40 drop table t1,t2; end of 5.1 tests mysql-test/r/ndb_sp.result 0 → 100644 +45 −0 Original line number Diff line number Diff line drop table if exists t1; drop table if exists t2; create table t1 ( a int not null primary key, b int not null ) engine=ndb; insert into t1 values (1,10), (2,20), (3,100), (4, 100); create procedure test_proc1 (in var_in int) begin select * from t1 where a = var_in; end; create procedure test_proc2 (out var_out int) begin select b from t1 where a = 1 into var_out; end; create procedure test_proc3 (inout var_inout int) begin select b from t1 where a = var_inout into var_inout; end; // call test_proc1(1); a b 1 10 call test_proc2(@test_var); select @test_var; @test_var 10 set @test_var = 1; call test_proc3(@test_var); select @test_var; @test_var 10 alter procedure test_proc1 comment 'new comment'; show create procedure test_proc1; Procedure sql_mode Create Procedure test_proc1 CREATE DEFINER=`root`@`localhost` PROCEDURE `test_proc1`(in var_in int) COMMENT 'new comment' begin select * from t1 where a = var_in; end drop procedure test_proc1; drop procedure test_proc2; drop procedure test_proc3; drop table t1; End of 5.1 tests mysql-test/r/ndb_subquery.result +35 −4 Original line number Diff line number Diff line drop table if exists t1; drop table if exists t2; drop table if exists t1, t2, t3, t4; create table t1 (p int not null primary key, u int not null, o int not null, unique (u), key(o)) engine=ndb; create table t2 (p int not null primary key, u int not null, o int not null, unique (u), key(o)) engine=ndb; create table t3 (a int not null primary key, b int not null) engine=ndb; create table t4 (c int not null primary key, d int not null) engine=ndb; insert into t1 values (1,1,1),(2,2,2),(3,3,3); insert into t2 values (1,1,1),(2,2,2),(3,3,3), (4,4,4), (5,5,5); insert into t3 values (1,10), (2,10), (3,30), (4, 30); insert into t4 values (1,10), (2,10), (3,30), (4, 30); explain select * from t2 where p NOT IN (select p from t1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL # Using where Loading Loading @@ -57,5 +60,33 @@ p u 1 1 2 2 3 3 drop table t1; drop table t2; select * from t3 where a = any (select c from t4 where c = 1) order by a; a b 1 10 select * from t3 where a in (select c from t4 where c = 1) order by a; a b 1 10 select * from t3 where a <> some (select c from t4 where c = 1) order by a; a b 2 10 3 30 4 30 select * from t3 where a > all (select c from t4 where c = 1) order by a; a b 2 10 3 30 4 30 select * from t3 where row(1,10) = (select c,d from t4 where c = 1) order by a; a b 1 10 2 10 3 30 4 30 select * from t3 where exists (select * from t4 where c = 1) order by a; a b 1 10 2 10 3 30 4 30 drop table if exists t1, t2, t3, t4; End of 5.1 tests Loading
mysql-test/r/ndb_alter_table.result +45 −0 Original line number Diff line number Diff line Loading @@ -354,3 +354,48 @@ select * from t1 where a = 12; a b c 12 403 NULL drop table t1; create table t1 (a int not null, b varchar(10)) engine=ndb; show index from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment alter table t1 add primary key (a); show index from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 0 PRIMARY 1 a A 0 NULL NULL BTREE alter table t1 drop primary key; show index from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment drop table t1; create table t1 (a int not null primary key, b int not null default 0, c varchar(254)) engine=ndb; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` int(11) NOT NULL DEFAULT '0', `c` varchar(254) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 alter table t1 alter b set default 1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` int(11) NOT NULL DEFAULT '1', `c` varchar(254) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int not null, b int not null) engine=ndb; insert into t1 values (1, 300), (2, 200), (3, 100); select * from t1; a b 3 100 2 200 1 300 alter table t1 order by b; select * from t1; a b 1 300 2 200 3 100 drop table t1; End of 5.1 tests
mysql-test/r/ndb_basic.result +76 −0 Original line number Diff line number Diff line Loading @@ -773,4 +773,80 @@ a b 2 2 3 3 drop table t1, t2; create table t1 (a int not null primary key, b int not null default 0, c varchar(254)) engine=ndb; create table if not exists t1 (a int not null primary key, b int not null default 0, c varchar(254)) engine=ndb; create table t2 like t1; rename table t1 to t10, t2 to t20; drop table t10,t20; create table t1 (a int not null primary key, b int not null) engine=ndb; create table t2 (a int not null primary key, b int not null) engine=ndb; insert into t1 values (1,10), (2,20), (3,30); insert into t2 values (1,10), (2,20), (3,30); select * from t1 order by a; a b 1 10 2 20 3 30 delete from t1 where a > 0 order by a desc limit 1; select * from t1 order by a; a b 1 10 2 20 delete from t1,t2 using t1,t2 where t1.a = t2.a; select * from t2 order by a; a b 3 30 drop table t1,t2; create table t1 (a int not null primary key, b int not null) engine=ndb; insert into t1 values (1,10), (2,20), (3,30); insert into t1 set a=1, b=100; ERROR 23000: Duplicate entry '1' for key 'PRIMARY' insert ignore into t1 set a=1, b=100; select * from t1 order by a; a b 1 10 2 20 3 30 insert into t1 set a=1, b=1000 on duplicate key update b=b+1; select * from t1 order by a; a b 1 11 2 20 3 30 drop table t1; create table t1 (a int not null primary key, b int not null) engine=ndb; create table t2 (c int not null primary key, d int not null) engine=ndb; insert into t1 values (1,10), (2,10), (3,30), (4, 30); insert into t2 values (1,10), (2,10), (3,30), (4, 30); update t1 set a = 1 where a = 3; ERROR 23000: Duplicate entry '1' for key 'PRIMARY' select * from t1 order by a; a b 1 10 2 10 3 30 4 30 update t1 set b = 1 where a > 1 order by a desc limit 1; select * from t1 order by a; a b 1 10 2 10 3 30 4 1 update t1,t2 set a = 1, c = 1 where a = 3 and c = 3; ERROR 23000: Duplicate entry '1' for key 'PRIMARY' select * from t1 order by a; a b 1 10 2 10 3 30 4 1 update ignore t1,t2 set a = 1, c = 1 where a = 3 and c = 3; select * from t1 order by a; a b 1 10 2 10 3 1 4 1 drop table t1,t2; End of 5.1 tests
mysql-test/r/ndb_cursor.result 0 → 100644 +39 −0 Original line number Diff line number Diff line drop table if exists t1; drop table if exists t2; create table t1 ( a int not null primary key, b int not null ) engine=ndb; create table t2 ( a int not null primary key, b int not null ) engine=ndb; insert into t1 values (1,10), (2,20), (3,30), (4, 40); create procedure test_cursor () begin declare done int default 0; declare temp_a int; declare temp_b int; declare cur1 cursor for select a,b from t1; declare continue handler for sqlstate '02000' set done = 1; open cur1; repeat fetch cur1 into temp_a, temp_b; if not done then insert into t2 values (temp_a, temp_b); end if; until done end repeat; close cur1; end; // select * from t2 order by a; a b call test_cursor(); select * from t2 order by a; a b 1 10 2 20 3 30 4 40 drop table t1,t2; end of 5.1 tests
mysql-test/r/ndb_sp.result 0 → 100644 +45 −0 Original line number Diff line number Diff line drop table if exists t1; drop table if exists t2; create table t1 ( a int not null primary key, b int not null ) engine=ndb; insert into t1 values (1,10), (2,20), (3,100), (4, 100); create procedure test_proc1 (in var_in int) begin select * from t1 where a = var_in; end; create procedure test_proc2 (out var_out int) begin select b from t1 where a = 1 into var_out; end; create procedure test_proc3 (inout var_inout int) begin select b from t1 where a = var_inout into var_inout; end; // call test_proc1(1); a b 1 10 call test_proc2(@test_var); select @test_var; @test_var 10 set @test_var = 1; call test_proc3(@test_var); select @test_var; @test_var 10 alter procedure test_proc1 comment 'new comment'; show create procedure test_proc1; Procedure sql_mode Create Procedure test_proc1 CREATE DEFINER=`root`@`localhost` PROCEDURE `test_proc1`(in var_in int) COMMENT 'new comment' begin select * from t1 where a = var_in; end drop procedure test_proc1; drop procedure test_proc2; drop procedure test_proc3; drop table t1; End of 5.1 tests
mysql-test/r/ndb_subquery.result +35 −4 Original line number Diff line number Diff line drop table if exists t1; drop table if exists t2; drop table if exists t1, t2, t3, t4; create table t1 (p int not null primary key, u int not null, o int not null, unique (u), key(o)) engine=ndb; create table t2 (p int not null primary key, u int not null, o int not null, unique (u), key(o)) engine=ndb; create table t3 (a int not null primary key, b int not null) engine=ndb; create table t4 (c int not null primary key, d int not null) engine=ndb; insert into t1 values (1,1,1),(2,2,2),(3,3,3); insert into t2 values (1,1,1),(2,2,2),(3,3,3), (4,4,4), (5,5,5); insert into t3 values (1,10), (2,10), (3,30), (4, 30); insert into t4 values (1,10), (2,10), (3,30), (4, 30); explain select * from t2 where p NOT IN (select p from t1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL # Using where Loading Loading @@ -57,5 +60,33 @@ p u 1 1 2 2 3 3 drop table t1; drop table t2; select * from t3 where a = any (select c from t4 where c = 1) order by a; a b 1 10 select * from t3 where a in (select c from t4 where c = 1) order by a; a b 1 10 select * from t3 where a <> some (select c from t4 where c = 1) order by a; a b 2 10 3 30 4 30 select * from t3 where a > all (select c from t4 where c = 1) order by a; a b 2 10 3 30 4 30 select * from t3 where row(1,10) = (select c,d from t4 where c = 1) order by a; a b 1 10 2 10 3 30 4 30 select * from t3 where exists (select * from t4 where c = 1) order by a; a b 1 10 2 10 3 30 4 30 drop table if exists t1, t2, t3, t4; End of 5.1 tests