summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/field.cc2
-rw-r--r--sql/field.h2
-rw-r--r--sql/item_func.cc5
-rw-r--r--sql/item_strfunc.cc12
-rw-r--r--sql/item_sum.cc2
-rw-r--r--sql/item_timefunc.cc4
-rw-r--r--sql/procedure.h2
-rw-r--r--sql/sql_string.cc7
-rw-r--r--sql/sql_string.h2
9 files changed, 20 insertions, 18 deletions
diff --git a/sql/field.cc b/sql/field.cc
index a219a23ec70..73ef4439bc9 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4302,7 +4302,7 @@ int Field_blob::store(const char *from,uint len,CHARSET_INFO *cs)
}
}
#endif /* USE_TIS620 */
- value.copy(from,len);
+ value.copy(from,len,charset());
from=value.ptr();
#ifdef USE_TIS620
my_free(th_ptr,MYF(MY_ALLOW_ZERO_PTR));
diff --git a/sql/field.h b/sql/field.h
index 685b2c95d1f..8c4c48968c4 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -887,7 +887,7 @@ public:
inline bool copy()
{ char *tmp;
get_ptr(&tmp);
- if (value.copy(tmp,get_length()))
+ if (value.copy(tmp,get_length(),charset()))
{
Field_blob::reset();
return 1;
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 6cb98d4ed90..543a96107dc 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1568,7 +1568,7 @@ void item_user_lock_release(ULL *ull)
char buf[256];
const char *command="DO RELEASE_LOCK(\"";
String tmp(buf,sizeof(buf), system_charset_info);
- tmp.copy(command, strlen(command));
+ tmp.copy(command, strlen(command), tmp.charset());
tmp.append(ull->key,ull->key_length);
tmp.append("\")");
Query_log_event qev(current_thd,tmp.ptr(), tmp.length());
@@ -2040,12 +2040,11 @@ Item_func_get_user_var::val_str(String *str)
str->set(*(longlong*) entry->value,thd_charset());
break;
case STRING_RESULT:
- if (str->copy(entry->value, entry->length-1))
+ if (str->copy(entry->value, entry->length-1, entry->var_charset))
{
null_value=1;
return NULL;
}
- str->set_charset(entry->var_charset);
break;
}
return str;
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index f930afe14a2..6f121ecdc06 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1373,7 +1373,7 @@ String *Item_func_database::val_str(String *str)
String *Item_func_user::val_str(String *str)
{
THD *thd=current_thd;
- if (str->copy((const char*) thd->user,(uint) strlen(thd->user)) ||
+ if (str->copy((const char*) thd->user,(uint) strlen(thd->user), system_charset_info) ||
str->append('@') ||
str->append(thd->host ? thd->host : thd->ip ? thd->ip : ""))
return &empty_string;
@@ -1899,7 +1899,7 @@ String *Item_func_conv::val_str(String *str)
else
dec= (longlong) strtoull(res->c_ptr(),&endptr,from_base);
ptr= longlong2str(dec,ans,to_base);
- if (str->copy(ans,(uint32) (ptr-ans)))
+ if (str->copy(ans,(uint32) (ptr-ans), thd_charset()))
return &empty_string;
return str;
}
@@ -2120,7 +2120,7 @@ String *Item_func_charset::val_str(String *str)
if ((null_value=(args[0]->null_value || !res->charset())))
return 0;
- str->copy(res->charset()->name,strlen(res->charset()->name));
+ str->copy(res->charset()->name,strlen(res->charset()->name),default_charset_info);
return str;
}
@@ -2135,7 +2135,7 @@ String *Item_func_hex::val_str(String *str)
if ((null_value= args[0]->null_value))
return 0;
ptr= longlong2str(dec,ans,16);
- if (str->copy(ans,(uint32) (ptr-ans)))
+ if (str->copy(ans,(uint32) (ptr-ans),default_charset_info))
return &empty_string; // End of memory
return str;
}
@@ -2454,7 +2454,9 @@ String *Item_func_geometry_type::val_str(String *str)
if ((null_value=(args[0]->null_value ||
geom.create_from_wkb(wkt->ptr(),wkt->length()))))
return 0;
- str->copy(geom.get_class_info()->m_name,strlen(geom.get_class_info()->m_name));
+ str->copy(geom.get_class_info()->m_name,
+ strlen(geom.get_class_info()->m_name),
+ default_charset_info);
return str;
}
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index e28e878e57f..db4c45fc412 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -106,7 +106,7 @@ Item_sum_int::val_str(String *str)
return 0;
char buff[21];
uint length= (uint) (longlong10_to_str(nr,buff,-10)-buff);
- str->copy(buff,length);
+ str->copy(buff,length,thd_charset());
return str;
}
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index e81fecabe96..8a1bd0be291 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -396,7 +396,7 @@ String *Item_date::val_str(String *str)
return (String*) 0;
if (!value) // zero daynr
{
- str->copy("0000-00-00",10);
+ str->copy("0000-00-00",10,my_charset_latin1);
return str;
}
if (str->alloc(11))
@@ -547,7 +547,7 @@ String *Item_func_sec_to_time::val_str(String *str)
uint sec= (uint) ((ulonglong) seconds % 3600);
length= my_sprintf(buff,(buff,"%s%02lu:%02u:%02u",sign,(long) (seconds/3600),
sec/60, sec % 60));
- str->copy(buff, length);
+ str->copy(buff, length, my_charset_latin1);
return str;
}
diff --git a/sql/procedure.h b/sql/procedure.h
index 3792d823b12..3434079a8fb 100644
--- a/sql/procedure.h
+++ b/sql/procedure.h
@@ -94,7 +94,7 @@ public:
enum_field_types field_type() const { return FIELD_TYPE_STRING; }
void set(double nr) { str_value.set(nr, 2, my_thd_charset); }
void set(longlong nr) { str_value.set(nr, my_thd_charset); }
- void set(const char *str, uint length) { str_value.copy(str,length); }
+ void set(const char *str, uint length) { str_value.copy(str,length, my_thd_charset); }
double val() { return atof(str_value.ptr()); }
longlong val_int() { return strtoll(str_value.ptr(),NULL,10); }
String *val_str(String*)
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 1276020e3c3..f0f31004544 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -117,7 +117,7 @@ bool String::set(double num,uint decimals, CHARSET_INFO *cs)
if (decimals >= NOT_FIXED_DEC)
{
sprintf(buff,"%.14g",num); // Enough for a DATETIME
- return copy(buff, (uint32) strlen(buff));
+ return copy(buff, (uint32) strlen(buff), my_charset_latin1);
}
#ifdef HAVE_FCONVERT
int decpt,sign;
@@ -182,7 +182,7 @@ end:
#else
sprintf(buff,"%.*f",(int) decimals,num);
#endif
- return copy(buff,(uint32) strlen(buff));
+ return copy(buff,(uint32) strlen(buff), my_charset_latin1);
#endif
}
@@ -208,13 +208,14 @@ bool String::copy(const String &str)
return FALSE;
}
-bool String::copy(const char *str,uint32 arg_length)
+bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *cs)
{
if (alloc(arg_length))
return TRUE;
if ((str_length=arg_length))
memcpy(Ptr,str,arg_length);
Ptr[arg_length]=0;
+ str_charset=cs;
return FALSE;
}
diff --git a/sql/sql_string.h b/sql/sql_string.h
index c881cb22c5c..4ac4308f113 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -178,7 +178,7 @@ public:
bool copy(); // Alloc string if not alloced
bool copy(const String &s); // Allocate new string
- bool copy(const char *s,uint32 arg_length); // Allocate new string
+ bool copy(const char *s,uint32 arg_length, CHARSET_INFO *cs); // Allocate new string
bool append(const String &s);
bool append(const char *s,uint32 arg_length=0);
bool append(IO_CACHE* file, uint32 arg_length);