mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-30164 System variable for default collations
This patch adds a way to override default collations (or "character set collations") for desired character sets. The SQL standard says: > Each collation known in an SQL-environment is applicable to one > or more character sets, and for each character set, one or more > collations are applicable to it, one of which is associated with > it as its character set collation. In MariaDB, character set collations has been hard-coded so far, e.g. utf8mb4_general_ci has been a hard-coded character set collation for utf8mb4. This patch allows to override (globally per server, or per session) character set collations, so for example, uca1400_ai_ci can be set as a character set collation for Unicode character sets (instead of compiled xxx_general_ci). The array of overridden character set collations is stored in a new (session and global) system variable @@character_set_collations and can be set as a comma separated list of charset=collation pairs, e.g.: SET @@character_set_collations='utf8mb3=uca1400_ai_ci,utf8mb4=uca1400_ai_ci'; The variable is empty by default, which mean use the hard-coded character set collations (e.g. utf8mb4_general_ci for utf8mb4). The variable can also be set globally by passing to the server startup command line, and/or in my.cnf.
This commit is contained in:
@@ -4465,19 +4465,23 @@ public:
|
||||
bool add_alter_list(LEX_CSTRING par_name, Virtual_column_info *expr,
|
||||
bool par_exists);
|
||||
bool add_alter_list(LEX_CSTRING name, LEX_CSTRING new_name, bool exists);
|
||||
bool add_alter_list_item_convert_to_charset(CHARSET_INFO *cs)
|
||||
bool add_alter_list_item_convert_to_charset(Sql_used *used,
|
||||
const Charset_collation_map_st &map,
|
||||
CHARSET_INFO *cs)
|
||||
{
|
||||
if (create_info.add_table_option_convert_charset(cs))
|
||||
if (create_info.add_table_option_convert_charset(used, map, cs))
|
||||
return true;
|
||||
alter_info.flags|= ALTER_CONVERT_TO;
|
||||
return false;
|
||||
}
|
||||
bool
|
||||
add_alter_list_item_convert_to_charset(CHARSET_INFO *cs,
|
||||
add_alter_list_item_convert_to_charset(Sql_used *used,
|
||||
const Charset_collation_map_st &map,
|
||||
CHARSET_INFO *cs,
|
||||
const Lex_extended_collation_st &cl)
|
||||
{
|
||||
if (create_info.add_table_option_convert_charset(cs) ||
|
||||
create_info.add_table_option_convert_collation(cl))
|
||||
if (create_info.add_table_option_convert_charset(used, map, cs) ||
|
||||
create_info.add_table_option_convert_collation(used, map, cl))
|
||||
return true;
|
||||
alter_info.flags|= ALTER_CONVERT_TO;
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user