diff options
author | unknown <hf@deer.(none)> | 2004-07-21 19:10:37 +0500 |
---|---|---|
committer | unknown <hf@deer.(none)> | 2004-07-21 19:10:37 +0500 |
commit | c5fc0d433ab28d4309297875092888c920dcde3f (patch) | |
tree | e760e781ebd9feba1f0e8c01f34971bd6e703d70 /sql/item_strfunc.cc | |
parent | bf95f9195fe431841fe1e29e6b82c9f47ec52ad3 (diff) | |
parent | 58bdba5785313f89398231f796ba989a4de81a69 (diff) | |
download | mariadb-git-c5fc0d433ab28d4309297875092888c920dcde3f.tar.gz |
Merging
mysql-test/r/func_str.result:
Auto merged
sql/item_geofunc.cc:
Auto merged
sql/item_strfunc.cc:
Auto merged
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r-- | sql/item_strfunc.cc | 65 |
1 files changed, 56 insertions, 9 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index a8805be7854..0e96b0fcef4 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -266,7 +266,12 @@ String *Item_func_concat::val_str(String *str) continue; if (res->length()+res2->length() > current_thd->variables.max_allowed_packet) - goto null; // Error check + { + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WARN_ALLOWED_PACKET_OVERFLOWED, + ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name()); + goto null; + } if (res->alloced_length() >= res->length()+res2->length()) { // Use old buffer res->append(*res2); @@ -544,7 +549,12 @@ String *Item_func_concat_ws::val_str(String *str) if (res->length() + sep_str->length() + res2->length() > current_thd->variables.max_allowed_packet) - goto null; // Error check + { + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WARN_ALLOWED_PACKET_OVERFLOWED, + ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name()); + goto null; + } if (res->alloced_length() >= res->length() + sep_str->length() + res2->length()) { // Use old buffer @@ -801,7 +811,14 @@ redo: offset= (int) (ptr-res->ptr()); if (res->length()-from_length + to_length > current_thd->variables.max_allowed_packet) + { + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WARN_ALLOWED_PACKET_OVERFLOWED, + ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), + func_name()); + goto null; + } if (!alloced) { alloced=1; @@ -822,7 +839,12 @@ skip: { if (res->length()-from_length + to_length > current_thd->variables.max_allowed_packet) + { + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WARN_ALLOWED_PACKET_OVERFLOWED, + ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name()); goto null; + } if (!alloced) { alloced=1; @@ -882,7 +904,12 @@ String *Item_func_insert::val_str(String *str) length=res->length()-start; if (res->length() - length + res2->length() > current_thd->variables.max_allowed_packet) - goto null; // OOM check + { + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WARN_ALLOWED_PACKET_OVERFLOWED, + ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name()); + goto null; + } res=copy_if_not_alloced(str,res,res->length()); res->replace(start,length,*res2); return res; @@ -1934,7 +1961,12 @@ String *Item_func_repeat::val_str(String *str) length=res->length(); // Safe length check if (length > current_thd->variables.max_allowed_packet/count) - goto err; // Probably an error + { + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WARN_ALLOWED_PACKET_OVERFLOWED, + ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name()); + goto err; + } tot_length= length*(uint) count; if (!(res= alloc_buffer(res,str,&tmp_value,tot_length))) goto err; @@ -1999,8 +2031,14 @@ String *Item_func_rpad::val_str(String *str) return (res); } pad_char_length= rpad->numchars(); - if ((ulong) byte_count > current_thd->variables.max_allowed_packet || - args[2]->null_value || !pad_char_length) + if ((ulong) byte_count > current_thd->variables.max_allowed_packet) + { + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WARN_ALLOWED_PACKET_OVERFLOWED, + ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name()); + goto err; + } + if(args[2]->null_value || !pad_char_length) goto err; res_byte_length= res->length(); /* Must be done before alloc_buffer */ if (!(res= alloc_buffer(res,str,&tmp_value,byte_count))) @@ -2079,8 +2117,15 @@ String *Item_func_lpad::val_str(String *str) pad_char_length= pad->numchars(); byte_count= count * collation.collation->mbmaxlen; - if (byte_count > current_thd->variables.max_allowed_packet || - args[2]->null_value || !pad_char_length || str->alloc(byte_count)) + if (byte_count > current_thd->variables.max_allowed_packet) + { + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WARN_ALLOWED_PACKET_OVERFLOWED, + ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name()); + goto err; + } + + if (args[2]->null_value || !pad_char_length || str->alloc(byte_count)) goto err; str->length(0); @@ -2368,7 +2413,9 @@ String *Item_load_file::val_str(String *str) } if (stat_info.st_size > (long) current_thd->variables.max_allowed_packet) { - /* my_error(ER_TOO_LONG_STRING, MYF(0), file_name->c_ptr()); */ + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WARN_ALLOWED_PACKET_OVERFLOWED, + ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name()); goto err; } if (tmp_value.alloc(stat_info.st_size)) |