mirror of
https://github.com/MariaDB/server.git
synced 2025-01-26 08:44:33 +01:00
2dbd26932d
MDEV-7282 SP: CREATE OR REPLACE, CREATE IF NOT EXISTS
81 lines
1.8 KiB
Text
81 lines
1.8 KiB
Text
--source include/master-slave.inc
|
|
|
|
connection master;
|
|
CREATE TABLE t1 (id INT);
|
|
DELIMITER $$;
|
|
CREATE PROCEDURE proc1 (OUT cnt INT) BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
|
|
DELIMITER ;$$
|
|
CALL proc1(@cnt);
|
|
SELECT @cnt;
|
|
INSERT INTO t1 VALUES (1), (2), (3);
|
|
CALL proc1(@cnt);
|
|
SELECT @cnt;
|
|
|
|
--echo # Syncing with slave
|
|
sync_slave_with_master;
|
|
|
|
CALL proc1(@cnt);
|
|
SELECT @cnt;
|
|
|
|
connection master;
|
|
DELIMITER $$;
|
|
--error ER_SP_ALREADY_EXISTS
|
|
CREATE PROCEDURE proc1 (OUT cnt INT) BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
|
|
|
|
CREATE PROCEDURE IF NOT EXISTS proc1 (OUT cnt INT) BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
|
|
|
|
--error ER_WRONG_USAGE
|
|
CREATE OR REPLACE PROCEDURE IF NOT EXISTS proc1 (OUT cnt INT) BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
|
|
|
|
CREATE OR REPLACE PROCEDURE proc1 (OUT cnt INT) BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
|
|
DELIMITER ;$$
|
|
|
|
--echo # Syncing with slave
|
|
sync_slave_with_master;
|
|
|
|
CALL proc1(@cnt);
|
|
SELECT @cnt;
|
|
|
|
connection master;
|
|
DROP PROCEDURE proc1;
|
|
DELIMITER $$;
|
|
CREATE PROCEDURE IF NOT EXISTS proc1 (OUT cnt INT) BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
|
|
DELIMITER ;$$
|
|
INSERT INTO t1 VALUES (1), (2), (3);
|
|
CALL proc1(@cnt);
|
|
SELECT @cnt;
|
|
|
|
--echo # Syncing with slave
|
|
sync_slave_with_master;
|
|
|
|
CALL proc1(@cnt);
|
|
SELECT @cnt;
|
|
|
|
connection master;
|
|
DROP PROCEDURE proc1;
|
|
DELIMITER $$;
|
|
CREATE OR REPLACE PROCEDURE proc1 (OUT cnt INT) BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
|
|
DELIMITER ;$$
|
|
INSERT INTO t1 VALUES (1), (2), (3);
|
|
CALL proc1(@cnt);
|
|
SELECT @cnt;
|
|
|
|
--echo # Syncing with slave
|
|
sync_slave_with_master;
|
|
|
|
CALL proc1(@cnt);
|
|
SELECT @cnt;
|
|
|
|
connection master;
|
|
DROP TABLE IF EXISTS t1;
|
|
DROP PROCEDURE proc1;
|
|
|
|
DROP PROCEDURE IF EXISTS proc2;
|
|
|
|
--echo # Syncing with slave
|
|
sync_slave_with_master;
|
|
|
|
--error ER_SP_DOES_NOT_EXIST
|
|
DROP PROCEDURE proc1;
|
|
|
|
--source include/rpl_end.inc
|