Search
j0ke.net Open Build Service
>
Projects
>
internetx
:
mysql5
:
5.0-enterprise
>
mysql-5.0.62-enterprise
> mysql-5.0.26-varbinary-upgrade.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File mysql-5.0.26-varbinary-upgrade.patch of Package mysql-5.0.62-enterprise
--- sql/field_conv.cc +++ sql/field_conv.cc @@ -309,6 +309,21 @@ static void do_field_string(Copy_field * } +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(); @@ -556,6 +571,15 @@ void (*Copy_field::get_copy_func(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. */ --- sql/handler.cc +++ sql/handler.cc @@ -1972,6 +1972,10 @@ int handler::check_old_types() { return HA_ADMIN_NEEDS_ALTER; } + if ((*field)->type() == MYSQL_TYPE_VAR_STRING) + { + return HA_ADMIN_NEEDS_ALTER; + } } } return 0;