61
61
int (*add_collation)(CHARSET_INFO *cs);
62
62
} MY_CHARSET_LOADER;
67
Check repertoire: detect pure ascii strings
70
my_string_repertoire(const CHARSET_INFO * const cs, const char *str, ulong length)
72
const char *strend= str + length;
73
if (cs->mbminlen == 1)
75
for ( ; str < strend; str++)
77
if (((unsigned char) *str) > 0x7F)
78
return MY_REPERTOIRE_UNICODE30;
85
for (; (chlen= cs->cset->mb_wc(cs, &wc, (unsigned char *)str, (unsigned char *)strend)) > 0; str+= chlen)
88
return MY_REPERTOIRE_UNICODE30;
91
return MY_REPERTOIRE_ASCII;
96
Detect whether a character set is ASCII compatible.
100
- all 8bit character sets whose Unicode mapping of 0x7B is '{'
101
(ignores swe7 which maps 0x7B to "LATIN LETTER A WITH DIAERESIS")
103
- all multi-byte character sets having mbminlen == 1
104
(ignores ucs2 whose mbminlen is 2)
108
When merging to 5.2, this function should be changed
109
to check a new flag MY_CS_NONASCII,
111
return (cs->flag & MY_CS_NONASCII) ? 0 : 1;
113
This flag was previously added into 5.2 under terms
114
of WL#3759 "Optimize identifier conversion in client-server protocol"
115
especially to mark character sets not compatible with ASCII.
117
We won't backport this flag to 5.0 or 5.1.
118
This function is Ok for 5.0 and 5.1, because we're not going
119
to introduce new tricky character sets between 5.0 and 5.2.
122
my_charset_is_ascii_based(const CHARSET_INFO * const cs)
125
(cs->mbmaxlen == 1 && cs->tab_to_uni && cs->tab_to_uni['{'] == '{') ||
126
(cs->mbminlen == 1 && cs->mbmaxlen > 1);
131
Detect if a character set is 8bit,
132
and it is pure ascii, i.e. doesn't have
133
characters outside U+0000..U+007F
134
This functions is shared between "conf_to_src"
135
and dynamic charsets loader in "mysqld".
138
my_charset_is_8bit_pure_ascii(const CHARSET_INFO * const cs)
143
for (code= 0; code < 256; code++)
145
if (cs->tab_to_uni[code] > 0x7F)
153
Shared function between conf_to_src and mysys.
154
Check if a 8bit character set is compatible with
155
ascii on the range 0x00..0x7F.
158
my_charset_is_ascii_compatible(const CHARSET_INFO * const cs)
163
for (i= 0; i < 128; i++)
165
if (cs->tab_to_uni[i] != i)