Commit a6597812 authored by unknown's avatar unknown

New fields in CHARSET_INFO structure to optimize searching for

binary and primary collations in the future

parent 64d48cd6
......@@ -77,6 +77,8 @@ typedef struct my_uni_idx_st
typedef struct charset_info_st
{
uint number;
uint primary_number;
uint binary_number;
uint state;
const char *csname;
const char *name;
......
......@@ -257,7 +257,13 @@ static int add_collation(CHARSET_INFO *cs)
return MY_XML_ERROR;
bzero((void*)all_charsets[cs->number],sizeof(CHARSET_INFO));
}
if (cs->primary_number == cs->number)
cs->state |= MY_CS_PRIMARY;
if (cs->primary_number == cs->number)
cs->state |= MY_CS_BINSORT;
if (!(all_charsets[cs->number]->state & MY_CS_COMPILED))
{
simple_cs_copy_data(all_charsets[cs->number],cs);
......@@ -267,6 +273,10 @@ static int add_collation(CHARSET_INFO *cs)
all_charsets[cs->number]->state |= MY_CS_LOADED;
}
}
else
{
all_charsets[cs->number]->state |= cs->state;
}
cs->number= 0;
cs->name= NULL;
cs->state= 0;
......
......@@ -674,7 +674,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
handler_rkey_function handler_read_or_scan
single_multi table_wild_list table_wild_one opt_wild
union_clause union_list union_option
precision subselect_start opt_and
precision subselect_start opt_and charset
subselect_end select_var_list select_var_list_init help opt_len
END_OF_INPUT
......@@ -927,10 +927,9 @@ create_database_options:
create_database_option:
COLLATE_SYM collation_name_or_default
{ Lex->create_info.table_charset=$2; }
| opt_default CHAR_SYM SET charset_name_or_default
{ Lex->create_info.table_charset=$4; }
| opt_default CHARSET charset_name_or_default
{ Lex->create_info.table_charset=$3; };
| opt_default charset charset_name_or_default
{ Lex->create_info.table_charset=$3; }
;
opt_table_options:
/* empty */ { $$= 0; }
......@@ -989,16 +988,11 @@ create_table_option:
table_list->next=0;
lex->create_info.used_fields|= HA_CREATE_USED_UNION;
}
| opt_default CHARSET opt_equal charset_name_or_default
| opt_default charset opt_equal charset_name_or_default
{
Lex->create_info.table_charset= $4;
Lex->create_info.used_fields|= HA_CREATE_USED_CHARSET;
}
| opt_default CHAR_SYM SET opt_equal charset_name_or_default
{
Lex->create_info.table_charset= $5;
Lex->create_info.used_fields|= HA_CREATE_USED_CHARSET;
}
| COLLATE_SYM opt_equal collation_name_or_default
{
Lex->create_info.table_charset= $3;
......@@ -1301,6 +1295,10 @@ attribute:
}
;
charset:
CHAR_SYM SET {}
| CHARSET {}
;
charset_name:
ident_or_text
......@@ -1352,7 +1350,7 @@ opt_binary:
YYABORT;
}
}
| CHAR_SYM SET charset_name { Lex->charset=$3; } ;
| charset charset_name { Lex->charset=$2; } ;
opt_primary:
/* empty */
......@@ -3543,7 +3541,7 @@ show_param:
thd->lex.sql_command= SQLCOM_SHOW_VARIABLES;
thd->lex.option_type= (enum_var_type) $1;
}
| CHAR_SYM SET wild
| charset wild
{ Lex->sql_command= SQLCOM_SHOW_CHARSETS; }
| LOGS_SYM
{ Lex->sql_command= SQLCOM_SHOW_LOGS; }
......@@ -4215,12 +4213,12 @@ option_value:
find_sys_var("tx_isolation"),
new Item_int((int32) $4)));
}
| CHAR_SYM SET opt_equal set_expr_or_default
| charset opt_equal set_expr_or_default
{
LEX *lex=Lex;
lex->var_list.push_back(new set_var(lex->option_type,
find_sys_var("convert_character_set"),
$4));
$3));
}
| NAMES_SYM charset_name_or_default opt_collate
{
......
......@@ -6233,7 +6233,7 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)),
CHARSET_INFO my_charset_big5 =
{
1, /* number */
1,0,0, /* number */
MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */
"big5", /* cs name */
"big5", /* name */
......
......@@ -295,7 +295,7 @@ static int my_strnxfrm_bin(CHARSET_INFO *cs __attribute__((unused)),
CHARSET_INFO my_charset_bin =
{
63, /* number */
63,0,0, /* number */
MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_PRIMARY,/* state */
"binary", /* cs name */
"binary", /* name */
......
......@@ -607,7 +607,7 @@ int my_strnncollsp_czech(CHARSET_INFO * cs,
CHARSET_INFO my_charset_czech =
{
2, /* number */
2,0,0, /* number */
MY_CS_COMPILED|MY_CS_STRNXFRM, /* state */
"latin2", /* cs name */
"czech", /* name */
......
......@@ -8641,7 +8641,7 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
CHARSET_INFO my_charset_euc_kr =
{
19, /* number */
19,0,0, /* number */
MY_CS_COMPILED|MY_CS_PRIMARY, /* state */
"euckr", /* cs name */
"euckr", /* name */
......
This diff is collapsed.
......@@ -5691,7 +5691,7 @@ my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)),
CHARSET_INFO my_charset_gb2312 =
{
24, /* number */
24,0,0, /* number */
MY_CS_COMPILED|MY_CS_PRIMARY, /* state */
"gb2312", /* cs name */
"gb2312", /* name */
......
......@@ -9888,7 +9888,7 @@ my_mb_wc_gbk(CHARSET_INFO *cs __attribute__((unused)),
CHARSET_INFO my_charset_gbk =
{
28, /* number */
28,0,0, /* number */
MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */
"gbk", /* cs name */
"gbk", /* name */
......
......@@ -177,7 +177,7 @@ int my_wc_mb_latin1(CHARSET_INFO *cs __attribute__((unused)),
CHARSET_INFO my_charset_latin1 =
{
8, /* number */
8,0,0, /* number */
MY_CS_COMPILED, /* state */
"latin1", /* cs name */
"latin1", /* name */
......
......@@ -348,7 +348,7 @@ static int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
CHARSET_INFO my_charset_latin1_de =
{
31, /* number */
31,0,0, /* number */
MY_CS_COMPILED|MY_CS_STRNXFRM, /* state */
"latin1", /* cs name */
"latin1_de", /* name */
......
......@@ -4475,7 +4475,7 @@ my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)),
CHARSET_INFO my_charset_sjis =
{
13, /* number */
13,0,0, /* number */
MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */
"sjis", /* cs name */
"sjis", /* name */
......
......@@ -698,7 +698,7 @@ void ThNormalize(uchar* ptr, uint field_length, const uchar* from, uint length)
CHARSET_INFO my_charset_tis620 =
{
18, /* number */
18,0,0, /* number */
MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */
"tis620", /* cs name */
"tis620", /* name */
......
......@@ -8432,7 +8432,7 @@ my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, unsigned char *s, unsigned char *e)
CHARSET_INFO my_charset_ujis =
{
12, /* number */
12,0,0, /* number */
MY_CS_COMPILED|MY_CS_PRIMARY, /* state */
"ujis", /* cs name */
"ujis", /* name */
......
......@@ -1977,7 +1977,7 @@ static int my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)) , uint c)
CHARSET_INFO my_charset_utf8 =
{
33, /* number */
33,0,0, /* number */
MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */
"utf8", /* cs name */
"utf8", /* name */
......@@ -3084,7 +3084,7 @@ uint my_charpos_ucs2(CHARSET_INFO *cs __attribute__((unused)),
CHARSET_INFO my_charset_ucs2 =
{
35, /* number */
35,0,0, /* number */
MY_CS_COMPILED|MY_CS_PRIMARY|MY_CS_STRNXFRM, /* state */
"ucs2", /* cs name */
"ucs2", /* name */
......
......@@ -642,7 +642,7 @@ static my_bool my_like_range_win1250ch(CHARSET_INFO *cs __attribute__((unused)),
CHARSET_INFO my_charset_win1250ch =
{
34, /* number */
34,0,0, /* number */
MY_CS_COMPILED|MY_CS_STRNXFRM, /* state */
"cp1250", /* cs name */
"cp1250_czech", /* name */
......
......@@ -52,6 +52,8 @@ struct my_cs_file_section_st
#define _CS_UNIMAP 12
#define _CS_COLLMAP 13
#define _CS_CTYPEMAP 14
#define _CS_PRIMARY_ID 15
#define _CS_BINARY_ID 16
static struct my_cs_file_section_st sec[] =
{
......@@ -62,6 +64,8 @@ static struct my_cs_file_section_st sec[] =
{_CS_MISC, "charsets.max-id"},
{_CS_MISC, "charsets.description"},
{_CS_CHARSET, "charsets.charset"},
{_CS_PRIMARY_ID, "charsets.charset.primary-id"},
{_CS_BINARY_ID, "charsets.charset.binary-id"},
{_CS_CSNAME, "charsets.charset.name"},
{_CS_FAMILY, "charsets.charset.family"},
{_CS_MISC, "charsets.charset.alias"},
......@@ -192,6 +196,12 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, uint len)
case _CS_ID:
i->cs.number= strtol(attr,(char**)NULL,10);
break;
case _CS_BINARY_ID:
i->cs.binary_number= strtol(attr,(char**)NULL,10);
break;
case _CS_PRIMARY_ID:
i->cs.primary_number= strtol(attr,(char**)NULL,10);
break;
case _CS_COLNAME:
i->cs.name=mstr(i->name,attr,len,MY_CS_NAME_SIZE-1);
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment