#include <item_strfunc.h>
Inheritance diagram for Item_func_insert:


Public Member Functions | |
| Item_func_insert (Item *org, Item *start, Item *length, Item *new_str) | |
| String * | val_str (String *) |
| void | fix_length_and_dec () |
| const char * | func_name () const |
Private Attributes | |
| String | tmp_value |
Definition at line 130 of file item_strfunc.h.
| void Item_func_insert::fix_length_and_dec | ( | ) | [virtual] |
Implements Item_result_field.
Definition at line 986 of file item_strfunc.cc.
References Item_func::agg_arg_charsets(), Item_func::args, Item::collation, MAX_BLOB_WIDTH, Item::max_length, Item::maybe_null, and MY_COLL_ALLOW_CONV.
00987 { 00988 ulonglong max_result_length; 00989 00990 // Handle character set for args[0] and args[3]. 00991 if (agg_arg_charsets(collation, &args[0], 2, MY_COLL_ALLOW_CONV, 3)) 00992 return; 00993 max_result_length= ((ulonglong) args[0]->max_length+ 00994 (ulonglong) args[3]->max_length); 00995 if (max_result_length >= MAX_BLOB_WIDTH) 00996 { 00997 max_result_length= MAX_BLOB_WIDTH; 00998 maybe_null= 1; 00999 } 01000 max_length= (ulong) max_result_length; 01001 }
Here is the call graph for this function:

| const char* Item_func_insert::func_name | ( | ) | const [inline, virtual] |
Implements Item_func.
Definition at line 138 of file item_strfunc.h.
Referenced by val_str().
Here is the caller graph for this function:

Implements Item.
Definition at line 948 of file item_strfunc.cc.
References Item_func::args, String::charpos(), copy_if_not_alloced(), current_thd, DBUG_ASSERT, ER, ER_WARN_ALLOWED_PACKET_OVERFLOWED, Item::fixed, func_name(), String::length(), Item::null_value, push_warning_printf(), String::replace(), start(), tmp_value, Item_str_func::val_int(), Item::val_str(), and MYSQL_ERROR::WARN_LEVEL_WARN.
00949 { 00950 DBUG_ASSERT(fixed == 1); 00951 String *res,*res2; 00952 uint start,length; 00953 00954 null_value=0; 00955 res=args[0]->val_str(str); 00956 res2=args[3]->val_str(&tmp_value); 00957 start=(uint) args[1]->val_int()-1; 00958 length=(uint) args[2]->val_int(); 00959 if (args[0]->null_value || args[1]->null_value || args[2]->null_value || 00960 args[3]->null_value) 00961 goto null; /* purecov: inspected */ 00962 start=res->charpos(start); 00963 length=res->charpos(length,start); 00964 if (start > res->length()+1) 00965 return res; // Wrong param; skip insert 00966 if (length > res->length()-start) 00967 length=res->length()-start; 00968 if (res->length() - length + res2->length() > 00969 current_thd->variables.max_allowed_packet) 00970 { 00971 push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, 00972 ER_WARN_ALLOWED_PACKET_OVERFLOWED, 00973 ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), 00974 func_name(), current_thd->variables.max_allowed_packet); 00975 goto null; 00976 } 00977 res=copy_if_not_alloced(str,res,res->length()); 00978 res->replace(start,length,*res2); 00979 return res; 00980 null: 00981 null_value=1; 00982 return 0; 00983 }
Here is the call graph for this function:

String Item_func_insert::tmp_value [private] |
1.4.7

