You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

138 lines
2.7 KiB

20 years ago
20 years ago
20 years ago
  1. #
  2. # Test of replicating user variables
  3. #
  4. ###########################################################
  5. # 2006-02-08 By JBM added order by for use w/ NDB engine
  6. ###########################################################
  7. source include/master-slave.inc;
  8. #sync_slave_with_master;
  9. #reset master;
  10. #connection master;
  11. --disable_warnings
  12. drop table if exists t1;
  13. --enable_warnings
  14. create table t1(n char(30));
  15. prepare stmt1 from 'insert into t1 values (?)';
  16. set @var1= "from-master-1";
  17. execute stmt1 using @var1;
  18. set @var1= "from-master-2-'',";
  19. execute stmt1 using @var1;
  20. SELECT * FROM t1 ORDER BY n;
  21. set @var2= 'insert into t1 values (concat("from-var-", ?))';
  22. prepare stmt2 from @var2;
  23. set @var1='from-master-3';
  24. execute stmt2 using @var1;
  25. sync_slave_with_master;
  26. SELECT * FROM t1 ORDER BY n;
  27. connection master;
  28. drop table t1;
  29. sync_slave_with_master;
  30. stop slave;
  31. source include/wait_for_slave_to_stop.inc;
  32. # End of 4.1 tests
  33. #
  34. # Bug #25843 Changing default database between PREPARE and EXECUTE of statement
  35. # breaks binlog.
  36. #
  37. # There were actually two problems discovered by this bug:
  38. #
  39. # 1. Default (current) database is not fixed at the creation time.
  40. # That leads to wrong output of DATABASE() function.
  41. #
  42. # 2. Database attributes (@@collation_database) are not fixed at the creation
  43. # time. That leads to wrong resultset.
  44. #
  45. # Binlog breakage and Query Cache wrong output happened because of the first
  46. # problem.
  47. #
  48. --echo
  49. --echo ########################################################################
  50. --echo #
  51. --echo # BUG#25843: Changing default database between PREPARE and EXECUTE of
  52. --echo # statement breaks binlog.
  53. --echo #
  54. --echo ########################################################################
  55. ###############################################################################
  56. --echo
  57. --echo # Connection: slave
  58. --echo
  59. --connection slave
  60. --echo
  61. START SLAVE;
  62. --echo
  63. --echo # Connection: master
  64. --echo
  65. --connection master
  66. --echo
  67. CREATE DATABASE mysqltest1;
  68. CREATE TABLE t1(db_name CHAR(32), db_col_name CHAR(32));
  69. --echo
  70. PREPARE stmt_d_1 FROM 'INSERT INTO t1 VALUES(DATABASE(), @@collation_database)';
  71. --echo
  72. EXECUTE stmt_d_1;
  73. --echo
  74. use mysqltest1;
  75. --echo
  76. EXECUTE stmt_d_1;
  77. --echo
  78. --sync_slave_with_master
  79. --echo
  80. --echo # Connection: slave
  81. --echo
  82. --echo
  83. SELECT * FROM t1;
  84. --echo
  85. --echo # Connection: master
  86. --echo
  87. --connection master
  88. --echo
  89. DROP DATABASE mysqltest1;
  90. --echo
  91. use test;
  92. DROP TABLE t1;
  93. --echo
  94. --sync_slave_with_master
  95. --echo
  96. --echo # Connection: slave
  97. --echo
  98. --echo
  99. STOP SLAVE;
  100. --echo
  101. --echo ########################################################################
  102. ###############################################################################
  103. reset master;
  104. reset slave;
  105. disconnect master;