summaryrefslogtreecommitdiff
path: root/sql/mysqld.cc
diff options
context:
space:
mode:
authorMarc Alff <marc.alff@sun.com>2008-10-06 14:36:15 -0600
committerMarc Alff <marc.alff@sun.com>2008-10-06 14:36:15 -0600
commitff4fde18c40fa92caabff596100357c2b411116f (patch)
tree21983f574849b98ac46959575f1a0410aeae950f /sql/mysqld.cc
parent1fd6774b3df26a8e2f6b05878d23859796e21c2f (diff)
downloadmariadb-git-ff4fde18c40fa92caabff596100357c2b411116f.tar.gz
Bug#36768 (partition_info::check_partition_info() reports mal formed
warnings) Before this fix, several places in the code would raise a warning with an error code 0, making it impossible for a stored procedure, a connector, or a client application to trigger logic to handle the warning. Also, the warning text was hard coded, and therefore not translated. With this fix, new errors numbers have been created to represent these warnings, and the warning text is coded in the errmsg.txt file.
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r--sql/mysqld.cc22
1 files changed, 16 insertions, 6 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index b04d4e3cecd..c2d28f9a821 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2800,11 +2800,25 @@ int my_message_sql(uint error, const char *str, myf MyFlags)
THD *thd;
DBUG_ENTER("my_message_sql");
DBUG_PRINT("error", ("error: %u message: '%s'", error, str));
+
+ DBUG_ASSERT(str != NULL);
/*
- Put here following assertion when situation with EE_* error codes
- will be fixed
+ An error should have a valid error number (!= 0), so it can be caught
+ in stored procedures by SQL exception handlers.
+ Calling my_error() with error == 0 is a bug.
+ Remaining known places to fix:
+ - storage/myisam/mi_create.c, my_printf_error()
+ TODO:
DBUG_ASSERT(error != 0);
*/
+
+ if (error == 0)
+ {
+ /* At least, prevent new abuse ... */
+ DBUG_ASSERT(strncmp(str, "MyISAM table", 12) == 0);
+ error= ER_UNKNOWN_ERROR;
+ }
+
if ((thd= current_thd))
{
/*
@@ -2835,10 +2849,6 @@ int my_message_sql(uint error, const char *str, myf MyFlags)
{
if (! thd->main_da.is_error()) // Return only first message
{
- if (error == 0)
- error= ER_UNKNOWN_ERROR;
- if (str == NULL)
- str= ER(error);
thd->main_da.set_error_status(thd, error, str);
}
query_cache_abort(&thd->net);