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