summaryrefslogtreecommitdiff
path: root/sql/sp_rcontext.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-07-12 10:17:52 +0200
committerSergei Golubchik <sergii@pisem.net>2013-07-12 10:17:52 +0200
commit3cd1861a81f5c858014c8bbb67440daaffb05cce (patch)
tree361f04d90380771c79ea35ac7290eca17a01c5d0 /sql/sp_rcontext.cc
parentf0502cf87ce7f2795edfcf94d2dcad86ce3d190f (diff)
downloadmariadb-git-3cd1861a81f5c858014c8bbb67440daaffb05cce.tar.gz
merge bugfuxes for sp-error.test
Diffstat (limited to 'sql/sp_rcontext.cc')
-rw-r--r--sql/sp_rcontext.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc
index afec3921a9b..6b1b0730548 100644
--- a/sql/sp_rcontext.cc
+++ b/sql/sp_rcontext.cc
@@ -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())
{