1#############################################################################
2# Original Author: JBM                                                      #
3# Original Date: Aug/18/2005                                                #
4#############################################################################
5# TEST: To test the USER() and CURRENT_USER() in rbr                        #
6#############################################################################
7# Change Author: JBM
8# Change Date: 2006-01-16
9##########
10
11# Includes
12-- source include/have_binlog_format_row.inc
13-- source include/master-slave.inc
14set local sql_mode="";
15
16# Begin clean up test section
17connection master;
18--disable_warnings
19DROP DATABASE IF EXISTS mysqltest1;
20CREATE DATABASE mysqltest1;
21--enable_warnings
22
23# Section 1 test
24CREATE USER tester IDENTIFIED BY 'test';
25GRANT ALL ON mysqltest1.* TO 'tester'@'%' IDENTIFIED BY 'test';
26GRANT ALL ON mysqltest1.* TO ''@'localhost%';
27FLUSH PRIVILEGES;
28connect (m_1,localhost,tester,,mysqltest1);
29
30connection m_1;
31CREATE TABLE mysqltest1.t1 (a INT, users VARCHAR(255), PRIMARY KEY(a));
32INSERT INTO mysqltest1.t1 VALUES(1,USER());
33INSERT INTO mysqltest1.t1 VALUES(2,CURRENT_USER());
34delimiter |;
35create procedure mysqltest1.p1()
36begin
37 INSERT INTO mysqltest1.t1 VALUES(3,USER());
38 INSERT INTO mysqltest1.t1 VALUES(4,CURRENT_USER());
39end|
40delimiter ;|
41
42CALL mysqltest1.p1();
43connection master;
44SELECT * FROM mysqltest1.t1 ORDER BY a;
45--sync_slave_with_master
46SELECT * FROM mysqltest1.t1 ORDER BY a;
47
48connection master;
49# Lets cleanup
50
51DROP DATABASE mysqltest1;
52REVOKE ALL ON mysqltest1.* FROM 'tester'@'%';
53REVOKE ALL ON mysqltest1.* FROM ''@'localhost%';
54DROP USER tester@'%';
55DROP USER ''@'localhost%';
56FLUSH PRIVILEGES;
57--sync_slave_with_master
58# End of 5.0 test case
59--source include/rpl_end.inc
60