summaryrefslogtreecommitdiff
path: root/sql/sql_string.cc
diff options
context:
space:
mode:
authorunknown <venu@myvenu.com>2003-04-04 12:33:17 -0500
committerunknown <venu@myvenu.com>2003-04-04 12:33:17 -0500
commitf2f748c6318f863d7f7002a1b4ec57112f0ea781 (patch)
tree42fe434d04bcff35deb6004f260c42604b271580 /sql/sql_string.cc
parent1e8cc909de55b33b7a73ebfa7186598c1a7dbba3 (diff)
downloadmariadb-git-f2f748c6318f863d7f7002a1b4ec57112f0ea781.tar.gz
Fix to support update + bianry logs with prepared statements (Dynamic query)
sql/item.cc: query_val_str to return param item value in string format sql/item.h: Misc defination changes for Item_param sql/sql_class.h: Changes for PREP_STMT sql/sql_string.cc: Duplicate String::replace to take char * and length as arguments sql/sql_yacc.yy: Change to take param marker position to Item_param as an argument sql/sql_prepare.cc: Fix for binary + update logs sql/sql_string.h: Added new replace()
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)
{