1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

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()
This commit is contained in:
unknown
2003-04-04 12:33:17 -05:00
parent 1e8cc909de
commit f2f748c631
7 changed files with 212 additions and 35 deletions

View File

@@ -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)
{