diff options
author | unknown <pgalbraith@bk-internal.mysql.com> | 2006-12-09 02:34:42 +0100 |
---|---|---|
committer | unknown <pgalbraith@bk-internal.mysql.com> | 2006-12-09 02:34:42 +0100 |
commit | 9e82f299e526ceafd0deb105f0487681406b1be8 (patch) | |
tree | a683748b700b98b6f378009228727821e369623b /sql/field_conv.cc | |
parent | b0a5cd8ed133b8bce2ab470826dd8d91ec27fa9d (diff) | |
parent | e54bbaa3fb8793905d37af808b9bee6a49df358a (diff) | |
download | mariadb-git-9e82f299e526ceafd0deb105f0487681406b1be8.tar.gz |
Merge bk-internal.mysql.com:/data0/bk/mysql-5.1
into bk-internal.mysql.com:/data0/bk/mysql-5.1-arch
client/mysql.cc:
Auto merged
sql/field_conv.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
Diffstat (limited to 'sql/field_conv.cc')
-rw-r--r-- | sql/field_conv.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 1611ea7bb3a..faf7094489b 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -308,6 +308,21 @@ static void do_field_string(Copy_field *copy) } +static void do_field_varbinary_pre50(Copy_field *copy) +{ + char buff[MAX_FIELD_WIDTH]; + copy->tmp.set_quick(buff,sizeof(buff),copy->tmp.charset()); + copy->from_field->val_str(©->tmp); + + /* Use the same function as in 4.1 to trim trailing spaces */ + uint length= my_lengthsp_8bit(&my_charset_bin, copy->tmp.c_ptr_quick(), + copy->from_field->field_length); + + copy->to_field->store(copy->tmp.c_ptr_quick(), length, + copy->tmp.charset()); +} + + static void do_field_int(Copy_field *copy) { longlong value= copy->from_field->val_int(); @@ -570,6 +585,15 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*) if (from->result_type() == STRING_RESULT) { /* + Detect copy from pre 5.0 varbinary to varbinary as of 5.0 and + use special copy function that removes trailing spaces and thus + repairs data. + */ + if (from->type() == MYSQL_TYPE_VAR_STRING && !from->has_charset() && + to->type() == MYSQL_TYPE_VARCHAR && !to->has_charset()) + return do_field_varbinary_pre50; + + /* If we are copying date or datetime's we have to check the dates if we don't allow 'all' dates. */ |