From 67a854a79e22f949ed0aedf18a7213142e54dbd5 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 3 Apr 2003 21:19:14 +0300 Subject: Fixed bug in warning handling (Memory was allocated from wrong MEM_ROOT) sql/item_sum.cc: Fixed bug in warning handling. sql/item_sum.h: Fixed bug in warning handling. sql/sql_class.h: Fixed bug in warning handling. sql/sql_error.cc: Fixed bug in warning handling. strings/my_vsnprintf.c: After merge fix --- sql/sql_error.cc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'sql/sql_error.cc') diff --git a/sql/sql_error.cc b/sql/sql_error.cc index 380d42e2580..3b9c329d5e5 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -44,6 +44,19 @@ This file contains the implementation of error and warnings related #include "mysql_priv.h" +/* + Store a new message in an error object + + This is used to in group_concat() to register how many warnings we actually + got after the query has been executed. +*/ + +void MYSQL_ERROR::set_msg(THD *thd, const char *msg_arg) +{ + msg= strdup_root(&thd->warn_root, msg_arg); +} + + /* Reset all warnings for the thread @@ -91,7 +104,7 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, if (thd->query_id != thd->warn_id) mysql_reset_errors(thd); - MYSQL_ERROR *err = NULL; + MYSQL_ERROR *err= NULL; if (thd->warn_list.elements < thd->variables.max_error_count) { @@ -101,7 +114,7 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, */ MEM_ROOT *old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC); my_pthread_setspecific_ptr(THR_MALLOC, &thd->warn_root); - err = new MYSQL_ERROR(code, level, msg); + err= new MYSQL_ERROR(thd, code, level, msg); if (err) thd->warn_list.push_back(err); my_pthread_setspecific_ptr(THR_MALLOC, old_root); -- cgit v1.2.1