#At file:///home/alik/MySQL/bzr/00/bug55843/mysql-trunk-bug55843-01/ based on revid:alexander.nozdrin@stripped
3170 Alexander Nozdrin 2011-06-07
Pre-requisite patch for Bug#11763162 (55843 - Handled condition
appears as not handled).
The patch replaces set_warning_info() by push_warning_info() / pop_warning_info().
modified:
sql/sp_head.cc
sql/sql_admin.cc
sql/sql_error.cc
sql/sql_error.h
sql/sql_show.cc
=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc 2011-06-07 16:20:10 +0000
+++ b/sql/sp_head.cc 2011-06-07 16:32:56 +0000
@@ -1215,7 +1215,7 @@ sp_head::execute(THD *thd, bool merge_da
Reprepare_observer *save_reprepare_observer= thd->m_reprepare_observer;
Object_creation_ctx *saved_creation_ctx;
Warning_info *saved_warning_info;
- Warning_info warning_info(thd->get_stmt_da()->warn_id(), false);
+ Warning_info sp_warning_info(thd->get_stmt_da()->warn_id(), false);
/*
Just reporting a stack overrun error
@@ -1286,9 +1286,15 @@ sp_head::execute(THD *thd, bool merge_da
old_arena= thd->stmt_arena;
/* Push a new warning information area. */
+
saved_warning_info= thd->get_stmt_da()->get_warning_info();
- warning_info.append_warning_info(thd, saved_warning_info);
- thd->get_stmt_da()->set_warning_info(&warning_info);
+ sp_warning_info.append_warning_info(thd, saved_warning_info);
+
+ if (thd->get_stmt_da()->push_warning_info(&sp_warning_info))
+ {
+ err_status= true;
+ goto done;
+ }
/*
Switch query context. This has to be done early as this is sometimes
@@ -1496,11 +1502,9 @@ sp_head::execute(THD *thd, bool merge_da
propagated to the caller in any case.
*/
if (err_status || merge_da_on_success)
- {
- saved_warning_info->merge_with_routine_info(
- thd, thd->get_stmt_da()->get_warning_info());
- }
- thd->get_stmt_da()->set_warning_info(saved_warning_info);
+ saved_warning_info->merge_with_routine_info(thd, &sp_warning_info);
+
+ thd->get_stmt_da()->pop_warning_info();
done:
DBUG_PRINT("info", ("err_status: %d killed: %d is_slave_error: %d report_error: %d",
=== modified file 'sql/sql_admin.cc'
--- a/sql/sql_admin.cc 2011-06-07 16:20:10 +0000
+++ b/sql/sql_admin.cc 2011-06-07 16:32:56 +0000
@@ -351,18 +351,17 @@ static bool mysql_admin_table(THD* thd,
because it's already known that the table is badly damaged.
*/
- Diagnostics_area *da= thd->get_stmt_da();
Warning_info wi(thd->query_id, false);
- Warning_info *wi_saved= da->get_warning_info();
- da->set_warning_info(&wi);
+ if (thd->get_stmt_da()->push_warning_info(&wi))
+ DBUG_RETURN(TRUE);
open_error= open_temporary_tables(thd, table);
if (!open_error)
open_error= open_and_lock_tables(thd, table, TRUE, 0);
- da->set_warning_info(wi_saved);
+ thd->get_stmt_da()->pop_warning_info();
}
else
{
=== modified file 'sql/sql_error.cc'
--- a/sql/sql_error.cc 2011-06-07 16:20:10 +0000
+++ b/sql/sql_error.cc 2011-06-07 16:32:56 +0000
@@ -327,6 +327,25 @@ Diagnostics_area::Diagnostics_area(ulong
reset_diagnostics_area();
}
+bool
+Diagnostics_area::push_warning_info(Warning_info *wi)
+{
+ if (m_wi_list.push_front(wi))
+ return true;
+
+ m_current_wi= wi;
+
+ return false;
+}
+
+void Diagnostics_area::pop_warning_info()
+{
+ DBUG_ASSERT(m_wi_list.elements > 0);
+ m_wi_list.pop();
+
+ m_current_wi= m_wi_list.elements > 0 ? m_wi_list.head() : &m_main_wi;
+}
+
/**
Clear this diagnostics area.
=== modified file 'sql/sql_error.h'
--- a/sql/sql_error.h 2011-06-07 16:20:10 +0000
+++ b/sql/sql_error.h 2011-06-07 16:32:56 +0000
@@ -494,10 +494,7 @@ public:
{ return m_current_wi; }
inline const Warning_info *get_warning_info() const
- { return m_current_wi; }
-
- inline void set_warning_info(Warning_info *wi)
- { m_current_wi= wi; }
+ { return const_cast<Diagnostics_area *> (this)->get_warning_info(); }
public:
ulonglong warn_id() const
@@ -545,6 +542,10 @@ public:
void reset_for_next_command()
{ get_warning_info()->reset_for_next_command(); }
+public:
+ bool push_warning_info(Warning_info *wi);
+ void pop_warning_info();
+
private:
/** Message buffer. Can be used by OK or ERROR status. */
char m_message[MYSQL_ERRMSG_SIZE];
@@ -585,6 +586,8 @@ private:
Warning_info m_main_wi;
Warning_info *m_current_wi;
+
+ List<Warning_info> m_wi_list;
};
///////////////////////////////////////////////////////////////////////////
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2011-06-07 16:20:10 +0000
+++ b/sql/sql_show.cc 2011-06-07 16:32:56 +0000
@@ -6807,13 +6807,12 @@ static bool do_fill_table(THD *thd,
Warning_info wi(thd->query_id, true);
Warning_info *wi_saved= da->get_warning_info();
- da->set_warning_info(&wi);
+ if (da->push_warning_info(&wi))
+ return true;
bool res= table_list->schema_table->fill_table(
thd, table_list, join_table->condition());
- da->set_warning_info(wi_saved);
-
// Pass an error if any.
if (da->is_error())
@@ -6840,6 +6839,8 @@ static bool do_fill_table(THD *thd,
wi_saved->push_warning(thd, err);
}
+ da->pop_warning_info();
+
return res;
}
Attachment: [text/bzr-bundle] bzr/alexander.nozdrin@oracle.com-20110607163256-8x9towku2dxdif30.bundle
| Thread |
|---|
| • bzr commit into mysql-trunk branch (alexander.nozdrin:3170) Bug#11763162 | Alexander Nozdrin | 7 Jun |