summaryrefslogtreecommitdiff
path: root/sql/field_conv.cc
diff options
context:
space:
mode:
authorunknown <bar@bar.intranet.mysql.r18.ru>2006-10-03 16:00:09 +0500
committerunknown <bar@bar.intranet.mysql.r18.ru>2006-10-03 16:00:09 +0500
commit7dad8e692e713c3ea93dee9436a686365e0de22b (patch)
treec5a7e46139bbb959fb88b34de786ab54fa761ac3 /sql/field_conv.cc
parent338d024dcdbdd54493f0362f90cb2f6b02a07b6e (diff)
parentc317c2d224c8d7753cf7acd238968a9a8584dbc4 (diff)
downloadmariadb-git-7dad8e692e713c3ea93dee9436a686365e0de22b.tar.gz
After merge fix
BitKeeper/deleted/.del-ps_6bdb.result: Auto merged client/mysql.cc: Auto merged include/m_ctype.h: Auto merged mysql-test/r/cast.result: Auto merged mysql-test/r/ctype_utf8.result: Auto merged mysql-test/r/ps.result: Auto merged mysql-test/r/ps_2myisam.result: Auto merged mysql-test/r/ps_3innodb.result: Auto merged mysql-test/r/ps_4heap.result: Auto merged mysql-test/r/ps_5merge.result: Auto merged mysql-test/r/ps_7ndb.result: Auto merged mysql-test/t/cast.test: Auto merged mysql-test/t/ctype_utf8.test: Auto merged mysql-test/t/strict.test: Auto merged sql/field_conv.cc: Auto merged sql/item_func.cc: Auto merged strings/ctype-big5.c: Auto merged strings/ctype-bin.c: Auto merged strings/ctype-cp932.c: Auto merged strings/ctype-euc_kr.c: Auto merged strings/ctype-eucjpms.c: Auto merged strings/ctype-gb2312.c: Auto merged strings/ctype-gbk.c: Auto merged strings/ctype-latin1.c: Auto merged strings/ctype-sjis.c: Auto merged strings/ctype-tis620.c: Auto merged strings/ctype-ucs2.c: Auto merged strings/ctype-ujis.c: Auto merged strings/ctype-utf8.c: Auto merged
Diffstat (limited to 'sql/field_conv.cc')
-rw-r--r--sql/field_conv.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index 20d1e372a2c..7bc6c432d1c 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -427,6 +427,21 @@ static void do_varstring2(Copy_field *copy)
length);
}
+
+static void do_varstring2_mb(Copy_field *copy)
+{
+ int well_formed_error;
+ CHARSET_INFO *cs= copy->from_field->charset();
+ uint char_length= (copy->to_length - HA_KEY_BLOB_LENGTH) / cs->mbmaxlen;
+ uint from_length= uint2korr(copy->from_ptr);
+ const char *from_beg= copy->from_ptr + HA_KEY_BLOB_LENGTH;
+ uint length= cs->cset->well_formed_len(cs, from_beg, from_beg + from_length,
+ char_length, &well_formed_error);
+ int2store(copy->to_ptr, length);
+ memcpy(copy->to_ptr+HA_KEY_BLOB_LENGTH, from_beg, length);
+}
+
+
/***************************************************************************
** The different functions that fills in a Copy_field class
***************************************************************************/
@@ -586,7 +601,8 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
return do_field_string;
if (to_length != from_length)
return (((Field_varstring*) to)->length_bytes == 1 ?
- do_varstring1 : do_varstring2);
+ do_varstring1 : (from->charset()->mbmaxlen == 1 ?
+ do_varstring2 : do_varstring2_mb));
}
else if (to_length < from_length)
return (from->charset()->mbmaxlen == 1 ?