1
by brian
clean slate |
1 |
#############################################################################
|
2 |
# Original Author: JBM # |
|
3 |
# Original Date: Aug/15/2005 # |
|
4 |
# Update: 08/29/2005 Remove sleep # |
|
5 |
#############################################################################
|
|
6 |
# TEST: Use SQL_CALC_FOUND_ROWS and insert results into a table inside a sp # |
|
7 |
#############################################################################
|
|
8 |
||
9 |
||
10 |
# Includes |
|
11 |
-- source include/have_binlog_format_row.inc
|
|
12 |
-- source include/master-slave.inc
|
|
13 |
||
14 |
# Begin clean up test section |
|
15 |
connection master; |
|
16 |
--disable_warnings
|
|
17 |
DROP PROCEDURE IF EXISTS test.p1; |
|
18 |
DROP TABLE IF EXISTS test.t2; |
|
19 |
--enable_warnings
|
|
20 |
# End of cleanup |
|
21 |
||
22 |
||
23 |
||
24 |
# Begin test section 1 |
|
25 |
CREATE TABLE test.t1 (a INT,PRIMARY KEY(a)); |
|
26 |
CREATE TABLE test.t2 (a INT,PRIMARY KEY(a)); |
|
27 |
INSERT INTO test.t1 VALUES(1),(2); |
|
28 |
||
29 |
delimiter |; |
|
30 |
CREATE PROCEDURE test.p1() |
|
31 |
BEGIN
|
|
32 |
SELECT SQL_CALC_FOUND_ROWS * FROM test.t1 LIMIT 1; |
|
33 |
INSERT INTO test.t2 VALUES(FOUND_ROWS()); |
|
34 |
END| |
|
35 |
delimiter ;| |
|
36 |
||
37 |
let $message=< ---- Master selects-- >; |
|
38 |
--source include/show_msg.inc
|
|
39 |
CALL test.p1(); |
|
40 |
SELECT * FROM test.t2; |
|
41 |
||
42 |
let $message=< ---- Slave selects-- >; |
|
43 |
--source include/show_msg.inc
|
|
44 |
save_master_pos; |
|
45 |
connection slave; |
|
46 |
sync_with_master; |
|
47 |
SELECT * FROM test.t2; |
|
48 |
||
49 |
# Cleanup |
|
50 |
||
51 |
connection master; |
|
52 |
DROP PROCEDURE IF EXISTS test.p1; |
|
53 |
DROP TABLE IF EXISTS test.t1; |
|
54 |
DROP TABLE IF EXISTS test.t2; |
|
55 |
sync_slave_with_master; |
|
56 |
||
57 |
# End of 5.0 test case |