mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
reenable tests from engines/funcs
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
connection slave;
|
||||
reset master;
|
||||
connection master;
|
||||
create table t1(n char(30));
|
||||
set @i1:=12345678901234, @i2:=-12345678901234, @i3:=0, @i4:=-1;
|
||||
set @s1:='This is a test', @r1:=12.5, @r2:=-12.5;
|
||||
@@ -23,6 +21,7 @@ set @a:=5;
|
||||
insert into t1 values (@a),(@a);
|
||||
select * from t1 where n = '<nonexistant>';
|
||||
n
|
||||
connection master1;
|
||||
insert into t1 values (@a),(@a),(@a*5);
|
||||
SELECT * FROM t1 ORDER BY n;
|
||||
n
|
||||
@@ -51,6 +50,7 @@ abcn1
|
||||
abcn1n2
|
||||
abc\def
|
||||
This is a test
|
||||
connection slave;
|
||||
SELECT * FROM t1 ORDER BY n;
|
||||
n
|
||||
NULL
|
||||
@@ -78,6 +78,235 @@ abcn1
|
||||
abcn1n2
|
||||
abc\def
|
||||
This is a test
|
||||
connection master;
|
||||
insert into t1 select * FROM (select @var1 union select @var2) AS t2;
|
||||
drop table t1;
|
||||
stop slave;
|
||||
End of 4.1 tests.
|
||||
DROP TABLE IF EXISTS t20;
|
||||
DROP TABLE IF EXISTS t21;
|
||||
DROP PROCEDURE IF EXISTS test.insert;
|
||||
CREATE TABLE t20 (a VARCHAR(20));
|
||||
CREATE TABLE t21 (a VARCHAR(20));
|
||||
CREATE PROCEDURE test.insert()
|
||||
BEGIN
|
||||
IF (@VAR)
|
||||
THEN
|
||||
INSERT INTO test.t20 VALUES ('SP_TRUE');
|
||||
ELSE
|
||||
INSERT INTO test.t20 VALUES ('SP_FALSE');
|
||||
END IF;
|
||||
END|
|
||||
CREATE TRIGGER test.insert_bi BEFORE INSERT
|
||||
ON test.t20 FOR EACH ROW
|
||||
BEGIN
|
||||
IF (@VAR)
|
||||
THEN
|
||||
INSERT INTO test.t21 VALUES ('TRIG_TRUE');
|
||||
ELSE
|
||||
INSERT INTO test.t21 VALUES ('TRIG_FALSE');
|
||||
END IF;
|
||||
END|
|
||||
connection slave;
|
||||
connection master;
|
||||
SET @VAR=0;
|
||||
CALL test.insert();
|
||||
SET @VAR=1;
|
||||
CALL test.insert();
|
||||
Check the tables for correct data
|
||||
SELECT * FROM t20;
|
||||
a
|
||||
SP_FALSE
|
||||
SP_TRUE
|
||||
SELECT * FROM t21;
|
||||
a
|
||||
TRIG_FALSE
|
||||
TRIG_TRUE
|
||||
connection slave;
|
||||
Check the tables for correct data and it matches master
|
||||
SELECT * FROM t20;
|
||||
a
|
||||
SP_FALSE
|
||||
SP_TRUE
|
||||
SELECT * FROM t21;
|
||||
a
|
||||
TRIG_FALSE
|
||||
TRIG_TRUE
|
||||
connection master;
|
||||
DROP TABLE t20;
|
||||
DROP TABLE t21;
|
||||
DROP PROCEDURE test.insert;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP FUNCTION IF EXISTS test.square;
|
||||
CREATE TABLE t1 (i INT);
|
||||
CREATE FUNCTION test.square() RETURNS INTEGER DETERMINISTIC RETURN
|
||||
(@var * @var);
|
||||
SET @var = 1;
|
||||
INSERT INTO t1 VALUES (square());
|
||||
SET @var = 2;
|
||||
INSERT INTO t1 VALUES (square());
|
||||
SET @var = 3;
|
||||
INSERT INTO t1 VALUES (square());
|
||||
SET @var = 4;
|
||||
INSERT INTO t1 VALUES (square());
|
||||
SET @var = 5;
|
||||
INSERT INTO t1 VALUES (square());
|
||||
Retrieve the values from the table
|
||||
SELECT * FROM t1;
|
||||
i
|
||||
1
|
||||
4
|
||||
9
|
||||
16
|
||||
25
|
||||
connection slave;
|
||||
Retrieve the values from the table and verify they are the same as on master
|
||||
SELECT * FROM t1;
|
||||
i
|
||||
1
|
||||
4
|
||||
9
|
||||
16
|
||||
25
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
DROP FUNCTION test.square;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
DROP FUNCTION IF EXISTS f2;
|
||||
CREATE TABLE t1(a int);
|
||||
CREATE FUNCTION f1() returns int deterministic BEGIN
|
||||
return @a;
|
||||
END |
|
||||
CREATE FUNCTION f2() returns int deterministic BEGIN
|
||||
IF (@b > 0) then
|
||||
SET @c = (@a + @b);
|
||||
else
|
||||
SET @c = (@a - 1);
|
||||
END if;
|
||||
return @c;
|
||||
END |
|
||||
connection slave;
|
||||
connection master;
|
||||
SET @a=500;
|
||||
INSERT INTO t1 values(f1());
|
||||
SET @b = 125;
|
||||
SET @c = 1;
|
||||
INSERT INTO t1 values(f2());
|
||||
Retrieve the values from the table
|
||||
connection slave;
|
||||
connection master;
|
||||
SELECT * from t1;
|
||||
a
|
||||
500
|
||||
625
|
||||
connection slave;
|
||||
Check the tables for correct data and it matches master
|
||||
SELECT * from t1;
|
||||
a
|
||||
500
|
||||
625
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
DROP FUNCTION f1;
|
||||
DROP FUNCTION f2;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
CREATE TABLE t1 (i int);
|
||||
CREATE TABLE t2 (k int);
|
||||
CREATE trigger t1_bi before INSERT on t1 for each row BEGIN
|
||||
INSERT INTO t2 values (@a);
|
||||
SET @a:=42;
|
||||
INSERT INTO t2 values (@a);
|
||||
END |
|
||||
connection slave;
|
||||
connection master;
|
||||
SET @a:=100;
|
||||
INSERT INTO t1 values (5);
|
||||
Check to see that data was inserted correctly in both tables
|
||||
SELECT * from t1;
|
||||
i
|
||||
5
|
||||
SELECT * from t2;
|
||||
k
|
||||
100
|
||||
42
|
||||
connection slave;
|
||||
Check the tables for correct data and it matches master
|
||||
SELECT * from t1;
|
||||
i
|
||||
5
|
||||
SELECT * from t2;
|
||||
k
|
||||
100
|
||||
42
|
||||
connection master;
|
||||
drop table t1, t2;
|
||||
connection master;
|
||||
create table t1(a int, b int);
|
||||
prepare s1 from 'insert into t1 values (@x:=@x+1, ?)';
|
||||
set @x=1;
|
||||
execute s1 using @x;
|
||||
select * from t1;
|
||||
a b
|
||||
2 1
|
||||
connection slave;
|
||||
connection slave;
|
||||
select * from t1;
|
||||
a b
|
||||
2 1
|
||||
connection master;
|
||||
drop table t1;
|
||||
connection master;
|
||||
create table t1(a int);
|
||||
insert into t1 values (1),(2);
|
||||
prepare s1 from 'insert into t1 select a from t1 limit ?';
|
||||
set @x='1.1';
|
||||
execute s1 using @x;
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
1
|
||||
connection slave;
|
||||
connection slave;
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
1
|
||||
connection master;
|
||||
drop table t1;
|
||||
End of 5.0 tests.
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
DROP FUNCTION IF EXISTS f2;
|
||||
CREATE TABLE t1 (i INT);
|
||||
CREATE FUNCTION f1() RETURNS INT RETURN @a;
|
||||
CREATE
|
||||
FUNCTION f2() RETURNS INT BEGIN
|
||||
INSERT INTO t1 VALUES (10 + @a);
|
||||
RETURN 0;
|
||||
END|
|
||||
connection slave;
|
||||
connection master;
|
||||
SET @a:=123;
|
||||
SELECT f1(), f2();
|
||||
f1() f2()
|
||||
123 0
|
||||
Check to see that data was inserted correctly
|
||||
INSERT INTO t1 VALUES(f1());
|
||||
SELECT * FROM t1;
|
||||
i
|
||||
133
|
||||
123
|
||||
connection slave;
|
||||
Check the table for correct data and it matches master
|
||||
SELECT * FROM t1;
|
||||
i
|
||||
133
|
||||
123
|
||||
connection master;
|
||||
DROP FUNCTION f1;
|
||||
DROP FUNCTION f2;
|
||||
DROP TABLE t1;
|
||||
connection slave;
|
||||
include/rpl_end.inc
|
||||
|
Reference in New Issue
Block a user