diff options
author | Michael Widenius <monty@mariadb.org> | 2017-07-29 10:35:30 +0300 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-08-24 01:05:52 +0200 |
commit | 94bbe8ad5837ed53976d0d98bbcc7eb3faff7a0f (patch) | |
tree | a1d280103ba5f9ad9bbf20863cb1d74dcf04ca62 /mysql-test | |
parent | 4be15fe065fa6fb109f2ffb9a6f63644505cc0f1 (diff) | |
download | mariadb-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')
-rw-r--r-- | mysql-test/r/sp.result | 27 | ||||
-rw-r--r-- | mysql-test/suite/funcs_1/r/innodb_storedproc_10.result | 6 | ||||
-rw-r--r-- | mysql-test/suite/funcs_1/r/memory_storedproc_10.result | 6 | ||||
-rw-r--r-- | mysql-test/suite/funcs_1/r/myisam_storedproc_10.result | 6 | ||||
-rw-r--r-- | mysql-test/t/sp.test | 29 |
5 files changed, 64 insertions, 10 deletions
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 53626d8013e..275e5ff502e 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -5742,7 +5742,7 @@ SELECT @@max_sp_recursion_depth| CALL bug23760_test_row_count2(2)| SELECT ROW_COUNT()| ROW_COUNT() -1 +16 SELECT * FROM bug23760_log ORDER BY id| id reason ammount 1 Test is working 7 @@ -8234,3 +8234,28 @@ rec=(10) c rec=(20) DROP PROCEDURE p1; +# Test affected rows from an sp +create table t1 (a int); +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; +$$ +CALL p2(); +row_count() +2 +affected rows: 1 +affected rows: 5 +DROP PROCEDURE p1; +DROP PROCEDURE p2; +drop table t1; diff --git a/mysql-test/suite/funcs_1/r/innodb_storedproc_10.result b/mysql-test/suite/funcs_1/r/innodb_storedproc_10.result index 405b7ab62b0..ffa30f4d012 100644 --- a/mysql-test/suite/funcs_1/r/innodb_storedproc_10.result +++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_10.result @@ -264,7 +264,7 @@ agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993 CALL sp_ins_3(); SELECT row_count(); row_count() -1 +3 SELECT * FROM temp; f1 f2 f3 f4 f5 f6 a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 @@ -317,7 +317,7 @@ COUNT( f1 ) f1 4 updated SELECT row_count(); row_count() -3 +7 SELECT * FROM temp; f1 f2 f3 f4 f5 f6 a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 @@ -380,7 +380,7 @@ row_count() after delete 2 SELECT row_count(); row_count() -0 +8 SELECT * FROM temp; f1 f2 f3 f4 f5 f6 qwe xyz 1998-03-26 100 uvw 1000 diff --git a/mysql-test/suite/funcs_1/r/memory_storedproc_10.result b/mysql-test/suite/funcs_1/r/memory_storedproc_10.result index 0f5fe7cf34c..ef5aa4c8570 100644 --- a/mysql-test/suite/funcs_1/r/memory_storedproc_10.result +++ b/mysql-test/suite/funcs_1/r/memory_storedproc_10.result @@ -265,7 +265,7 @@ agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993 CALL sp_ins_3(); SELECT row_count(); row_count() -1 +3 SELECT * FROM temp; f1 f2 f3 f4 f5 f6 a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 @@ -318,7 +318,7 @@ COUNT( f1 ) f1 4 updated SELECT row_count(); row_count() -3 +7 SELECT * FROM temp; f1 f2 f3 f4 f5 f6 a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 @@ -381,7 +381,7 @@ row_count() after delete 2 SELECT row_count(); row_count() -0 +8 SELECT * FROM temp; f1 f2 f3 f4 f5 f6 qwe xyz 1998-03-26 100 uvw 1000 diff --git a/mysql-test/suite/funcs_1/r/myisam_storedproc_10.result b/mysql-test/suite/funcs_1/r/myisam_storedproc_10.result index 0f5fe7cf34c..ef5aa4c8570 100644 --- a/mysql-test/suite/funcs_1/r/myisam_storedproc_10.result +++ b/mysql-test/suite/funcs_1/r/myisam_storedproc_10.result @@ -265,7 +265,7 @@ agaaaaaaa agaaaaaaa 1000-01-08 -4993 agaaaaaaa -4993 CALL sp_ins_3(); SELECT row_count(); row_count() -1 +3 SELECT * FROM temp; f1 f2 f3 f4 f5 f6 a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 @@ -318,7 +318,7 @@ COUNT( f1 ) f1 4 updated SELECT row_count(); row_count() -3 +7 SELECT * FROM temp; f1 f2 f3 f4 f5 f6 a^aaaaaaaa a^aaaaaaaa 1000-01-09 -4992 a^aaaaaaaa -4992 @@ -381,7 +381,7 @@ row_count() after delete 2 SELECT row_count(); row_count() -0 +8 SELECT * FROM temp; f1 f2 f3 f4 f5 f6 qwe xyz 1998-03-26 100 uvw 1000 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; |