Commit 902a9a9f authored by unknown's avatar unknown

field.cc:

  http://bugs.mysql.com/bug.php?id=2218
  updating utf-8 text field generate nonsense chars
  Fix for the above bug.


sql/field.cc:
  http://bugs.mysql.com/bug.php?id=2218
  updating utf-8 text field generate nonsense chars
  Fix for the above bug.
parent 926c90b2
...@@ -4567,17 +4567,19 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs) ...@@ -4567,17 +4567,19 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
} }
else else
{ {
bool was_conversion;
char buff[80]; char buff[80];
String tmpstr(buff,sizeof(buff), &my_charset_bin); String tmpstr(buff,sizeof(buff), &my_charset_bin);
/* Convert character set if nesessary */ /* Convert character set if nesessary */
if (use_conversion(cs, field_charset)) if ((was_conversion= use_conversion(cs, field_charset)))
{ {
tmpstr.copy(from, length, cs, field_charset); tmpstr.copy(from, length, cs, field_charset);
from= tmpstr.ptr(); from= tmpstr.ptr();
length= tmpstr.length(); length= tmpstr.length();
} }
Field_blob::store_length(length); Field_blob::store_length(length);
if (table->copy_blobs || length <= MAX_FIELD_WIDTH) if (was_conversion || table->copy_blobs || length <= MAX_FIELD_WIDTH)
{ // Must make a copy { // Must make a copy
if (from != value.ptr()) // For valgrind if (from != value.ptr()) // For valgrind
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment