diff --git a/sql/handler.cc b/sql/handler.cc index 2842279496988bb86ac81ca5f70ef5564bdbca92..2c7d15d9631b635b10caaf70dd061f7d5b7f1560 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -3534,39 +3534,6 @@ bool handler::get_error_message(int error, String* buf) return FALSE; } -/** - Check if a collation has changed number - - @param mysql_version - @param current collation number - - @retval new collation number (same as current collation number of no change) -*/ - -uint upgrade_collation(ulong mysql_version, uint cs_number) -{ - if (mysql_version >= 50300 && mysql_version <= 50399) - { - switch (cs_number) { - case 149: return MY_PAGE2_COLLATION_ID_UCS2; // ucs2_crotian_ci - case 213: return MY_PAGE2_COLLATION_ID_UTF8; // utf8_crotian_ci - } - } - if ((mysql_version >= 50500 && mysql_version <= 50599) || - (mysql_version >= 100000 && mysql_version <= 100005)) - { - switch (cs_number) { - case 149: return MY_PAGE2_COLLATION_ID_UCS2; // ucs2_crotian_ci - case 213: return MY_PAGE2_COLLATION_ID_UTF8; // utf8_crotian_ci - case 214: return MY_PAGE2_COLLATION_ID_UTF32; // utf32_croatian_ci - case 215: return MY_PAGE2_COLLATION_ID_UTF16; // utf16_croatian_ci - case 245: return MY_PAGE2_COLLATION_ID_UTF8MB4;// utf8mb4_croatian_ci - } - } - return cs_number; -} - - /** Check for incompatible collation changes. @@ -3611,25 +3578,6 @@ int handler::check_collation_compatibility() } } - if (mysql_version < 100006) - { - /* - Check if we are using collations from that has changed numbering. - This happend at least between MariaDB 5.5 and MariaDB 10.0 as MySQL - added conflicting numbers. - */ - - if (table->s->table_charset->number != - upgrade_collation(mysql_version, table->s->table_charset->number)) - return HA_ADMIN_NEEDS_ALTER; - - for (Field **field= table->field; (*field); field++) - { - if ((*field)->charset()->number != - upgrade_collation(mysql_version, (*field)->charset()->number)) - return HA_ADMIN_NEEDS_ALTER; - } - } return 0; } diff --git a/sql/handler.h b/sql/handler.h index 0c1ae1d01c2d8958150d51570614da53167aafc6..360120615f33e48b5a854fc68221759b551a71f5 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -4055,5 +4055,4 @@ inline const char *table_case_name(HA_CREATE_INFO *info, const char *name) void print_keydup_error(TABLE *table, KEY *key, const char *msg, myf errflag); void print_keydup_error(TABLE *table, KEY *key, myf errflag); -uint upgrade_collation(ulong mysql_version, uint cs_number); #endif diff --git a/sql/table.cc b/sql/table.cc index c8c43ea3de10e0aea602c4d6f694c25d325669dc..babeb038bc8fa79577eb96966a429dbfead7e247 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -832,6 +832,42 @@ static bool create_key_infos(const uchar *strpos, const uchar *frm_image_end, } +/** + Check if a collation has changed number + + @param mysql_version + @param current collation number + + @retval new collation number (same as current collation number of no change) +*/ + +static uint +upgrade_collation(ulong mysql_version, uint cs_number) +{ + if (mysql_version >= 50300 && mysql_version <= 50399) + { + switch (cs_number) { + case 149: return MY_PAGE2_COLLATION_ID_UCS2; // ucs2_crotian_ci + case 213: return MY_PAGE2_COLLATION_ID_UTF8; // utf8_crotian_ci + } + } + if ((mysql_version >= 50500 && mysql_version <= 50599) || + (mysql_version >= 100000 && mysql_version <= 100005)) + { + switch (cs_number) { + case 149: return MY_PAGE2_COLLATION_ID_UCS2; // ucs2_crotian_ci + case 213: return MY_PAGE2_COLLATION_ID_UTF8; // utf8_crotian_ci + case 214: return MY_PAGE2_COLLATION_ID_UTF32; // utf32_croatian_ci + case 215: return MY_PAGE2_COLLATION_ID_UTF16; // utf16_croatian_ci + case 245: return MY_PAGE2_COLLATION_ID_UTF8MB4;// utf8mb4_croatian_ci + } + } + return cs_number; +} + + + + /** Read data from a binary .frm file image into a TABLE_SHARE