~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysql-test/extra/rpl_tests/rpl_row_sp006.test

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#############################################################################
 
2
# Original Author: JBM                                                      #
 
3
# Original Date: Aug/15/2005                                                #
 
4
# Updated: 08/29/2005 to remove sleeps                                      #
 
5
#############################################################################
 
6
# Test: This test uses two SPs, one to populate a table, and another to use #
 
7
#       Cursors, CURRENT_DATE(), loop control, date math and logic control  #
 
8
#       to populate a table with data from the first table.                 #
 
9
#############################################################################
 
10
 
 
11
# Begin clean up test section
 
12
connection master;
 
13
--disable_warnings
 
14
create database if not exists mysqltest1;
 
15
DROP PROCEDURE IF EXISTS mysqltest1.p1;
 
16
DROP PROCEDURE IF EXISTS mysqltest1.p2;
 
17
DROP TABLE IF EXISTS mysqltest1.t2;
 
18
DROP TABLE IF EXISTS mysqltest1.t1;
 
19
--enable_warnings
 
20
# End of cleanup
 
21
 
 
22
# Begin test section 1
 
23
eval CREATE TABLE IF NOT EXISTS mysqltest1.t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=$engine_type;
 
24
eval CREATE TABLE IF NOT EXISTS mysqltest1.t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=$engine_type;
 
25
 
 
26
delimiter |;
 
27
CREATE PROCEDURE mysqltest1.p1()
 
28
BEGIN
 
29
  DECLARE done INT DEFAULT 0;
 
30
  DECLARE spa CHAR(16);
 
31
  DECLARE spb INT;
 
32
  DECLARE cur1 CURSOR FOR SELECT name, 
 
33
       (YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5)<RIGHT(birth,5)) 
 
34
       FROM mysqltest1.t1;
 
35
   DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
 
36
 
 
37
  OPEN cur1;
 
38
 
 
39
  SET AUTOCOMMIT=0;
 
40
  REPEAT
 
41
    FETCH cur1 INTO spa, spb;
 
42
    IF NOT done THEN
 
43
       START TRANSACTION;
 
44
          INSERT INTO mysqltest1.t2 VALUES (spa,spb);
 
45
       COMMIT;
 
46
     END IF;
 
47
  UNTIL done END REPEAT;
 
48
 
 
49
  SET AUTOCOMMIT=1;
 
50
  CLOSE cur1;
 
51
END|
 
52
CREATE PROCEDURE mysqltest1.p2()
 
53
BEGIN
 
54
  INSERT INTO mysqltest1.t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
 
55
END|
 
56
delimiter ;|
 
57
 
 
58
CALL mysqltest1.p2();
 
59
sync_slave_with_master;
 
60
 
 
61
connection master;
 
62
CALL mysqltest1.p1();
 
63
sync_slave_with_master;
 
64
 
 
65
connection master;
 
66
 
 
67
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/sp006_master.sql
 
68
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/sp006_slave.sql
 
69
 
 
70
 
 
71
DROP PROCEDURE IF EXISTS mysqltest1.p1;
 
72
DROP PROCEDURE IF EXISTS mysqltest1.p2;
 
73
DROP TABLE IF EXISTS mysqltest1.t1;
 
74
DROP TABLE IF EXISTS mysqltest1.t2;
 
75
DROP DATABASE mysqltest1;
 
76
 
 
77
# Lets compare. Note: If they match test will pass, if they do not match
 
78
# the test will show that the diff statement failed and not reject file
 
79
# will be created. You will need to go to the mysql-test dir and diff
 
80
# the files your self to see what is not matching :-) Failed test 
 
81
# Dump files will be located in $MYSQLTEST_VARDIR/tmp.
 
82
 
 
83
diff_files $MYSQLTEST_VARDIR/tmp/sp006_master.sql $MYSQLTEST_VARDIR/tmp/sp006_slave.sql;
 
84
 
 
85
sync_slave_with_master;
 
86
 
 
87
# End of 5.1 test case