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