--let $count=1 connection master; if (`SELECT '$diff_table' = ''`) { let $diff_table= mysql.user; } --echo --echo --echo --echo TEST STATEMENT: '$statement' --echo -------------------------------------------------------------------------- if (`SELECT '$diff_columns' = ''`) { eval CREATE VIEW test.bug48321_v1 AS SELECT user FROM $diff_table WHERE user LIKE 'bug48321%'; } if (`SELECT '$diff_columns' <> ''`) { eval CREATE VIEW test.bug48321_v1 AS SELECT user, $diff_columns FROM $diff_table WHERE user LIKE 'bug48321%'; } while (`SELECT $count < 6`) { --echo --echo TEST STATEMENT: '$statement' --echo CASE $count: --echo ------- let $user2= 'bug48321_2'@'localhost'; let $user3= 'bug48321_3'@'localhost'; let $user1= CURRENT_USER(); if (`SELECT '$action'='RENAME'`) { let $user1= $user1 TO 'bug48321_4'@'localhost'; let $user2= $user2 TO 'bug48321_5'@'localhost'; let $user3= $user3 TO 'bug48321_6'@'localhost'; } if (`SELECT '$action'='GRANT'`) { let $user1= $user1 IDENTIFIED BY 'user1'; let $user3= $user3 IDENTIFIED BY ''; } if (`SELECT $count=1`) { --echo # Only CURRENT_USER() in the user list of the test statement. let $users_list= $user1; } if (`SELECT $count=2`) { --echo # Two users are in the test statement, CURRENT_USER is the first one. let $users_list= $user1, $user2; } if (`SELECT $count=3`) { --echo # Two users are in the test statement, CURRENT_USER is the last one. let $users_list= $user2, $user1; } if (`SELECT $count=4`) { --echo # Three users are in the test statement, CURRENT_USER is the second one. let $users_list= $user2, $user1, $user3; } if (`SELECT $count=5`) { --echo # CURRENT_USER is not in the test statement. let $users_list= $user2, $user3; } --echo users_list= $users_list --echo --echo # Connect to master with user1, so user1 always is the current user, --echo # when test statement is runing. eval GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1'@'localhost' WITH GRANT OPTION; eval CREATE USER 'bug48321_2'@'localhost', 'bug48321_3'@'localhost' IDENTIFIED BY 'user3'; if (`SELECT '$action'='REVOKE'`) { --echo --echo # Grant some privileges to users at first when testing --echo # 'REVOKE ...' statement. eval GRANT ALL PRIVILEGES ON *.* TO 'bug48321_2'@'localhost', 'bug48321_3'@'localhost' WITH GRANT OPTION; eval GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO 'bug48321_1'@'localhost', 'bug48321_2'@'localhost', 'bug48321_3'@'localhost'; } connect (conn1, 127.0.0.1, 'bug48321_1'@'localhost',,); connection conn1; --echo let $temp= `SELECT "$statement"`; eval $temp; --echo disconnect conn1; connection master; sync_slave_with_master; connection master; let $diff_table_1= master:test.bug48321_v1; let $diff_table_2= slave:test.bug48321_v1; source include/diff_tables.inc; --echo --echo # Delete all bug48321% users connection master; DELETE FROM mysql.user WHERE user LIKE 'bug48321%'; DELETE FROM mysql.procs_priv WHERE user LIKE 'bug48321%'; FLUSH PRIVILEGES; inc $count; } DROP VIEW test.bug48321_v1;