1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00

merge bugfuxes for sp-error.test

This commit is contained in:
Sergei Golubchik
2013-07-12 10:17:52 +02:00
parent f0502cf87c
commit 3cd1861a81
6 changed files with 1890 additions and 5 deletions

View File

@@ -3390,6 +3390,14 @@ sp_instr_freturn::execute(THD *thd, uint *nextp)
int
sp_instr_freturn::exec_core(THD *thd, uint *nextp)
{
/*
RETURN is a "procedure statement" (in terms of the SQL standard).
That means, Diagnostics Area should be clean before its execution.
*/
Diagnostics_area *da= thd->get_stmt_da();
da->clear_warning_info(da->warning_info_id());
/*
Change <next instruction pointer>, so that this will be the last
instruction in the stored function.

View File

@@ -233,6 +233,23 @@ bool sp_rcontext::handle_sql_condition(THD *thd,
if (found_handler)
found_condition= da->get_error_condition();
/*
Found condition can be NULL if the diagnostics area was full
when the error was raised. It can also be NULL if
Diagnostics_area::set_error_status(uint sql_error) was used.
In these cases, make a temporary Sql_condition here so the
error can be handled.
*/
if (!found_condition)
{
Sql_condition *condition=
new (callers_arena->mem_root) Sql_condition(callers_arena->mem_root);
condition->set(da->sql_errno(), da->get_sqlstate(),
Sql_condition::WARN_LEVEL_ERROR,
da->message());
found_condition= condition;
}
}
else if (da->current_statement_warn_count())
{