MCPcopy Create free account
hub / github.com/MariaDB/server / replace

Method replace

sql/sql_string.cc:721–749  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

719
720
721bool Binary_string::replace(uint32 offset, uint32 arg_length,
722 const char *to, uint32 to_length)
723{
724 long diff = (long) to_length-(long) arg_length;
725 if (offset+arg_length <= str_length)
726 {
727 if (diff < 0)
728 {
729 if (to_length)
730 memcpy(Ptr+offset,to,to_length);
731 bmove(Ptr+offset+to_length,Ptr+offset+arg_length,
732 str_length-offset-arg_length);
733 }
734 else
735 {
736 if (diff)
737 {
738 if (realloc_with_extra_if_needed(str_length+(uint32) diff))
739 return TRUE;
740 bmove_upp((uchar*) Ptr+str_length+diff, (uchar*) Ptr+str_length,
741 str_length-offset-arg_length);
742 }
743 if (to_length)
744 memcpy(Ptr+offset,to,to_length);
745 }
746 str_length+=(uint32) diff;
747 }
748 return FALSE;
749}
750
751
752// added by Holyfoot for "geometry" needs

Callers 15

func_replaceFunction · 0.45
fix_fieldsMethod · 0.45
merge_sub_conditionMethod · 0.45
neg_argumentsMethod · 0.45
subst_vcols_in_orderFunction · 0.45
exists2in_processorMethod · 0.45
val_strMethod · 0.45
val_str_internalMethod · 0.45
update_auto_incrementMethod · 0.45
prep_alter_part_tableFunction · 0.45

Calls 1

bmove_uppFunction · 0.85

Tested by 1

func_replaceFunction · 0.36