Commit 7d71d92e authored by unknown's avatar unknown

Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-maint

into  example.com:/work/bug23760/my51
parents 7a1ba137 72c78117
......@@ -2709,11 +2709,11 @@ row_count()
call bug4905()|
select row_count()|
row_count()
0
-1
call bug4905()|
select row_count()|
row_count()
0
-1
select * from t3|
s1
1
......@@ -4802,6 +4802,22 @@ i
0
drop table t3|
drop procedure bug16887|
create table t3 (f1 int, f2 varchar(3), primary key(f1)) engine=innodb|
insert into t3 values (1,'aaa'),(2,'bbb'),(3,'ccc')|
CREATE FUNCTION bug13575 ( p1 integer )
returns varchar(3)
BEGIN
DECLARE v1 VARCHAR(10) DEFAULT null;
SELECT f2 INTO v1 FROM t3 WHERE f1 = p1;
RETURN v1;
END|
select distinct f1, bug13575(f1) from t3 order by f1|
f1 bug13575(f1)
1 aaa
2 bbb
3 ccc
drop function bug13575;
drop table t3|
drop procedure if exists bug16474_1|
drop procedure if exists bug16474_2|
delete from t1|
......@@ -5627,4 +5643,85 @@ Called B
drop procedure proc_21462_a|
drop procedure proc_21462_b|
End of 5.0 tests
DROP TABLE IF EXISTS bug23760|
DROP TABLE IF EXISTS bug23760_log|
DROP PROCEDURE IF EXISTS bug23760_update_log|
DROP PROCEDURE IF EXISTS bug23760_test_row_count|
DROP FUNCTION IF EXISTS bug23760_rc_test|
CREATE TABLE bug23760 (
id INT NOT NULL AUTO_INCREMENT ,
num INT NOT NULL ,
PRIMARY KEY ( id )
)|
CREATE TABLE bug23760_log (
id INT NOT NULL AUTO_INCREMENT ,
reason VARCHAR(50)NULL ,
ammount INT NOT NULL ,
PRIMARY KEY ( id )
)|
CREATE PROCEDURE bug23760_update_log(r Varchar(50), a INT)
BEGIN
INSERT INTO bug23760_log (reason, ammount) VALUES(r, a);
END|
CREATE PROCEDURE bug23760_test_row_count()
BEGIN
UPDATE bug23760 SET num = num + 1;
CALL bug23760_update_log('Test is working', ROW_COUNT());
UPDATE bug23760 SET num = num - 1;
END|
CREATE PROCEDURE bug23760_test_row_count2(level INT)
BEGIN
IF level THEN
UPDATE bug23760 SET num = num + 1;
CALL bug23760_update_log('Test2 is working', ROW_COUNT());
CALL bug23760_test_row_count2(level - 1);
END IF;
END|
CREATE FUNCTION bug23760_rc_test(in_var INT) RETURNS INT RETURN in_var|
INSERT INTO bug23760 (num) VALUES (0), (1), (1), (2), (3), (5), (8)|
SELECT ROW_COUNT()|
ROW_COUNT()
7
CALL bug23760_test_row_count()|
SELECT * FROM bug23760_log ORDER BY id|
id reason ammount
1 Test is working 7
SET @save_max_sp_recursion= @@max_sp_recursion_depth|
SELECT @save_max_sp_recursion|
@save_max_sp_recursion
0
SET max_sp_recursion_depth= 5|
SELECT @@max_sp_recursion_depth|
@@max_sp_recursion_depth
5
CALL bug23760_test_row_count2(2)|
SELECT ROW_COUNT()|
ROW_COUNT()
1
SELECT * FROM bug23760_log ORDER BY id|
id reason ammount
1 Test is working 7
2 Test2 is working 7
3 Test2 is working 7
SELECT * FROM bug23760 ORDER by ID|
id num
1 2
2 3
3 3
4 4
5 5
6 7
7 10
SET max_sp_recursion_depth= @save_max_sp_recursion|
SELECT bug23760_rc_test(123)|
bug23760_rc_test(123)
123
INSERT INTO bug23760 (num) VALUES (13), (21), (34), (55)|
SELECT bug23760_rc_test(ROW_COUNT())|
bug23760_rc_test(ROW_COUNT())
4
DROP TABLE bug23760, bug23760_log|
DROP PROCEDURE bug23760_update_log|
DROP PROCEDURE bug23760_test_row_count|
DROP FUNCTION bug23760_rc_test|
drop table t1,t2;
......@@ -6586,6 +6586,83 @@ drop procedure proc_21462_b|
--echo End of 5.0 tests
#
# BUG#23760: ROW_COUNT() and store procedure not owrking together
#
--disable_warnings
DROP TABLE IF EXISTS bug23760|
DROP TABLE IF EXISTS bug23760_log|
DROP PROCEDURE IF EXISTS bug23760_update_log|
DROP PROCEDURE IF EXISTS bug23760_test_row_count|
DROP FUNCTION IF EXISTS bug23760_rc_test|
--enable_warnings
CREATE TABLE bug23760 (
id INT NOT NULL AUTO_INCREMENT ,
num INT NOT NULL ,
PRIMARY KEY ( id )
)|
CREATE TABLE bug23760_log (
id INT NOT NULL AUTO_INCREMENT ,
reason VARCHAR(50)NULL ,
ammount INT NOT NULL ,
PRIMARY KEY ( id )
)|
CREATE PROCEDURE bug23760_update_log(r Varchar(50), a INT)
BEGIN
INSERT INTO bug23760_log (reason, ammount) VALUES(r, a);
END|
CREATE PROCEDURE bug23760_test_row_count()
BEGIN
UPDATE bug23760 SET num = num + 1;
CALL bug23760_update_log('Test is working', ROW_COUNT());
UPDATE bug23760 SET num = num - 1;
END|
CREATE PROCEDURE bug23760_test_row_count2(level INT)
BEGIN
IF level THEN
UPDATE bug23760 SET num = num + 1;
CALL bug23760_update_log('Test2 is working', ROW_COUNT());
CALL bug23760_test_row_count2(level - 1);
END IF;
END|
CREATE FUNCTION bug23760_rc_test(in_var INT) RETURNS INT RETURN in_var|
INSERT INTO bug23760 (num) VALUES (0), (1), (1), (2), (3), (5), (8)|
SELECT ROW_COUNT()|
CALL bug23760_test_row_count()|
SELECT * FROM bug23760_log ORDER BY id|
SET @save_max_sp_recursion= @@max_sp_recursion_depth|
SELECT @save_max_sp_recursion|
SET max_sp_recursion_depth= 5|
SELECT @@max_sp_recursion_depth|
CALL bug23760_test_row_count2(2)|
SELECT ROW_COUNT()|
SELECT * FROM bug23760_log ORDER BY id|
SELECT * FROM bug23760 ORDER by ID|
SET max_sp_recursion_depth= @save_max_sp_recursion|
SELECT bug23760_rc_test(123)|
INSERT INTO bug23760 (num) VALUES (13), (21), (34), (55)|
SELECT bug23760_rc_test(ROW_COUNT())|
DROP TABLE bug23760, bug23760_log|
DROP PROCEDURE bug23760_update_log|
DROP PROCEDURE bug23760_test_row_count|
DROP FUNCTION bug23760_rc_test|
#
# NOTE: The delimiter is `|`, and not `;`. It is changed to `;`
# at the end of the file!
#
#
# BUG#NNNN: New bug synopsis
#
......
......@@ -4610,8 +4610,6 @@ mysql_execute_command(THD *thd)
select_limit= thd->variables.select_limit;
thd->variables.select_limit= HA_POS_ERROR;
thd->row_count_func= 0;
/*
We never write CALL statements into binlog:
- If the mode is non-prelocked, each statement will be logged
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment