diff options
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r-- | sql/item_strfunc.cc | 350 |
1 files changed, 208 insertions, 142 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index d46261e6509..b31b95babb8 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -284,10 +284,14 @@ String *Item_func_sha2::val_str_ascii(String *str) #endif default: if (!args[1]->const_item()) - push_warning_printf(current_thd, + { + THD *thd= current_thd; + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WRONG_PARAMETERS_TO_NATIVE_FCT, - ER(ER_WRONG_PARAMETERS_TO_NATIVE_FCT), "sha2"); + ER_THD(thd, ER_WRONG_PARAMETERS_TO_NATIVE_FCT), + "sha2"); + } null_value= TRUE; return NULL; } @@ -308,11 +312,12 @@ String *Item_func_sha2::val_str_ascii(String *str) return str; #else - push_warning_printf(current_thd, - Sql_condition::WARN_LEVEL_WARN, - ER_FEATURE_DISABLED, - ER(ER_FEATURE_DISABLED), - "sha2", "--with-ssl"); + THD *thd= current_thd; + push_warning_printf(thd, + Sql_condition::WARN_LEVEL_WARN, + ER_FEATURE_DISABLED, + ER_THD(thd, ER_FEATURE_DISABLED), + "sha2", "--with-ssl"); null_value= TRUE; return (String *) NULL; #endif /* defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) */ @@ -346,21 +351,24 @@ void Item_func_sha2::fix_length_and_dec() break; #endif default: - push_warning_printf(current_thd, - Sql_condition::WARN_LEVEL_WARN, - ER_WRONG_PARAMETERS_TO_NATIVE_FCT, - ER(ER_WRONG_PARAMETERS_TO_NATIVE_FCT), "sha2"); + THD *thd= current_thd; + push_warning_printf(thd, + Sql_condition::WARN_LEVEL_WARN, + ER_WRONG_PARAMETERS_TO_NATIVE_FCT, + ER_THD(thd, ER_WRONG_PARAMETERS_TO_NATIVE_FCT), + "sha2"); } CHARSET_INFO *cs= get_checksum_charset(args[0]->collation.collation->csname); args[0]->collation.set(cs, DERIVATION_COERCIBLE); #else - push_warning_printf(current_thd, - Sql_condition::WARN_LEVEL_WARN, - ER_FEATURE_DISABLED, - ER(ER_FEATURE_DISABLED), - "sha2", "--with-ssl"); + THD *thd= current_thd; + push_warning_printf(thd, + Sql_condition::WARN_LEVEL_WARN, + ER_FEATURE_DISABLED, + ER_THD(thd, ER_FEATURE_DISABLED), + "sha2", "--with-ssl"); #endif /* defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) */ } @@ -462,10 +470,12 @@ String *Item_func_to_base64::val_str_ascii(String *str) null_value= 1; // NULL input, too long input, or OOM. if (too_long) { - push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, + THD *thd= current_thd; + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WARN_ALLOWED_PACKET_OVERFLOWED, - ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(), - current_thd->variables.max_allowed_packet); + ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED), + func_name(), + thd->variables.max_allowed_packet); } return 0; } @@ -505,10 +515,12 @@ String *Item_func_from_base64::val_str(String *str) ((uint) (length= base64_needed_decoded_length((int) res->length())) > current_thd->variables.max_allowed_packet)) { - push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, + THD *thd= current_thd; + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WARN_ALLOWED_PACKET_OVERFLOWED, - ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(), - current_thd->variables.max_allowed_packet); + ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED), + func_name(), + thd->variables.max_allowed_packet); goto err; } @@ -519,8 +531,9 @@ String *Item_func_from_base64::val_str(String *str) (char *) tmp_value.ptr(), &end_ptr, 0)) < 0 || end_ptr < res->ptr() + res->length()) { - push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, - ER_BAD_BASE64_DATA, ER(ER_BAD_BASE64_DATA), + THD *thd= current_thd; + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_BAD_BASE64_DATA, ER_THD(thd, ER_BAD_BASE64_DATA), end_ptr - res->ptr()); goto err; } @@ -650,10 +663,12 @@ String *Item_func_concat::val_str(String *str) if (res->length()+res2->length() > current_thd->variables.max_allowed_packet) { - push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, + THD *thd= current_thd; + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WARN_ALLOWED_PACKET_OVERFLOWED, - ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(), - current_thd->variables.max_allowed_packet); + ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED), + func_name(), + thd->variables.max_allowed_packet); goto null; } if (!is_const && res->alloced_length() >= res->length()+res2->length()) @@ -856,12 +871,14 @@ String *Item_func_des_encrypt::val_str(String *str) return &tmp_value; error: - push_warning_printf(current_thd,Sql_condition::WARN_LEVEL_WARN, - code, ER(code), - "des_encrypt"); + THD *thd= current_thd; + push_warning_printf(thd,Sql_condition::WARN_LEVEL_WARN, + code, ER_THD(thd, code), + "des_encrypt"); #else - push_warning_printf(current_thd,Sql_condition::WARN_LEVEL_WARN, - ER_FEATURE_DISABLED, ER(ER_FEATURE_DISABLED), + THD *thd= current_thd; + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_FEATURE_DISABLED, ER_THD(thd, ER_FEATURE_DISABLED), "des_encrypt", "--with-ssl"); #endif /* defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) */ null_value=1; @@ -934,14 +951,20 @@ String *Item_func_des_decrypt::val_str(String *str) return &tmp_value; error: - push_warning_printf(current_thd,Sql_condition::WARN_LEVEL_WARN, - code, ER(code), - "des_decrypt"); + { + THD *thd= current_thd; + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + code, ER_THD(thd, code), + "des_decrypt"); + } wrong_key: #else - push_warning_printf(current_thd,Sql_condition::WARN_LEVEL_WARN, - ER_FEATURE_DISABLED, ER(ER_FEATURE_DISABLED), - "des_decrypt", "--with-ssl"); + { + THD *thd= current_thd; + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_FEATURE_DISABLED, ER_THD(thd, ER_FEATURE_DISABLED), + "des_decrypt", "--with-ssl"); + } #endif /* defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) */ null_value=1; return 0; @@ -961,6 +984,7 @@ String *Item_func_concat_ws::val_str(String *str) *sep_str, *res, *res2,*use_as_buff; uint i; bool is_const= 0; + THD *thd= 0; null_value=0; if (!(sep_str= args[0]->val_str(&tmp_sep_str))) @@ -988,12 +1012,13 @@ String *Item_func_concat_ws::val_str(String *str) continue; // Skip NULL if (res->length() + sep_str->length() + res2->length() > - current_thd->variables.max_allowed_packet) + (thd ? thd : (thd= current_thd))->variables.max_allowed_packet) { - push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WARN_ALLOWED_PACKET_OVERFLOWED, - ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(), - current_thd->variables.max_allowed_packet); + ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED), + func_name(), + thd->variables.max_allowed_packet); goto null; } if (!is_const && res->alloced_length() >= @@ -1193,6 +1218,7 @@ String *Item_func_replace::val_str(String *str) register uint32 l; bool binary_cmp; #endif + THD *thd= 0; null_value=0; res=args[0]->val_str(str); @@ -1240,49 +1266,52 @@ redo: end= strend ? strend - from_length + 1 : NULL; while (ptr < end) { - if (*ptr == *search) + if (*ptr == *search) + { + register char *i,*j; + i=(char*) ptr+1; j=(char*) search+1; + while (j != search_end) + if (*i++ != *j++) goto skip; + offset= (int) (ptr-res->ptr()); + if (res->length()-from_length + to_length > + (thd ? thd : (thd= current_thd))->variables.max_allowed_packet) { - register char *i,*j; - i=(char*) ptr+1; j=(char*) search+1; - while (j != search_end) - if (*i++ != *j++) goto skip; - offset= (int) (ptr-res->ptr()); - if (res->length()-from_length + to_length > - current_thd->variables.max_allowed_packet) - { - push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, - ER_WARN_ALLOWED_PACKET_OVERFLOWED, - ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), - func_name(), - current_thd->variables.max_allowed_packet); + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_WARN_ALLOWED_PACKET_OVERFLOWED, + ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED), + func_name(), + thd->variables.max_allowed_packet); - goto null; - } - if (!alloced) - { - alloced=1; - res=copy_if_not_alloced(str,res,res->length()+to_length); - } - res->replace((uint) offset,from_length,*res3); - offset+=(int) to_length; - goto redo; + goto null; } -skip: - if ((l=my_ismbchar(res->charset(), ptr,strend))) ptr+=l; - else ++ptr; + if (!alloced) + { + alloced=1; + res=copy_if_not_alloced(str,res,res->length()+to_length); + } + res->replace((uint) offset,from_length,*res3); + offset+=(int) to_length; + goto redo; + } + skip: + if ((l=my_ismbchar(res->charset(), ptr,strend))) ptr+=l; + else ++ptr; } } else #endif /* USE_MB */ + { + THD *thd= current_thd; do { if (res->length()-from_length + to_length > - current_thd->variables.max_allowed_packet) + thd->variables.max_allowed_packet) { - push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WARN_ALLOWED_PACKET_OVERFLOWED, - ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(), - current_thd->variables.max_allowed_packet); + ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED), + func_name(), + thd->variables.max_allowed_packet); goto null; } if (!alloced) @@ -1294,6 +1323,7 @@ skip: offset+=(int) to_length; } while ((offset=res->strstr(*res2,(uint) offset)) >= 0); + } return res; null: @@ -1547,14 +1577,17 @@ String *Item_func_insert::val_str(String *str) if (length > res->length() - start) length= res->length() - start; - if ((ulonglong) (res->length() - length + res2->length()) > - (ulonglong) current_thd->variables.max_allowed_packet) { - push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, - ER_WARN_ALLOWED_PACKET_OVERFLOWED, - ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), - func_name(), current_thd->variables.max_allowed_packet); - goto null; + THD *thd= current_thd; + if ((ulonglong) (res->length() - length + res2->length()) > + (ulonglong) thd->variables.max_allowed_packet) + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_WARN_ALLOWED_PACKET_OVERFLOWED, + ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED), + func_name(), thd->variables.max_allowed_packet); + goto null; + } } res=copy_if_not_alloced(str,res,res->length()); res->replace((uint32) start,(uint32) length,*res2); @@ -2575,9 +2608,10 @@ MY_LOCALE *Item_func_format::get_locale(Item *item) if (!locale_name || !(lc= my_locale_by_name(locale_name->c_ptr_safe()))) { - push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, + THD *thd= current_thd; + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_LOCALE, - ER(ER_UNKNOWN_LOCALE), + ER_THD(thd, ER_UNKNOWN_LOCALE), locale_name ? locale_name->c_ptr_safe() : "NULL"); lc= &my_locale_en_US; } @@ -2962,14 +2996,18 @@ String *Item_func_repeat::val_str(String *str) if (count == 1) // To avoid reallocs return res; length=res->length(); + // Safe length check - if (length > current_thd->variables.max_allowed_packet / (uint) count) { - push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, - ER_WARN_ALLOWED_PACKET_OVERFLOWED, - ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), - func_name(), current_thd->variables.max_allowed_packet); - goto err; + THD *thd= current_thd; + if (length > thd->variables.max_allowed_packet / (uint) count) + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_WARN_ALLOWED_PACKET_OVERFLOWED, + ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED), + func_name(), thd->variables.max_allowed_packet); + goto err; + } } tot_length= length*(uint) count; if (!(res= alloc_buffer(res,str,&tmp_value,tot_length))) @@ -3035,16 +3073,18 @@ String *Item_func_space::val_str(String *str) // Safe length check tot_length= (uint) count * cs->mbminlen; - if (tot_length > current_thd->variables.max_allowed_packet) { - push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, - ER_WARN_ALLOWED_PACKET_OVERFLOWED, - ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), - func_name(), - current_thd->variables.max_allowed_packet); - goto err; - } - + THD *thd= current_thd; + if (tot_length > thd->variables.max_allowed_packet) + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_WARN_ALLOWED_PACKET_OVERFLOWED, + ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED), + func_name(), + thd->variables.max_allowed_packet); + goto err; + } + } if (str->alloc(tot_length)) goto err; str->length(tot_length); @@ -3165,13 +3205,16 @@ String *Item_func_rpad::val_str(String *str) pad_char_length= rpad->numchars(); byte_count= count * collation.collation->mbmaxlen; - if ((ulonglong) byte_count > current_thd->variables.max_allowed_packet) { - push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, - ER_WARN_ALLOWED_PACKET_OVERFLOWED, - ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), - func_name(), current_thd->variables.max_allowed_packet); - goto err; + THD *thd= current_thd; + if ((ulonglong) byte_count > thd->variables.max_allowed_packet) + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_WARN_ALLOWED_PACKET_OVERFLOWED, + ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED), + func_name(), thd->variables.max_allowed_packet); + goto err; + } } if (args[2]->null_value || !pad_char_length) goto err; @@ -3273,13 +3316,16 @@ String *Item_func_lpad::val_str(String *str) pad_char_length= pad->numchars(); byte_count= count * collation.collation->mbmaxlen; - if ((ulonglong) byte_count > current_thd->variables.max_allowed_packet) { - push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, - ER_WARN_ALLOWED_PACKET_OVERFLOWED, - ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), - func_name(), current_thd->variables.max_allowed_packet); - goto err; + THD *thd= current_thd; + if ((ulonglong) byte_count > thd->variables.max_allowed_packet) + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_WARN_ALLOWED_PACKET_OVERFLOWED, + ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED), + func_name(), thd->variables.max_allowed_packet); + goto err; + } } if (args[2]->null_value || !pad_char_length || @@ -3550,15 +3596,18 @@ String *Item_func_weight_string::val_str(String *str) tmp_length= cs->coll->strnxfrmlen(cs, char_length * cs->mbmaxlen); } - if(tmp_length > current_thd->variables.max_allowed_packet) { - push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, - ER_WARN_ALLOWED_PACKET_OVERFLOWED, - ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(), - current_thd->variables.max_allowed_packet); - goto nl; + THD *thd= current_thd; + if (tmp_length > current_thd->variables.max_allowed_packet) + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_WARN_ALLOWED_PACKET_OVERFLOWED, + ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED), + func_name(), + thd->variables.max_allowed_packet); + goto nl; + } } - if (tmp_value.alloc(tmp_length)) goto nl; @@ -3744,13 +3793,17 @@ String *Item_load_file::val_str(String *str) /* my_error(ER_TEXTFILE_NOT_READABLE, MYF(0), file_name->c_ptr()); */ goto err; } - if (stat_info.st_size > (long) current_thd->variables.max_allowed_packet) + { - push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, - ER_WARN_ALLOWED_PACKET_OVERFLOWED, - ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), - func_name(), current_thd->variables.max_allowed_packet); - goto err; + THD *thd= current_thd; + if (stat_info.st_size > (long) thd->variables.max_allowed_packet) + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_WARN_ALLOWED_PACKET_OVERFLOWED, + ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED), + func_name(), thd->variables.max_allowed_packet); + goto err; + } } if (tmp_value.alloc((size_t)stat_info.st_size)) goto err; @@ -3829,7 +3882,8 @@ String* Item_func_export_set::val_str(String* str) } null_value= false; - const ulong max_allowed_packet= current_thd->variables.max_allowed_packet; + THD *thd= current_thd; + const ulong max_allowed_packet= thd->variables.max_allowed_packet; const uint num_separators= num_set_values > 0 ? num_set_values - 1 : 0; const ulonglong max_total_length= num_set_values * MY_MAX(yes->length(), no->length()) + @@ -3837,9 +3891,9 @@ String* Item_func_export_set::val_str(String* str) if (unlikely(max_total_length > max_allowed_packet)) { - push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_WARN_ALLOWED_PACKET_OVERFLOWED, - ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), + ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(), max_allowed_packet); null_value= true; return NULL; @@ -4043,9 +4097,10 @@ longlong Item_func_uncompressed_length::val_int() */ if (res->length() <= 4) { - push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, + THD *thd= current_thd; + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_ZLIB_Z_DATA_ERROR, - ER(ER_ZLIB_Z_DATA_ERROR)); + ER_THD(thd, ER_ZLIB_Z_DATA_ERROR)); null_value= 1; return 0; } @@ -4119,8 +4174,10 @@ String *Item_func_compress::val_str(String *str) if ((err= my_compress_buffer(body, &new_size, (const uchar *)res->ptr(), res->length())) != Z_OK) { + THD *thd= current_thd; code= err==Z_MEM_ERROR ? ER_ZLIB_Z_MEM_ERROR : ER_ZLIB_Z_BUF_ERROR; - push_warning(current_thd,Sql_condition::WARN_LEVEL_WARN,code,ER(code)); + push_warning(thd, Sql_condition::WARN_LEVEL_WARN, code, + ER_THD(thd, code)); null_value= 1; return 0; } @@ -4158,9 +4215,10 @@ String *Item_func_uncompress::val_str(String *str) /* If length is less than 4 bytes, data is corrupt */ if (res->length() <= 4) { - push_warning_printf(current_thd,Sql_condition::WARN_LEVEL_WARN, + THD *thd= current_thd; + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_ZLIB_Z_DATA_ERROR, - ER(ER_ZLIB_Z_DATA_ERROR)); + ER_THD(thd, ER_ZLIB_Z_DATA_ERROR)); goto err; } @@ -4168,10 +4226,11 @@ String *Item_func_uncompress::val_str(String *str) new_size= uint4korr(res->ptr()) & 0x3FFFFFFF; if (new_size > current_thd->variables.max_allowed_packet) { - push_warning_printf(current_thd,Sql_condition::WARN_LEVEL_WARN, + THD *thd= current_thd; + push_warning_printf(thd,Sql_condition::WARN_LEVEL_WARN, ER_TOO_BIG_FOR_UNCOMPRESS, - ER(ER_TOO_BIG_FOR_UNCOMPRESS), - static_cast<int>(current_thd->variables. + ER_THD(thd, ER_TOO_BIG_FOR_UNCOMPRESS), + static_cast<int>(thd->variables. max_allowed_packet)); goto err; } @@ -4187,7 +4246,10 @@ String *Item_func_uncompress::val_str(String *str) code= ((err == Z_BUF_ERROR) ? ER_ZLIB_Z_BUF_ERROR : ((err == Z_MEM_ERROR) ? ER_ZLIB_Z_MEM_ERROR : ER_ZLIB_Z_DATA_ERROR)); - push_warning(current_thd,Sql_condition::WARN_LEVEL_WARN,code,ER(code)); + { + THD *thd= current_thd; + push_warning(thd, Sql_condition::WARN_LEVEL_WARN, code, ER_THD(thd, code)); + } err: null_value= 1; @@ -4877,11 +4939,12 @@ longlong Item_dyncol_get::val_int() num= double_to_longlong(val.x.double_value, unsigned_flag, &error); if (error) { + THD *thd= current_thd; char buff[30]; sprintf(buff, "%lg", val.x.double_value); - push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_DATA_OVERFLOW, - ER(ER_DATA_OVERFLOW), + ER_THD(thd, ER_DATA_OVERFLOW), buff, unsigned_flag ? "UNSIGNED INT" : "INT"); } @@ -4896,12 +4959,13 @@ longlong Item_dyncol_get::val_int() num= my_strtoll10(val.x.string.value.str, &end, &error); if (end != org_end || error > 0) { + THD *thd= current_thd; char buff[80]; strmake(buff, val.x.string.value.str, MY_MIN(sizeof(buff)-1, val.x.string.value.length)); - push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_BAD_DATA, - ER(ER_BAD_DATA), + ER_THD(thd, ER_BAD_DATA), buff, unsigned_flag ? "UNSIGNED INT" : "INT"); } @@ -4960,12 +5024,13 @@ double Item_dyncol_get::val_real() if (end != (char*) val.x.string.value.str + val.x.string.value.length || error) { + THD *thd= current_thd; char buff[80]; strmake(buff, val.x.string.value.str, MY_MIN(sizeof(buff)-1, val.x.string.value.length)); - push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_BAD_DATA, - ER(ER_BAD_DATA), + ER_THD(thd, ER_BAD_DATA), buff, "DOUBLE"); } return res; @@ -5021,9 +5086,10 @@ my_decimal *Item_dyncol_get::val_decimal(my_decimal *decimal_value) val.x.string.value.length)); if (rc != E_DEC_OK) { - push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, + THD *thd= current_thd; + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_BAD_DATA, - ER(ER_BAD_DATA), + ER_THD(thd, ER_BAD_DATA), buff, "DECIMAL"); } break; |