diff options
author | unknown <msvensson@neptunus.(none)> | 2006-11-29 23:08:35 +0100 |
---|---|---|
committer | unknown <msvensson@neptunus.(none)> | 2006-11-29 23:08:35 +0100 |
commit | 30278aedced207e1cc5284c2c5fcb8f36f467d6d (patch) | |
tree | fee046d7ddf29bccad0ada6847bb80589739ab28 /sql | |
parent | 66466ddfa66d4e360b854176735e5067c2de4fe0 (diff) | |
parent | 8e0614c83950b6189eb1dfc218b13546fa663c13 (diff) | |
download | mariadb-git-30278aedced207e1cc5284c2c5fcb8f36f467d6d.tar.gz |
Merge neptunus.(none):/home/msvensson/mysql/bug19731/my50-bug19731
into neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint
mysql-test/r/mysqltest.result:
Auto merged
mysql-test/t/mysqltest.test:
Auto merged
sql/handler.cc:
Auto merged
client/mysqltest.c:
Manual merge
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field_conv.cc | 24 | ||||
-rw-r--r-- | sql/handler.cc | 4 |
2 files changed, 28 insertions, 0 deletions
diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 95ff985376d..3286695d733 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -309,6 +309,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(); @@ -571,6 +586,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. */ diff --git a/sql/handler.cc b/sql/handler.cc index 3f0411d6198..93442b4f852 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1982,6 +1982,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; |