~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
--echo #
2
--echo # Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines
3
--echo #
4
FLUSH STATUS;
5
DELIMITER $$;
6
CREATE FUNCTION testQuestion() RETURNS INTEGER
7
BEGIN
8
  DECLARE foo INTEGER;
9
  DECLARE bar INTEGER;
10
  SET foo=1;
11
  SET bar=2;
12
  RETURN foo;
13
END $$
14
CREATE PROCEDURE testQuestion2()
15
BEGIN
16
  SELECT 1;
17
END $$
18
DELIMITER ;$$
19
--disable_warnings
20
DROP TABLE IF EXISTS t1,t2;
21
--enable_warnings
22
CREATE TABLE t1 (c1 INT);
23
CREATE TABLE t2 (c1 INT);
24
CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND
25
  DO INSERT INTO t1 VALUES(1);
26
27
--echo Assert Questions == 7
28
SHOW STATUS LIKE 'Questions';
29
SELECT testQuestion();
30
--echo Assert Questions == 9
31
SHOW STATUS LIKE 'Questions';
32
CALL testQuestion2();
33
--echo Assert Questions == 11
34
SHOW STATUS LIKE 'Questions';
35
SELECT 1;
36
--echo Assert Questions == 13
37
SHOW STATUS LIKE 'Questions';
38
connect (con1,localhost,root,,);
39
connection con1;
40
SELECT 1;
41
connection default;
42
disconnect con1;
43
--echo Assert Questions == 14
44
SHOW STATUS LIKE 'Questions';
45
DELIMITER $$;
46
CREATE TRIGGER trigg1 AFTER INSERT ON t1
47
  FOR EACH ROW BEGIN
48
   INSERT INTO t2 VALUES (1);
49
  END;
50
$$
51
DELIMITER ;$$
52
--echo Assert Questions == 16
53
SHOW STATUS LIKE 'Questions';
54
INSERT INTO t1 VALUES (1);
55
--echo Assert Questions == 18
56
SHOW STATUS LIKE 'Questions';
57
# TODO: Uncomment the lines below when FLUSH GLOBAL STATUS is implemented.
58
# FLUSH STATUS;
59
# SHOW GLOBAL STATUS LIKE 'Questions';
60
DROP PROCEDURE testQuestion2;
61
DROP TRIGGER trigg1;
62
DROP FUNCTION testQuestion;
63
DROP EVENT ev1;
64
DROP TABLE t1,t2;
65
--echo End of 6.0 tests
66