1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge neptunus.(none):/home/msvensson/mysql/bug19731/my50-bug19731

into  neptunus.(none):/home/msvensson/mysql/bug19731/my51-bug19731
This commit is contained in:
msvensson@neptunus.(none)
2006-11-29 23:05:33 +01:00
10 changed files with 213 additions and 0 deletions

View File

@ -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(&copy->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();
@ -569,6 +584,15 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
// Check if identical fields
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.