| 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 |
# Change: Added Order by for NDB |
| 10 |
########## |
| 11 |
|
| 12 |
# Includes |
| 13 |
-- source include/have_binlog_format_row.inc |
| 14 |
-- source include/set_privilege_checks_user_as_system_user.inc |
| 15 |
-- let $rpl_privilege_checks_user_grant_option = 1 |
| 16 |
-- source include/master-slave.inc |
| 17 |
|
| 18 |
# Begin clean up test section |
| 19 |
connection master; |
| 20 |
--disable_warnings |
| 21 |
DROP DATABASE IF EXISTS mysqltest1; |
| 22 |
CREATE DATABASE mysqltest1; |
| 23 |
--enable_warnings |
| 24 |
|
| 25 |
# Section 1 test anonymous user |
| 26 |
CREATE USER tester IDENTIFIED BY 'test', ''@'localhost%'; |
| 27 |
GRANT ALL ON mysqltest1.* TO 'tester'@'%'; |
| 28 |
GRANT ALL ON mysqltest1.* TO ''@'localhost%'; |
| 29 |
FLUSH PRIVILEGES; |
| 30 |
connect (m_1,localhost,tester,,mysqltest1); |
| 31 |
|
| 32 |
connection m_1; |
| 33 |
CREATE TABLE mysqltest1.t1 (a INT, users VARCHAR(255), PRIMARY KEY(a)); |
| 34 |
INSERT INTO mysqltest1.t1 VALUES(1,USER()); |
| 35 |
INSERT INTO mysqltest1.t1 VALUES(2,CURRENT_USER()); |
| 36 |
DELIMITER |; |
| 37 |
CREATE PROCEDURE mysqltest1.p1() |
| 38 |
BEGIN |
| 39 |
INSERT INTO mysqltest1.t1 VALUES(3,USER()); |
| 40 |
INSERT INTO mysqltest1.t1 VALUES(4,CURRENT_USER()); |
| 41 |
END| |
| 42 |
DELIMITER ;| |
| 43 |
|
| 44 |
CALL mysqltest1.p1(); |
| 45 |
connection master; |
| 46 |
SELECT * FROM mysqltest1.t1 ORDER BY a; |
| 47 |
--source include/sync_slave_sql_with_master.inc |
| 48 |
SELECT * FROM mysqltest1.t1 ORDER BY a; |
| 49 |
|
| 50 |
connection master; |
| 51 |
# Lets cleanup |
| 52 |
#show binlog events; |
| 53 |
|
| 54 |
disconnect m_1; |
| 55 |
DROP DATABASE mysqltest1; |
| 56 |
REVOKE ALL ON mysqltest1.* FROM 'tester'@'%'; |
| 57 |
REVOKE ALL ON mysqltest1.* FROM ''@'localhost%'; |
| 58 |
DROP USER tester@'%'; |
| 59 |
DROP USER ''@'localhost%'; |
| 60 |
|
| 61 |
--source include/sync_slave_sql_with_master.inc |
| 62 |
|
| 63 |
# Begin clean up test section |
| 64 |
connection master; |
| 65 |
--disable_warnings |
| 66 |
DROP DATABASE IF EXISTS mysqltest1; |
| 67 |
CREATE DATABASE mysqltest1; |
| 68 |
--enable_warnings |
| 69 |
|
| 70 |
# Section 2 test anonymous host |
| 71 |
CREATE USER 'tester1'@'' IDENTIFIED BY 'test'; |
| 72 |
GRANT ALL ON mysqltest1.* TO 'tester1'@''; |
| 73 |
FLUSH PRIVILEGES; |
| 74 |
connect (m_2,localhost,tester1,test,mysqltest1); |
| 75 |
|
| 76 |
connection m_2; |
| 77 |
CREATE TABLE mysqltest1.t1 (a INT, users VARCHAR(255), PRIMARY KEY(a)); |
| 78 |
INSERT INTO mysqltest1.t1 VALUES(1,USER()); |
| 79 |
INSERT INTO mysqltest1.t1 VALUES(2,CURRENT_USER()); |
| 80 |
DELIMITER |; |
| 81 |
CREATE PROCEDURE mysqltest1.p1() |
| 82 |
BEGIN |
| 83 |
INSERT INTO mysqltest1.t1 VALUES(3,USER()); |
| 84 |
INSERT INTO mysqltest1.t1 VALUES(4,CURRENT_USER()); |
| 85 |
END| |
| 86 |
DELIMITER ;| |
| 87 |
|
| 88 |
CALL mysqltest1.p1(); |
| 89 |
connection master; |
| 90 |
SELECT * FROM mysqltest1.t1 ORDER BY a; |
| 91 |
--source include/sync_slave_sql_with_master.inc |
| 92 |
SELECT * FROM mysqltest1.t1 ORDER BY a; |
| 93 |
|
| 94 |
connection master; |
| 95 |
# Lets cleanup |
| 96 |
|
| 97 |
disconnect m_2; |
| 98 |
DROP DATABASE mysqltest1; |
| 99 |
REVOKE ALL ON mysqltest1.* FROM 'tester1'@''; |
| 100 |
DROP USER tester1@''; |
| 101 |
|
| 102 |
--source include/sync_slave_sql_with_master.inc |
| 103 |
|
| 104 |
# End of 5.0 test case |
| 105 |
--source include/rpl_end.inc |