summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp.test
diff options
context:
space:
mode:
authorMichael Widenius <monty@mariadb.org>2017-07-29 10:35:30 +0300
committerSergei Golubchik <serg@mariadb.org>2017-08-24 01:05:52 +0200
commit94bbe8ad5837ed53976d0d98bbcc7eb3faff7a0f (patch)
treea1d280103ba5f9ad9bbf20863cb1d74dcf04ca62 /mysql-test/t/sp.test
parent4be15fe065fa6fb109f2ffb9a6f63644505cc0f1 (diff)
downloadmariadb-git-94bbe8ad5837ed53976d0d98bbcc7eb3faff7a0f.tar.gz
Affected rows for a SP now includes affected rows for all statements
The old behavior of returning the affected rows for the last statement in a stored procedure was more an accident than design. Having the number of affected rows for all sub statements is more useful and will not change just because on changes the order of statements in the stored procedure.
Diffstat (limited to 'mysql-test/t/sp.test')
-rw-r--r--mysql-test/t/sp.test29
1 files changed, 29 insertions, 0 deletions
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 7eedc67acd9..6b969e3b4a0 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -9702,3 +9702,32 @@ $$
DELIMITER ;$$
CALL p1();
DROP PROCEDURE p1;
+
+--echo # Test affected rows from an sp
+
+create table t1 (a int);
+
+DELIMITER $$;
+create procedure p1()
+begin
+insert into t1 values(1);
+insert into t1 values(2);
+end;
+$$
+create procedure p2()
+begin
+insert into t1 values(1);
+call p1();
+select row_count();
+insert into t1 values(2);
+insert into t1 values(2);
+end;
+$$
+DELIMITER ;$$
+
+--enable_info
+CALL p2();
+--disable_info
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+drop table t1;