~drizzle-trunk/drizzle/development

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