summaryrefslogtreecommitdiff
path: root/sql/sql_string.cc
diff options
context:
space:
mode:
authorvenu@myvenu.com <>2003-04-04 12:33:17 -0500
committervenu@myvenu.com <>2003-04-04 12:33:17 -0500
commit8eeecd9c86e97d89b19ad98de6cf2b81197da628 (patch)
tree42fe434d04bcff35deb6004f260c42604b271580 /sql/sql_string.cc
parentb5af8d771edccea2335d530a4fd08b45275f744c (diff)
downloadmariadb-git-8eeecd9c86e97d89b19ad98de6cf2b81197da628.tar.gz
Fix to support update + bianry logs with prepared statements (Dynamic query)
Diffstat (limited to 'sql/sql_string.cc')
-rw-r--r--sql/sql_string.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index ffa272713de..ca38651b3b6 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -508,14 +508,20 @@ skipp:
bool String::replace(uint32 offset,uint32 arg_length,const String &to)
{
- long diff = (long) to.length()-(long) arg_length;
+ return replace(offset,arg_length,to.ptr(),to.length());
+}
+
+bool String::replace(uint32 offset,uint32 arg_length,
+ const char *to,uint32 length)
+{
+ long diff = (long) length-(long) arg_length;
if (offset+arg_length <= str_length)
{
if (diff < 0)
{
- if (to.length())
- memcpy(Ptr+offset,to.ptr(),to.length());
- bmove(Ptr+offset+to.length(),Ptr+offset+arg_length,
+ if (length)
+ memcpy(Ptr+offset,to,length);
+ bmove(Ptr+offset+length,Ptr+offset+arg_length,
str_length-offset-arg_length);
}
else
@@ -527,14 +533,15 @@ bool String::replace(uint32 offset,uint32 arg_length,const String &to)
bmove_upp(Ptr+str_length+diff,Ptr+str_length,
str_length-offset-arg_length);
}
- if (to.length())
- memcpy(Ptr+offset,to.ptr(),to.length());
+ if (length)
+ memcpy(Ptr+offset,to,length);
}
str_length+=(uint32) diff;
}
return FALSE;
}
+
// added by Holyfoot for "geometry" needs
int String::reserve(uint32 space_needed, uint32 grow_by)
{