summaryrefslogtreecommitdiff
path: root/sql/field_conv.cc
diff options
context:
space:
mode:
authorunknown <pem@mysql.com>2006-03-03 12:03:27 +0100
committerunknown <pem@mysql.com>2006-03-03 12:03:27 +0100
commit5a78cd7a7294f7a930389874f64d6c252f485704 (patch)
treee2df16ff96563c43b76904332f584b344892a56f /sql/field_conv.cc
parent104b9e789a60c8881e6e82cbbf7b8d919ff1bbf1 (diff)
parente2ba74b8252586bd27ace8603aab33c76b2b50cd (diff)
downloadmariadb-git-5a78cd7a7294f7a930389874f64d6c252f485704.tar.gz
Merge mysql.com:/extern/mysql/5.0/bug17476/mysql-5.0
into mysql.com:/extern/mysql/5.1/generic/mysql-5.1-new mysql-test/mysql-test-run.pl: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/r/grant2.result: Auto merged mysql-test/r/sp.result: Auto merged mysql-test/t/grant2.test: Auto merged mysql-test/t/skip_grants.test: Auto merged mysql-test/t/sp.test: Auto merged scripts/make_binary_distribution.sh: Auto merged sql/field_conv.cc: Auto merged sql/item.h: Auto merged sql/item_timefunc.cc: Auto merged sql/sql_udf.cc: Auto merged VC++Files/mysql.sln: Manual merge (use local). configure.in: Manual merge. sql/table.cc: Manual merge.
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 d46a3aa8be3..0c385efd10b 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -378,6 +378,16 @@ static void do_cut_string_complex(Copy_field *copy)
+static void do_expand_binary(Copy_field *copy)
+{
+ CHARSET_INFO *cs= copy->from_field->charset();
+ memcpy(copy->to_ptr,copy->from_ptr,copy->from_length);
+ cs->cset->fill(cs, copy->to_ptr+copy->from_length,
+ copy->to_length-copy->from_length, '\0');
+}
+
+
+
static void do_expand_string(Copy_field *copy)
{
CHARSET_INFO *cs= copy->from_field->charset();
@@ -582,7 +592,13 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
return (from->charset()->mbmaxlen == 1 ?
do_cut_string : do_cut_string_complex);
else if (to_length > from_length)
- return do_expand_string;
+ {
+ if ((to->flags & BINARY_FLAG) != 0)
+ return do_expand_binary;
+ else
+ return do_expand_string;
+ }
+
}
else if (to->real_type() != from->real_type() ||
to_length != from_length ||