2014-12-15 17:41:15 +04:00
|
|
|
include/master-slave.inc
|
|
|
|
[connection master]
|
2016-03-25 20:51:22 +04:00
|
|
|
connection master;
|
2014-12-15 17:41:15 +04:00
|
|
|
CREATE FUNCTION hello (str CHAR(20)) RETURNS CHAR(50) DETERMINISTIC RETURN
|
|
|
|
CONCAT('Hello, ', str, '!');
|
|
|
|
CREATE FUNCTION hello (str CHAR(20)) RETURNS CHAR(50) DETERMINISTIC RETURN
|
|
|
|
CONCAT('Hello, ', str, '!');
|
|
|
|
ERROR 42000: FUNCTION hello already exists
|
2016-03-25 20:51:22 +04:00
|
|
|
connection slave;
|
2014-12-15 17:41:15 +04:00
|
|
|
SHOW CREATE FUNCTION hello;
|
|
|
|
Function sql_mode Create Function character_set_client collation_connection Database Collation
|
2015-08-11 18:45:38 +02:00
|
|
|
hello NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `hello`(str CHAR(20)) RETURNS char(50) CHARSET latin1
|
2014-12-15 17:41:15 +04:00
|
|
|
DETERMINISTIC
|
|
|
|
RETURN
|
|
|
|
CONCAT('Hello, ', str, '!') latin1 latin1_swedish_ci latin1_swedish_ci
|
2016-03-25 20:51:22 +04:00
|
|
|
connection master;
|
2014-12-15 17:41:15 +04:00
|
|
|
CREATE OR REPLACE FUNCTION IF NOT EXISTS hello (str CHAR(20)) RETURNS CHAR(50) DETERMINISTIC RETURN
|
|
|
|
CONCAT('Hello, ', str, '!');
|
|
|
|
ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS
|
|
|
|
CREATE OR REPLACE FUNCTION hello (str CHAR(20)) RETURNS CHAR(50) DETERMINISTIC RETURN
|
|
|
|
CONCAT('Hello, ', str, '!');
|
|
|
|
SELECT hello('master');
|
|
|
|
hello('master')
|
|
|
|
Hello, master!
|
2016-03-25 20:51:22 +04:00
|
|
|
connection slave;
|
2014-12-15 17:41:15 +04:00
|
|
|
SELECT hello('slave');
|
|
|
|
hello('slave')
|
|
|
|
Hello, slave!
|
2016-03-25 20:51:22 +04:00
|
|
|
connection master;
|
2014-12-15 17:41:15 +04:00
|
|
|
CREATE FUNCTION IF NOT EXISTS hello (str CHAR(20)) RETURNS CHAR(50) DETERMINISTIC RETURN
|
|
|
|
CONCAT('Hello, ', str, '!');
|
|
|
|
Warnings:
|
|
|
|
Note 1304 FUNCTION hello already exists
|
|
|
|
CREATE OR REPLACE FUNCTION bye (str CHAR(20)) RETURNS CHAR(50) DETERMINISTIC RETURN
|
|
|
|
CONCAT('Bye, ', str, '!');
|
|
|
|
SELECT hello('master');
|
|
|
|
hello('master')
|
|
|
|
Hello, master!
|
|
|
|
SELECT bye('master');
|
|
|
|
bye('master')
|
|
|
|
Bye, master!
|
2016-03-25 20:51:22 +04:00
|
|
|
connection slave;
|
2014-12-15 17:41:15 +04:00
|
|
|
SELECT hello('slave');
|
|
|
|
hello('slave')
|
|
|
|
Hello, slave!
|
|
|
|
SELECT bye('slave');
|
|
|
|
bye('slave')
|
|
|
|
Bye, slave!
|
2016-03-25 20:51:22 +04:00
|
|
|
connection master;
|
2014-12-15 17:41:15 +04:00
|
|
|
DROP FUNCTION hello;
|
|
|
|
DROP FUNCTION IF EXISTS bye;
|
2016-03-25 20:51:22 +04:00
|
|
|
connection slave;
|
2014-12-15 17:41:15 +04:00
|
|
|
DROP FUNCTION hello;
|
|
|
|
ERROR 42000: FUNCTION test.hello does not exist
|
|
|
|
DROP FUNCTION IF EXISTS bye;
|
|
|
|
Warnings:
|
|
|
|
Note 1305 FUNCTION test.bye does not exist
|
|
|
|
include/rpl_end.inc
|