fix "enforce no trailing \n in Diagnostic_area messages"
cannot have an assert in Warning_info::push_warning() because SQL command SIGNAL can set an absolutely arbitrary message, even an empty one or ending with '\n' move the assert into push_warning() and my_message_sql(). followup for 9508a44c3761
This commit is contained in:
parent
505b7127c9
commit
82fd202fa4
@ -3077,10 +3077,13 @@ void my_message_sql(uint error, const char *str, myf MyFlags)
|
||||
MyFlags));
|
||||
|
||||
DBUG_ASSERT(str != NULL);
|
||||
DBUG_ASSERT(*str != '\0');
|
||||
DBUG_ASSERT(error != 0);
|
||||
DBUG_ASSERT((MyFlags & ~(ME_BELL | ME_ERROR_LOG | ME_ERROR_LOG_ONLY |
|
||||
ME_NOTE | ME_WARNING | ME_FATAL)) == 0);
|
||||
|
||||
DBUG_ASSERT(str[strlen(str)-1] != '\n');
|
||||
|
||||
if (MyFlags & ME_NOTE)
|
||||
{
|
||||
level= Sql_condition::WARN_LEVEL_NOTE;
|
||||
|
@ -692,7 +692,6 @@ Sql_condition *Warning_info::push_warning(THD *thd,
|
||||
const char *msg)
|
||||
{
|
||||
Sql_condition *cond= NULL;
|
||||
DBUG_ASSERT(msg[strlen(msg)-1] != '\n');
|
||||
|
||||
if (! m_read_only)
|
||||
{
|
||||
@ -750,6 +749,7 @@ void push_warning(THD *thd, Sql_condition::enum_warning_level level,
|
||||
if (level == Sql_condition::WARN_LEVEL_ERROR)
|
||||
level= Sql_condition::WARN_LEVEL_WARN;
|
||||
|
||||
DBUG_ASSERT(msg[strlen(msg)-1] != '\n');
|
||||
(void) thd->raise_condition(code, NULL, level, msg);
|
||||
|
||||
/* Make sure we also count warnings pushed after calling set_ok_status(). */
|
||||
|
@ -3086,6 +3086,8 @@ err:
|
||||
}
|
||||
else if (info->errmsg != NULL)
|
||||
safe_strcpy(info->error_text, sizeof(info->error_text), info->errmsg);
|
||||
else if (info->error_text[0] == 0)
|
||||
safe_strcpy(info->error_text, sizeof(info->error_text), ER(info->error));
|
||||
|
||||
my_message(info->error, info->error_text, MYF(0));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user