| 1 |
############################################################################# |
| 2 |
# Original Author: JBM # |
| 3 |
# Original Date: Aug/14/2005 # |
| 4 |
############################################################################# |
| 5 |
# Test: This test contains two sp that create and drop tables, insert and # |
| 6 |
# updated data and uses the NOW() function. # |
| 7 |
############################################################################# |
| 8 |
|
| 9 |
|
| 10 |
# Includes |
| 11 |
-- source include/set_privilege_checks_user_as_system_user.inc |
| 12 |
-- source include/master-slave.inc |
| 13 |
|
| 14 |
|
| 15 |
# Begin clean up test section |
| 16 |
connection master; |
| 17 |
--disable_warnings |
| 18 |
DROP PROCEDURE IF EXISTS test.p1; |
| 19 |
DROP PROCEDURE IF EXISTS test.p2; |
| 20 |
DROP TABLE IF EXISTS test.t2; |
| 21 |
DROP TABLE IF EXISTS test.t1; |
| 22 |
DROP TABLE IF EXISTS test.t3; |
| 23 |
--enable_warnings |
| 24 |
# End of cleanup |
| 25 |
|
| 26 |
# Begin test section 1 |
| 27 |
|
| 28 |
delimiter |; |
| 29 |
CREATE PROCEDURE test.p1() |
| 30 |
BEGIN |
| 31 |
CREATE TABLE IF NOT EXISTS test.t1(a INT,PRIMARY KEY(a)); |
| 32 |
CREATE TABLE IF NOT EXISTS test.t2(a INT,PRIMARY KEY(a)); |
| 33 |
INSERT INTO test.t1 VALUES (4),(2),(1),(3); |
| 34 |
UPDATE test.t1 SET a=a+4 WHERE a=4; |
| 35 |
INSERT INTO test.t2 (a) SELECT t1.a FROM test.t1; |
| 36 |
UPDATE test.t1 SET a=a+4 WHERE a=8; |
| 37 |
CREATE TABLE IF NOT EXISTS test.t3(n MEDIUMINT NOT NULL AUTO_INCREMENT, f FLOAT, d DATETIME, PRIMARY KEY(n)); |
| 38 |
END| |
| 39 |
CREATE PROCEDURE test.p2() |
| 40 |
BEGIN |
| 41 |
DROP TABLE IF EXISTS test.t1; |
| 42 |
DROP TABLE IF EXISTS test.t2; |
| 43 |
INSERT INTO test.t3 VALUES(NULL,11111111.233333,NOW()); |
| 44 |
END| |
| 45 |
delimiter ;| |
| 46 |
|
| 47 |
CALL test.p1(); |
| 48 |
SELECT * FROM test.t1 ORDER BY a; |
| 49 |
SELECT * FROM test.t2 ORDER BY a; |
| 50 |
--source include/sync_slave_sql_with_master.inc |
| 51 |
SELECT * FROM test.t1 ORDER BY a; |
| 52 |
SELECT * FROM test.t2 ORDER BY a; |
| 53 |
|
| 54 |
connection master; |
| 55 |
CALL test.p2(); |
| 56 |
USE test; |
| 57 |
SHOW TABLES; |
| 58 |
#SELECT * FROM test.t3; |
| 59 |
--source include/sync_slave_sql_with_master.inc |
| 60 |
USE test; |
| 61 |
SHOW TABLES; |
| 62 |
#SELECT * FROM test.t3; |
| 63 |
|
| 64 |
connection master; |
| 65 |
CALL test.p1(); |
| 66 |
SELECT * FROM test.t1 ORDER BY a; |
| 67 |
SELECT * FROM test.t2 ORDER BY a; |
| 68 |
#SELECT * FROM test.t3; |
| 69 |
--source include/sync_slave_sql_with_master.inc |
| 70 |
SELECT * FROM test.t1 ORDER BY a; |
| 71 |
SELECT * FROM test.t2 ORDER BY a; |
| 72 |
#SELECT * FROM test.t3; |
| 73 |
|
| 74 |
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp004_master.sql |
| 75 |
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/sp004_slave.sql |
| 76 |
|
| 77 |
# Cleanup |
| 78 |
connection master; |
| 79 |
#show binlog events; |
| 80 |
DROP PROCEDURE IF EXISTS test.p1; |
| 81 |
DROP PROCEDURE IF EXISTS test.p2; |
| 82 |
DROP TABLE IF EXISTS test.t1; |
| 83 |
DROP TABLE IF EXISTS test.t2; |
| 84 |
DROP TABLE IF EXISTS test.t3; |
| 85 |
--source include/sync_slave_sql_with_master.inc |
| 86 |
|
| 87 |
# If the test fails, you will need to diff the dumps to see why. |
| 88 |
|
| 89 |
diff_files $MYSQLTEST_VARDIR/tmp/sp004_master.sql $MYSQLTEST_VARDIR/tmp/sp004_slave.sql; |
| 90 |
|
| 91 |
# Cleanup |
| 92 |
--remove_file $MYSQLTEST_VARDIR/tmp/sp004_master.sql |
| 93 |
--remove_file $MYSQLTEST_VARDIR/tmp/sp004_slave.sql |
| 94 |
# End of 5.0 test case |
| 95 |
--source include/rpl_end.inc |