diff options
author | Alexander Nozdrin <alexander.nozdrin@oracle.com> | 2011-04-15 16:02:22 +0400 |
---|---|---|
committer | Alexander Nozdrin <alexander.nozdrin@oracle.com> | 2011-04-15 16:02:22 +0400 |
commit | 506ff594c8553723770e9f097c0e72c31859d7ad (patch) | |
tree | 4531ce607ef0e28f17343b99a058fd181febf463 /sql/sql_prepare.cc | |
parent | df28a9d8048d73696133a1a93571b568e4cadf00 (diff) | |
download | mariadb-git-506ff594c8553723770e9f097c0e72c31859d7ad.tar.gz |
A patch for Bug#11763166 (55847: SHOW WARNINGS returns empty
result set when SQLEXCEPTION is active.
The problem was in a hackish THD::no_warnings_for_error attribute.
When it was set, an error was not written to Warning_info -- only
Diagnostics_area state was changed. That means, Diagnostics_area
might contain error state, which is not present in Warning_info.
The user-visible problem was that in some cases SHOW WARNINGS
returned empty result set (i.e. there were no warnings) while
the previous SQL statement failed. According to the MySQL
protocol errors must be presented in warning list.
The main idea of this patch is to remove THD::no_warnings_for_error.
There were few places where it was used:
- sql_admin.cc, handling of REPAIR TABLE USE_FRM.
- sql_show.cc, when calling fill_schema_table_from_frm().
- sql_show.cc, when calling fill_table().
The fix is to either use internal-error-handlers, or to use
temporary Warning_info storing warnings, which might be ignored.
This patch is needed to fix Bug 11763162 (55843).
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r-- | sql/sql_prepare.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 9085d018dfd..779569b10fb 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -2842,7 +2842,8 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length) param= stmt->param_array[param_number]; Diagnostics_area new_stmt_da, *save_stmt_da= thd->stmt_da; - Warning_info new_warnning_info(thd->query_id), *save_warinig_info= thd->warning_info; + Warning_info new_warnning_info(thd->query_id, false); + Warning_info *save_warinig_info= thd->warning_info; thd->stmt_da= &new_stmt_da; thd->warning_info= &new_warnning_info; @@ -3900,7 +3901,7 @@ Ed_result_set::Ed_result_set(List<Ed_row> *rows_arg, */ Ed_connection::Ed_connection(THD *thd) - :m_warning_info(thd->query_id), + :m_warning_info(thd->query_id, false), m_thd(thd), m_rsets(0), m_current_rset(0) |