Commit 9d5d8478 authored by unknown's avatar unknown

Fixed BUG#8638: Test 'sp' fails: Stored Procedure often sends warning 1329

  The warning sent is by itself ok, the problem was rather why it wasn't
  sent on some other platforms...
  The real problem was that a total_warn_count which was inconsistent with warn_list
  was sent back with send_eof() during SP execution, which in turn cause a protocol
  error in mysqltest.


mysql-test/r/sp.result:
  Updated results after fixing bug in how total_warn_count is handled.
sql/protocol.cc:
  Fixed bug that caused protocol errors with mysqltest. Don't send total_warn_count
  with send_eof() during SP execution, as it's usually wrong anyway. (warn_list is
  cleared)
sql/sql_parse.cc:
  Reset total_warn_count if the warn_list has been cleared. This gets rid of
  "empty" warnings after some CALLs.
parent 0119ea08
......@@ -656,7 +656,6 @@ delete from t1|
drop table if exists t3|
create table t3 ( s char(16), d int)|
call into_test4()|
Warnings:
select * from t3|
s d
into4 NULL
......@@ -1344,9 +1343,7 @@ end if;
insert into t4 values (2, rc, t3);
end|
call bug1863(10)|
Warnings:
call bug1863(10)|
Warnings:
select * from t4|
f1 rc t3
2 0 NULL
......@@ -1643,9 +1640,7 @@ begin
end|
call bug4579_1()|
call bug4579_1()|
Warnings:
call bug4579_1()|
Warnings:
drop procedure bug4579_1|
drop procedure bug4579_2|
drop table t3|
......@@ -2118,12 +2113,16 @@ var
call bug7743("OneWord")|
var
NULL
Warnings:
Warning 1329 No data to FETCH
call bug7743("anotherword")|
var
2
call bug7743("AnotherWord")|
var
NULL
Warnings:
Warning 1329 No data to FETCH
drop procedure bug7743|
drop table t4|
delete from t3|
......
......@@ -359,7 +359,9 @@ send_eof(THD *thd, bool no_flush)
if (thd->client_capabilities & CLIENT_PROTOCOL_41)
{
uchar buff[5];
uint tmp= min(thd->total_warn_count, 65535);
/* Don't send warn count during SP execution, as the warn_list
is cleared between substatements, and mysqltest gets confused */
uint tmp= (thd->spcont ? 0 : min(thd->total_warn_count, 65535));
buff[0]=254;
int2store(buff+1, tmp);
/*
......
......@@ -4185,6 +4185,12 @@ mysql_execute_command(THD *thd)
thd->row_count_func= 0;
res= sp->execute_procedure(thd, &lex->value_list);
/* If warnings have been cleared, we have to clear total_warn_count
* too, otherwise the clients get confused.
*/
if (thd->warn_list.is_empty())
thd->total_warn_count= 0;
thd->variables.select_limit= select_limit;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
sp_restore_security_context(thd, sp, &save_ctx);
......
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