rbdc_mysql/
collation.rs

1use rbdc::error::Error;
2use std::str::FromStr;
3
4#[allow(non_camel_case_types)]
5#[derive(Copy, Clone)]
6pub(crate) enum CharSet {
7    armscii8,
8    ascii,
9    big5,
10    binary,
11    cp1250,
12    cp1251,
13    cp1256,
14    cp1257,
15    cp850,
16    cp852,
17    cp866,
18    cp932,
19    dec8,
20    eucjpms,
21    euckr,
22    gb18030,
23    gb2312,
24    gbk,
25    geostd8,
26    greek,
27    hebrew,
28    hp8,
29    keybcs2,
30    koi8r,
31    koi8u,
32    latin1,
33    latin2,
34    latin5,
35    latin7,
36    macce,
37    macroman,
38    sjis,
39    swe7,
40    tis620,
41    ucs2,
42    ujis,
43    utf16,
44    utf16le,
45    utf32,
46    utf8,
47    utf8mb4,
48}
49
50impl CharSet {
51    pub(crate) fn as_str(&self) -> &'static str {
52        match self {
53            CharSet::armscii8 => "armscii8",
54            CharSet::ascii => "ascii",
55            CharSet::big5 => "big5",
56            CharSet::binary => "binary",
57            CharSet::cp1250 => "cp1250",
58            CharSet::cp1251 => "cp1251",
59            CharSet::cp1256 => "cp1256",
60            CharSet::cp1257 => "cp1257",
61            CharSet::cp850 => "cp850",
62            CharSet::cp852 => "cp852",
63            CharSet::cp866 => "cp866",
64            CharSet::cp932 => "cp932",
65            CharSet::dec8 => "dec8",
66            CharSet::eucjpms => "eucjpms",
67            CharSet::euckr => "euckr",
68            CharSet::gb18030 => "gb18030",
69            CharSet::gb2312 => "gb2312",
70            CharSet::gbk => "gbk",
71            CharSet::geostd8 => "geostd8",
72            CharSet::greek => "greek",
73            CharSet::hebrew => "hebrew",
74            CharSet::hp8 => "hp8",
75            CharSet::keybcs2 => "keybcs2",
76            CharSet::koi8r => "koi8r",
77            CharSet::koi8u => "koi8u",
78            CharSet::latin1 => "latin1",
79            CharSet::latin2 => "latin2",
80            CharSet::latin5 => "latin5",
81            CharSet::latin7 => "latin7",
82            CharSet::macce => "macce",
83            CharSet::macroman => "macroman",
84            CharSet::sjis => "sjis",
85            CharSet::swe7 => "swe7",
86            CharSet::tis620 => "tis620",
87            CharSet::ucs2 => "ucs2",
88            CharSet::ujis => "ujis",
89            CharSet::utf16 => "utf16",
90            CharSet::utf16le => "utf16le",
91            CharSet::utf32 => "utf32",
92            CharSet::utf8 => "utf8",
93            CharSet::utf8mb4 => "utf8mb4",
94        }
95    }
96
97    pub(crate) fn default_collation(&self) -> Collation {
98        match self {
99            CharSet::armscii8 => Collation::armscii8_general_ci,
100            CharSet::ascii => Collation::ascii_general_ci,
101            CharSet::big5 => Collation::big5_chinese_ci,
102            CharSet::binary => Collation::binary,
103            CharSet::cp1250 => Collation::cp1250_general_ci,
104            CharSet::cp1251 => Collation::cp1251_general_ci,
105            CharSet::cp1256 => Collation::cp1256_general_ci,
106            CharSet::cp1257 => Collation::cp1257_general_ci,
107            CharSet::cp850 => Collation::cp850_general_ci,
108            CharSet::cp852 => Collation::cp852_general_ci,
109            CharSet::cp866 => Collation::cp866_general_ci,
110            CharSet::cp932 => Collation::cp932_japanese_ci,
111            CharSet::dec8 => Collation::dec8_swedish_ci,
112            CharSet::eucjpms => Collation::eucjpms_japanese_ci,
113            CharSet::euckr => Collation::euckr_korean_ci,
114            CharSet::gb18030 => Collation::gb18030_chinese_ci,
115            CharSet::gb2312 => Collation::gb2312_chinese_ci,
116            CharSet::gbk => Collation::gbk_chinese_ci,
117            CharSet::geostd8 => Collation::geostd8_general_ci,
118            CharSet::greek => Collation::greek_general_ci,
119            CharSet::hebrew => Collation::hebrew_general_ci,
120            CharSet::hp8 => Collation::hp8_english_ci,
121            CharSet::keybcs2 => Collation::keybcs2_general_ci,
122            CharSet::koi8r => Collation::koi8r_general_ci,
123            CharSet::koi8u => Collation::koi8u_general_ci,
124            CharSet::latin1 => Collation::latin1_swedish_ci,
125            CharSet::latin2 => Collation::latin2_general_ci,
126            CharSet::latin5 => Collation::latin5_turkish_ci,
127            CharSet::latin7 => Collation::latin7_general_ci,
128            CharSet::macce => Collation::macce_general_ci,
129            CharSet::macroman => Collation::macroman_general_ci,
130            CharSet::sjis => Collation::sjis_japanese_ci,
131            CharSet::swe7 => Collation::swe7_swedish_ci,
132            CharSet::tis620 => Collation::tis620_thai_ci,
133            CharSet::ucs2 => Collation::ucs2_general_ci,
134            CharSet::ujis => Collation::ujis_japanese_ci,
135            CharSet::utf16 => Collation::utf16_general_ci,
136            CharSet::utf16le => Collation::utf16le_general_ci,
137            CharSet::utf32 => Collation::utf32_general_ci,
138            CharSet::utf8 => Collation::utf8_unicode_ci,
139            CharSet::utf8mb4 => Collation::utf8mb4_unicode_ci,
140        }
141    }
142}
143
144impl FromStr for CharSet {
145    type Err = Error;
146
147    fn from_str(char_set: &str) -> Result<Self, Self::Err> {
148        Ok(match char_set {
149            "armscii8" => CharSet::armscii8,
150            "ascii" => CharSet::ascii,
151            "big5" => CharSet::big5,
152            "binary" => CharSet::binary,
153            "cp1250" => CharSet::cp1250,
154            "cp1251" => CharSet::cp1251,
155            "cp1256" => CharSet::cp1256,
156            "cp1257" => CharSet::cp1257,
157            "cp850" => CharSet::cp850,
158            "cp852" => CharSet::cp852,
159            "cp866" => CharSet::cp866,
160            "cp932" => CharSet::cp932,
161            "dec8" => CharSet::dec8,
162            "eucjpms" => CharSet::eucjpms,
163            "euckr" => CharSet::euckr,
164            "gb18030" => CharSet::gb18030,
165            "gb2312" => CharSet::gb2312,
166            "gbk" => CharSet::gbk,
167            "geostd8" => CharSet::geostd8,
168            "greek" => CharSet::greek,
169            "hebrew" => CharSet::hebrew,
170            "hp8" => CharSet::hp8,
171            "keybcs2" => CharSet::keybcs2,
172            "koi8r" => CharSet::koi8r,
173            "koi8u" => CharSet::koi8u,
174            "latin1" => CharSet::latin1,
175            "latin2" => CharSet::latin2,
176            "latin5" => CharSet::latin5,
177            "latin7" => CharSet::latin7,
178            "macce" => CharSet::macce,
179            "macroman" => CharSet::macroman,
180            "sjis" => CharSet::sjis,
181            "swe7" => CharSet::swe7,
182            "tis620" => CharSet::tis620,
183            "ucs2" => CharSet::ucs2,
184            "ujis" => CharSet::ujis,
185            "utf16" => CharSet::utf16,
186            "utf16le" => CharSet::utf16le,
187            "utf32" => CharSet::utf32,
188            "utf8" => CharSet::utf8,
189            "utf8mb4" => CharSet::utf8mb4,
190
191            _ => {
192                return Err(Error::from(format!(
193                    "unsupported MySQL charset: {}",
194                    char_set
195                )));
196            }
197        })
198    }
199}
200
201#[derive(Copy, Clone)]
202#[allow(non_camel_case_types)]
203#[repr(u8)]
204pub(crate) enum Collation {
205    armscii8_bin = 64,
206    armscii8_general_ci = 32,
207    ascii_bin = 65,
208    ascii_general_ci = 11,
209    big5_bin = 84,
210    big5_chinese_ci = 1,
211    binary = 63,
212    cp1250_bin = 66,
213    cp1250_croatian_ci = 44,
214    cp1250_czech_cs = 34,
215    cp1250_general_ci = 26,
216    cp1250_polish_ci = 99,
217    cp1251_bin = 50,
218    cp1251_bulgarian_ci = 14,
219    cp1251_general_ci = 51,
220    cp1251_general_cs = 52,
221    cp1251_ukrainian_ci = 23,
222    cp1256_bin = 67,
223    cp1256_general_ci = 57,
224    cp1257_bin = 58,
225    cp1257_general_ci = 59,
226    cp1257_lithuanian_ci = 29,
227    cp850_bin = 80,
228    cp850_general_ci = 4,
229    cp852_bin = 81,
230    cp852_general_ci = 40,
231    cp866_bin = 68,
232    cp866_general_ci = 36,
233    cp932_bin = 96,
234    cp932_japanese_ci = 95,
235    dec8_bin = 69,
236    dec8_swedish_ci = 3,
237    eucjpms_bin = 98,
238    eucjpms_japanese_ci = 97,
239    euckr_bin = 85,
240    euckr_korean_ci = 19,
241    gb18030_bin = 249,
242    gb18030_chinese_ci = 248,
243    gb18030_unicode_520_ci = 250,
244    gb2312_bin = 86,
245    gb2312_chinese_ci = 24,
246    gbk_bin = 87,
247    gbk_chinese_ci = 28,
248    geostd8_bin = 93,
249    geostd8_general_ci = 92,
250    greek_bin = 70,
251    greek_general_ci = 25,
252    hebrew_bin = 71,
253    hebrew_general_ci = 16,
254    hp8_bin = 72,
255    hp8_english_ci = 6,
256    keybcs2_bin = 73,
257    keybcs2_general_ci = 37,
258    koi8r_bin = 74,
259    koi8r_general_ci = 7,
260    koi8u_bin = 75,
261    koi8u_general_ci = 22,
262    latin1_bin = 47,
263    latin1_danish_ci = 15,
264    latin1_general_ci = 48,
265    latin1_general_cs = 49,
266    latin1_german1_ci = 5,
267    latin1_german2_ci = 31,
268    latin1_spanish_ci = 94,
269    latin1_swedish_ci = 8,
270    latin2_bin = 77,
271    latin2_croatian_ci = 27,
272    latin2_czech_cs = 2,
273    latin2_general_ci = 9,
274    latin2_hungarian_ci = 21,
275    latin5_bin = 78,
276    latin5_turkish_ci = 30,
277    latin7_bin = 79,
278    latin7_estonian_cs = 20,
279    latin7_general_ci = 41,
280    latin7_general_cs = 42,
281    macce_bin = 43,
282    macce_general_ci = 38,
283    macroman_bin = 53,
284    macroman_general_ci = 39,
285    sjis_bin = 88,
286    sjis_japanese_ci = 13,
287    swe7_bin = 82,
288    swe7_swedish_ci = 10,
289    tis620_bin = 89,
290    tis620_thai_ci = 18,
291    ucs2_bin = 90,
292    ucs2_croatian_ci = 149,
293    ucs2_czech_ci = 138,
294    ucs2_danish_ci = 139,
295    ucs2_esperanto_ci = 145,
296    ucs2_estonian_ci = 134,
297    ucs2_general_ci = 35,
298    ucs2_general_mysql500_ci = 159,
299    ucs2_german2_ci = 148,
300    ucs2_hungarian_ci = 146,
301    ucs2_icelandic_ci = 129,
302    ucs2_latvian_ci = 130,
303    ucs2_lithuanian_ci = 140,
304    ucs2_persian_ci = 144,
305    ucs2_polish_ci = 133,
306    ucs2_roman_ci = 143,
307    ucs2_romanian_ci = 131,
308    ucs2_sinhala_ci = 147,
309    ucs2_slovak_ci = 141,
310    ucs2_slovenian_ci = 132,
311    ucs2_spanish_ci = 135,
312    ucs2_spanish2_ci = 142,
313    ucs2_swedish_ci = 136,
314    ucs2_turkish_ci = 137,
315    ucs2_unicode_520_ci = 150,
316    ucs2_unicode_ci = 128,
317    ucs2_vietnamese_ci = 151,
318    ujis_bin = 91,
319    ujis_japanese_ci = 12,
320    utf16_bin = 55,
321    utf16_croatian_ci = 122,
322    utf16_czech_ci = 111,
323    utf16_danish_ci = 112,
324    utf16_esperanto_ci = 118,
325    utf16_estonian_ci = 107,
326    utf16_general_ci = 54,
327    utf16_german2_ci = 121,
328    utf16_hungarian_ci = 119,
329    utf16_icelandic_ci = 102,
330    utf16_latvian_ci = 103,
331    utf16_lithuanian_ci = 113,
332    utf16_persian_ci = 117,
333    utf16_polish_ci = 106,
334    utf16_roman_ci = 116,
335    utf16_romanian_ci = 104,
336    utf16_sinhala_ci = 120,
337    utf16_slovak_ci = 114,
338    utf16_slovenian_ci = 105,
339    utf16_spanish_ci = 108,
340    utf16_spanish2_ci = 115,
341    utf16_swedish_ci = 109,
342    utf16_turkish_ci = 110,
343    utf16_unicode_520_ci = 123,
344    utf16_unicode_ci = 101,
345    utf16_vietnamese_ci = 124,
346    utf16le_bin = 62,
347    utf16le_general_ci = 56,
348    utf32_bin = 61,
349    utf32_croatian_ci = 181,
350    utf32_czech_ci = 170,
351    utf32_danish_ci = 171,
352    utf32_esperanto_ci = 177,
353    utf32_estonian_ci = 166,
354    utf32_general_ci = 60,
355    utf32_german2_ci = 180,
356    utf32_hungarian_ci = 178,
357    utf32_icelandic_ci = 161,
358    utf32_latvian_ci = 162,
359    utf32_lithuanian_ci = 172,
360    utf32_persian_ci = 176,
361    utf32_polish_ci = 165,
362    utf32_roman_ci = 175,
363    utf32_romanian_ci = 163,
364    utf32_sinhala_ci = 179,
365    utf32_slovak_ci = 173,
366    utf32_slovenian_ci = 164,
367    utf32_spanish_ci = 167,
368    utf32_spanish2_ci = 174,
369    utf32_swedish_ci = 168,
370    utf32_turkish_ci = 169,
371    utf32_unicode_520_ci = 182,
372    utf32_unicode_ci = 160,
373    utf32_vietnamese_ci = 183,
374    utf8_bin = 83,
375    utf8_croatian_ci = 213,
376    utf8_czech_ci = 202,
377    utf8_danish_ci = 203,
378    utf8_esperanto_ci = 209,
379    utf8_estonian_ci = 198,
380    utf8_general_ci = 33,
381    utf8_general_mysql500_ci = 223,
382    utf8_german2_ci = 212,
383    utf8_hungarian_ci = 210,
384    utf8_icelandic_ci = 193,
385    utf8_latvian_ci = 194,
386    utf8_lithuanian_ci = 204,
387    utf8_persian_ci = 208,
388    utf8_polish_ci = 197,
389    utf8_roman_ci = 207,
390    utf8_romanian_ci = 195,
391    utf8_sinhala_ci = 211,
392    utf8_slovak_ci = 205,
393    utf8_slovenian_ci = 196,
394    utf8_spanish_ci = 199,
395    utf8_spanish2_ci = 206,
396    utf8_swedish_ci = 200,
397    utf8_tolower_ci = 76,
398    utf8_turkish_ci = 201,
399    utf8_unicode_520_ci = 214,
400    utf8_unicode_ci = 192,
401    utf8_vietnamese_ci = 215,
402    utf8mb4_0900_ai_ci = 255,
403    utf8mb4_bin = 46,
404    utf8mb4_croatian_ci = 245,
405    utf8mb4_czech_ci = 234,
406    utf8mb4_danish_ci = 235,
407    utf8mb4_esperanto_ci = 241,
408    utf8mb4_estonian_ci = 230,
409    utf8mb4_general_ci = 45,
410    utf8mb4_german2_ci = 244,
411    utf8mb4_hungarian_ci = 242,
412    utf8mb4_icelandic_ci = 225,
413    utf8mb4_latvian_ci = 226,
414    utf8mb4_lithuanian_ci = 236,
415    utf8mb4_persian_ci = 240,
416    utf8mb4_polish_ci = 229,
417    utf8mb4_roman_ci = 239,
418    utf8mb4_romanian_ci = 227,
419    utf8mb4_sinhala_ci = 243,
420    utf8mb4_slovak_ci = 237,
421    utf8mb4_slovenian_ci = 228,
422    utf8mb4_spanish_ci = 231,
423    utf8mb4_spanish2_ci = 238,
424    utf8mb4_swedish_ci = 232,
425    utf8mb4_turkish_ci = 233,
426    utf8mb4_unicode_520_ci = 246,
427    utf8mb4_unicode_ci = 224,
428    utf8mb4_vietnamese_ci = 247,
429}
430
431impl Collation {
432    pub(crate) fn as_str(&self) -> &'static str {
433        match self {
434            Collation::armscii8_bin => "armscii8_bin",
435            Collation::armscii8_general_ci => "armscii8_general_ci",
436            Collation::ascii_bin => "ascii_bin",
437            Collation::ascii_general_ci => "ascii_general_ci",
438            Collation::big5_bin => "big5_bin",
439            Collation::big5_chinese_ci => "big5_chinese_ci",
440            Collation::binary => "binary",
441            Collation::cp1250_bin => "cp1250_bin",
442            Collation::cp1250_croatian_ci => "cp1250_croatian_ci",
443            Collation::cp1250_czech_cs => "cp1250_czech_cs",
444            Collation::cp1250_general_ci => "cp1250_general_ci",
445            Collation::cp1250_polish_ci => "cp1250_polish_ci",
446            Collation::cp1251_bin => "cp1251_bin",
447            Collation::cp1251_bulgarian_ci => "cp1251_bulgarian_ci",
448            Collation::cp1251_general_ci => "cp1251_general_ci",
449            Collation::cp1251_general_cs => "cp1251_general_cs",
450            Collation::cp1251_ukrainian_ci => "cp1251_ukrainian_ci",
451            Collation::cp1256_bin => "cp1256_bin",
452            Collation::cp1256_general_ci => "cp1256_general_ci",
453            Collation::cp1257_bin => "cp1257_bin",
454            Collation::cp1257_general_ci => "cp1257_general_ci",
455            Collation::cp1257_lithuanian_ci => "cp1257_lithuanian_ci",
456            Collation::cp850_bin => "cp850_bin",
457            Collation::cp850_general_ci => "cp850_general_ci",
458            Collation::cp852_bin => "cp852_bin",
459            Collation::cp852_general_ci => "cp852_general_ci",
460            Collation::cp866_bin => "cp866_bin",
461            Collation::cp866_general_ci => "cp866_general_ci",
462            Collation::cp932_bin => "cp932_bin",
463            Collation::cp932_japanese_ci => "cp932_japanese_ci",
464            Collation::dec8_bin => "dec8_bin",
465            Collation::dec8_swedish_ci => "dec8_swedish_ci",
466            Collation::eucjpms_bin => "eucjpms_bin",
467            Collation::eucjpms_japanese_ci => "eucjpms_japanese_ci",
468            Collation::euckr_bin => "euckr_bin",
469            Collation::euckr_korean_ci => "euckr_korean_ci",
470            Collation::gb18030_bin => "gb18030_bin",
471            Collation::gb18030_chinese_ci => "gb18030_chinese_ci",
472            Collation::gb18030_unicode_520_ci => "gb18030_unicode_520_ci",
473            Collation::gb2312_bin => "gb2312_bin",
474            Collation::gb2312_chinese_ci => "gb2312_chinese_ci",
475            Collation::gbk_bin => "gbk_bin",
476            Collation::gbk_chinese_ci => "gbk_chinese_ci",
477            Collation::geostd8_bin => "geostd8_bin",
478            Collation::geostd8_general_ci => "geostd8_general_ci",
479            Collation::greek_bin => "greek_bin",
480            Collation::greek_general_ci => "greek_general_ci",
481            Collation::hebrew_bin => "hebrew_bin",
482            Collation::hebrew_general_ci => "hebrew_general_ci",
483            Collation::hp8_bin => "hp8_bin",
484            Collation::hp8_english_ci => "hp8_english_ci",
485            Collation::keybcs2_bin => "keybcs2_bin",
486            Collation::keybcs2_general_ci => "keybcs2_general_ci",
487            Collation::koi8r_bin => "koi8r_bin",
488            Collation::koi8r_general_ci => "koi8r_general_ci",
489            Collation::koi8u_bin => "koi8u_bin",
490            Collation::koi8u_general_ci => "koi8u_general_ci",
491            Collation::latin1_bin => "latin1_bin",
492            Collation::latin1_danish_ci => "latin1_danish_ci",
493            Collation::latin1_general_ci => "latin1_general_ci",
494            Collation::latin1_general_cs => "latin1_general_cs",
495            Collation::latin1_german1_ci => "latin1_german1_ci",
496            Collation::latin1_german2_ci => "latin1_german2_ci",
497            Collation::latin1_spanish_ci => "latin1_spanish_ci",
498            Collation::latin1_swedish_ci => "latin1_swedish_ci",
499            Collation::latin2_bin => "latin2_bin",
500            Collation::latin2_croatian_ci => "latin2_croatian_ci",
501            Collation::latin2_czech_cs => "latin2_czech_cs",
502            Collation::latin2_general_ci => "latin2_general_ci",
503            Collation::latin2_hungarian_ci => "latin2_hungarian_ci",
504            Collation::latin5_bin => "latin5_bin",
505            Collation::latin5_turkish_ci => "latin5_turkish_ci",
506            Collation::latin7_bin => "latin7_bin",
507            Collation::latin7_estonian_cs => "latin7_estonian_cs",
508            Collation::latin7_general_ci => "latin7_general_ci",
509            Collation::latin7_general_cs => "latin7_general_cs",
510            Collation::macce_bin => "macce_bin",
511            Collation::macce_general_ci => "macce_general_ci",
512            Collation::macroman_bin => "macroman_bin",
513            Collation::macroman_general_ci => "macroman_general_ci",
514            Collation::sjis_bin => "sjis_bin",
515            Collation::sjis_japanese_ci => "sjis_japanese_ci",
516            Collation::swe7_bin => "swe7_bin",
517            Collation::swe7_swedish_ci => "swe7_swedish_ci",
518            Collation::tis620_bin => "tis620_bin",
519            Collation::tis620_thai_ci => "tis620_thai_ci",
520            Collation::ucs2_bin => "ucs2_bin",
521            Collation::ucs2_croatian_ci => "ucs2_croatian_ci",
522            Collation::ucs2_czech_ci => "ucs2_czech_ci",
523            Collation::ucs2_danish_ci => "ucs2_danish_ci",
524            Collation::ucs2_esperanto_ci => "ucs2_esperanto_ci",
525            Collation::ucs2_estonian_ci => "ucs2_estonian_ci",
526            Collation::ucs2_general_ci => "ucs2_general_ci",
527            Collation::ucs2_general_mysql500_ci => "ucs2_general_mysql500_ci",
528            Collation::ucs2_german2_ci => "ucs2_german2_ci",
529            Collation::ucs2_hungarian_ci => "ucs2_hungarian_ci",
530            Collation::ucs2_icelandic_ci => "ucs2_icelandic_ci",
531            Collation::ucs2_latvian_ci => "ucs2_latvian_ci",
532            Collation::ucs2_lithuanian_ci => "ucs2_lithuanian_ci",
533            Collation::ucs2_persian_ci => "ucs2_persian_ci",
534            Collation::ucs2_polish_ci => "ucs2_polish_ci",
535            Collation::ucs2_roman_ci => "ucs2_roman_ci",
536            Collation::ucs2_romanian_ci => "ucs2_romanian_ci",
537            Collation::ucs2_sinhala_ci => "ucs2_sinhala_ci",
538            Collation::ucs2_slovak_ci => "ucs2_slovak_ci",
539            Collation::ucs2_slovenian_ci => "ucs2_slovenian_ci",
540            Collation::ucs2_spanish_ci => "ucs2_spanish_ci",
541            Collation::ucs2_spanish2_ci => "ucs2_spanish2_ci",
542            Collation::ucs2_swedish_ci => "ucs2_swedish_ci",
543            Collation::ucs2_turkish_ci => "ucs2_turkish_ci",
544            Collation::ucs2_unicode_520_ci => "ucs2_unicode_520_ci",
545            Collation::ucs2_unicode_ci => "ucs2_unicode_ci",
546            Collation::ucs2_vietnamese_ci => "ucs2_vietnamese_ci",
547            Collation::ujis_bin => "ujis_bin",
548            Collation::ujis_japanese_ci => "ujis_japanese_ci",
549            Collation::utf16_bin => "utf16_bin",
550            Collation::utf16_croatian_ci => "utf16_croatian_ci",
551            Collation::utf16_czech_ci => "utf16_czech_ci",
552            Collation::utf16_danish_ci => "utf16_danish_ci",
553            Collation::utf16_esperanto_ci => "utf16_esperanto_ci",
554            Collation::utf16_estonian_ci => "utf16_estonian_ci",
555            Collation::utf16_general_ci => "utf16_general_ci",
556            Collation::utf16_german2_ci => "utf16_german2_ci",
557            Collation::utf16_hungarian_ci => "utf16_hungarian_ci",
558            Collation::utf16_icelandic_ci => "utf16_icelandic_ci",
559            Collation::utf16_latvian_ci => "utf16_latvian_ci",
560            Collation::utf16_lithuanian_ci => "utf16_lithuanian_ci",
561            Collation::utf16_persian_ci => "utf16_persian_ci",
562            Collation::utf16_polish_ci => "utf16_polish_ci",
563            Collation::utf16_roman_ci => "utf16_roman_ci",
564            Collation::utf16_romanian_ci => "utf16_romanian_ci",
565            Collation::utf16_sinhala_ci => "utf16_sinhala_ci",
566            Collation::utf16_slovak_ci => "utf16_slovak_ci",
567            Collation::utf16_slovenian_ci => "utf16_slovenian_ci",
568            Collation::utf16_spanish_ci => "utf16_spanish_ci",
569            Collation::utf16_spanish2_ci => "utf16_spanish2_ci",
570            Collation::utf16_swedish_ci => "utf16_swedish_ci",
571            Collation::utf16_turkish_ci => "utf16_turkish_ci",
572            Collation::utf16_unicode_520_ci => "utf16_unicode_520_ci",
573            Collation::utf16_unicode_ci => "utf16_unicode_ci",
574            Collation::utf16_vietnamese_ci => "utf16_vietnamese_ci",
575            Collation::utf16le_bin => "utf16le_bin",
576            Collation::utf16le_general_ci => "utf16le_general_ci",
577            Collation::utf32_bin => "utf32_bin",
578            Collation::utf32_croatian_ci => "utf32_croatian_ci",
579            Collation::utf32_czech_ci => "utf32_czech_ci",
580            Collation::utf32_danish_ci => "utf32_danish_ci",
581            Collation::utf32_esperanto_ci => "utf32_esperanto_ci",
582            Collation::utf32_estonian_ci => "utf32_estonian_ci",
583            Collation::utf32_general_ci => "utf32_general_ci",
584            Collation::utf32_german2_ci => "utf32_german2_ci",
585            Collation::utf32_hungarian_ci => "utf32_hungarian_ci",
586            Collation::utf32_icelandic_ci => "utf32_icelandic_ci",
587            Collation::utf32_latvian_ci => "utf32_latvian_ci",
588            Collation::utf32_lithuanian_ci => "utf32_lithuanian_ci",
589            Collation::utf32_persian_ci => "utf32_persian_ci",
590            Collation::utf32_polish_ci => "utf32_polish_ci",
591            Collation::utf32_roman_ci => "utf32_roman_ci",
592            Collation::utf32_romanian_ci => "utf32_romanian_ci",
593            Collation::utf32_sinhala_ci => "utf32_sinhala_ci",
594            Collation::utf32_slovak_ci => "utf32_slovak_ci",
595            Collation::utf32_slovenian_ci => "utf32_slovenian_ci",
596            Collation::utf32_spanish_ci => "utf32_spanish_ci",
597            Collation::utf32_spanish2_ci => "utf32_spanish2_ci",
598            Collation::utf32_swedish_ci => "utf32_swedish_ci",
599            Collation::utf32_turkish_ci => "utf32_turkish_ci",
600            Collation::utf32_unicode_520_ci => "utf32_unicode_520_ci",
601            Collation::utf32_unicode_ci => "utf32_unicode_ci",
602            Collation::utf32_vietnamese_ci => "utf32_vietnamese_ci",
603            Collation::utf8_bin => "utf8_bin",
604            Collation::utf8_croatian_ci => "utf8_croatian_ci",
605            Collation::utf8_czech_ci => "utf8_czech_ci",
606            Collation::utf8_danish_ci => "utf8_danish_ci",
607            Collation::utf8_esperanto_ci => "utf8_esperanto_ci",
608            Collation::utf8_estonian_ci => "utf8_estonian_ci",
609            Collation::utf8_general_ci => "utf8_general_ci",
610            Collation::utf8_general_mysql500_ci => "utf8_general_mysql500_ci",
611            Collation::utf8_german2_ci => "utf8_german2_ci",
612            Collation::utf8_hungarian_ci => "utf8_hungarian_ci",
613            Collation::utf8_icelandic_ci => "utf8_icelandic_ci",
614            Collation::utf8_latvian_ci => "utf8_latvian_ci",
615            Collation::utf8_lithuanian_ci => "utf8_lithuanian_ci",
616            Collation::utf8_persian_ci => "utf8_persian_ci",
617            Collation::utf8_polish_ci => "utf8_polish_ci",
618            Collation::utf8_roman_ci => "utf8_roman_ci",
619            Collation::utf8_romanian_ci => "utf8_romanian_ci",
620            Collation::utf8_sinhala_ci => "utf8_sinhala_ci",
621            Collation::utf8_slovak_ci => "utf8_slovak_ci",
622            Collation::utf8_slovenian_ci => "utf8_slovenian_ci",
623            Collation::utf8_spanish_ci => "utf8_spanish_ci",
624            Collation::utf8_spanish2_ci => "utf8_spanish2_ci",
625            Collation::utf8_swedish_ci => "utf8_swedish_ci",
626            Collation::utf8_tolower_ci => "utf8_tolower_ci",
627            Collation::utf8_turkish_ci => "utf8_turkish_ci",
628            Collation::utf8_unicode_520_ci => "utf8_unicode_520_ci",
629            Collation::utf8_unicode_ci => "utf8_unicode_ci",
630            Collation::utf8_vietnamese_ci => "utf8_vietnamese_ci",
631            Collation::utf8mb4_0900_ai_ci => "utf8mb4_0900_ai_ci",
632            Collation::utf8mb4_bin => "utf8mb4_bin",
633            Collation::utf8mb4_croatian_ci => "utf8mb4_croatian_ci",
634            Collation::utf8mb4_czech_ci => "utf8mb4_czech_ci",
635            Collation::utf8mb4_danish_ci => "utf8mb4_danish_ci",
636            Collation::utf8mb4_esperanto_ci => "utf8mb4_esperanto_ci",
637            Collation::utf8mb4_estonian_ci => "utf8mb4_estonian_ci",
638            Collation::utf8mb4_general_ci => "utf8mb4_general_ci",
639            Collation::utf8mb4_german2_ci => "utf8mb4_german2_ci",
640            Collation::utf8mb4_hungarian_ci => "utf8mb4_hungarian_ci",
641            Collation::utf8mb4_icelandic_ci => "utf8mb4_icelandic_ci",
642            Collation::utf8mb4_latvian_ci => "utf8mb4_latvian_ci",
643            Collation::utf8mb4_lithuanian_ci => "utf8mb4_lithuanian_ci",
644            Collation::utf8mb4_persian_ci => "utf8mb4_persian_ci",
645            Collation::utf8mb4_polish_ci => "utf8mb4_polish_ci",
646            Collation::utf8mb4_roman_ci => "utf8mb4_roman_ci",
647            Collation::utf8mb4_romanian_ci => "utf8mb4_romanian_ci",
648            Collation::utf8mb4_sinhala_ci => "utf8mb4_sinhala_ci",
649            Collation::utf8mb4_slovak_ci => "utf8mb4_slovak_ci",
650            Collation::utf8mb4_slovenian_ci => "utf8mb4_slovenian_ci",
651            Collation::utf8mb4_spanish_ci => "utf8mb4_spanish_ci",
652            Collation::utf8mb4_spanish2_ci => "utf8mb4_spanish2_ci",
653            Collation::utf8mb4_swedish_ci => "utf8mb4_swedish_ci",
654            Collation::utf8mb4_turkish_ci => "utf8mb4_turkish_ci",
655            Collation::utf8mb4_unicode_520_ci => "utf8mb4_unicode_520_ci",
656            Collation::utf8mb4_unicode_ci => "utf8mb4_unicode_ci",
657            Collation::utf8mb4_vietnamese_ci => "utf8mb4_vietnamese_ci",
658        }
659    }
660}
661
662// Handshake packet have only 1 byte for collation_id.
663// So we can't use collations with ID > 255.
664impl FromStr for Collation {
665    type Err = Error;
666
667    fn from_str(collation: &str) -> Result<Self, Self::Err> {
668        Ok(match collation {
669            "big5_chinese_ci" => Collation::big5_chinese_ci,
670            "swe7_swedish_ci" => Collation::swe7_swedish_ci,
671            "utf16_unicode_ci" => Collation::utf16_unicode_ci,
672            "utf16_icelandic_ci" => Collation::utf16_icelandic_ci,
673            "utf16_latvian_ci" => Collation::utf16_latvian_ci,
674            "utf16_romanian_ci" => Collation::utf16_romanian_ci,
675            "utf16_slovenian_ci" => Collation::utf16_slovenian_ci,
676            "utf16_polish_ci" => Collation::utf16_polish_ci,
677            "utf16_estonian_ci" => Collation::utf16_estonian_ci,
678            "utf16_spanish_ci" => Collation::utf16_spanish_ci,
679            "utf16_swedish_ci" => Collation::utf16_swedish_ci,
680            "ascii_general_ci" => Collation::ascii_general_ci,
681            "utf16_turkish_ci" => Collation::utf16_turkish_ci,
682            "utf16_czech_ci" => Collation::utf16_czech_ci,
683            "utf16_danish_ci" => Collation::utf16_danish_ci,
684            "utf16_lithuanian_ci" => Collation::utf16_lithuanian_ci,
685            "utf16_slovak_ci" => Collation::utf16_slovak_ci,
686            "utf16_spanish2_ci" => Collation::utf16_spanish2_ci,
687            "utf16_roman_ci" => Collation::utf16_roman_ci,
688            "utf16_persian_ci" => Collation::utf16_persian_ci,
689            "utf16_esperanto_ci" => Collation::utf16_esperanto_ci,
690            "utf16_hungarian_ci" => Collation::utf16_hungarian_ci,
691            "ujis_japanese_ci" => Collation::ujis_japanese_ci,
692            "utf16_sinhala_ci" => Collation::utf16_sinhala_ci,
693            "utf16_german2_ci" => Collation::utf16_german2_ci,
694            "utf16_croatian_ci" => Collation::utf16_croatian_ci,
695            "utf16_unicode_520_ci" => Collation::utf16_unicode_520_ci,
696            "utf16_vietnamese_ci" => Collation::utf16_vietnamese_ci,
697            "ucs2_unicode_ci" => Collation::ucs2_unicode_ci,
698            "ucs2_icelandic_ci" => Collation::ucs2_icelandic_ci,
699            "sjis_japanese_ci" => Collation::sjis_japanese_ci,
700            "ucs2_latvian_ci" => Collation::ucs2_latvian_ci,
701            "ucs2_romanian_ci" => Collation::ucs2_romanian_ci,
702            "ucs2_slovenian_ci" => Collation::ucs2_slovenian_ci,
703            "ucs2_polish_ci" => Collation::ucs2_polish_ci,
704            "ucs2_estonian_ci" => Collation::ucs2_estonian_ci,
705            "ucs2_spanish_ci" => Collation::ucs2_spanish_ci,
706            "ucs2_swedish_ci" => Collation::ucs2_swedish_ci,
707            "ucs2_turkish_ci" => Collation::ucs2_turkish_ci,
708            "ucs2_czech_ci" => Collation::ucs2_czech_ci,
709            "ucs2_danish_ci" => Collation::ucs2_danish_ci,
710            "cp1251_bulgarian_ci" => Collation::cp1251_bulgarian_ci,
711            "ucs2_lithuanian_ci" => Collation::ucs2_lithuanian_ci,
712            "ucs2_slovak_ci" => Collation::ucs2_slovak_ci,
713            "ucs2_spanish2_ci" => Collation::ucs2_spanish2_ci,
714            "ucs2_roman_ci" => Collation::ucs2_roman_ci,
715            "ucs2_persian_ci" => Collation::ucs2_persian_ci,
716            "ucs2_esperanto_ci" => Collation::ucs2_esperanto_ci,
717            "ucs2_hungarian_ci" => Collation::ucs2_hungarian_ci,
718            "ucs2_sinhala_ci" => Collation::ucs2_sinhala_ci,
719            "ucs2_german2_ci" => Collation::ucs2_german2_ci,
720            "ucs2_croatian_ci" => Collation::ucs2_croatian_ci,
721            "latin1_danish_ci" => Collation::latin1_danish_ci,
722            "ucs2_unicode_520_ci" => Collation::ucs2_unicode_520_ci,
723            "ucs2_vietnamese_ci" => Collation::ucs2_vietnamese_ci,
724            "ucs2_general_mysql500_ci" => Collation::ucs2_general_mysql500_ci,
725            "hebrew_general_ci" => Collation::hebrew_general_ci,
726            "utf32_unicode_ci" => Collation::utf32_unicode_ci,
727            "utf32_icelandic_ci" => Collation::utf32_icelandic_ci,
728            "utf32_latvian_ci" => Collation::utf32_latvian_ci,
729            "utf32_romanian_ci" => Collation::utf32_romanian_ci,
730            "utf32_slovenian_ci" => Collation::utf32_slovenian_ci,
731            "utf32_polish_ci" => Collation::utf32_polish_ci,
732            "utf32_estonian_ci" => Collation::utf32_estonian_ci,
733            "utf32_spanish_ci" => Collation::utf32_spanish_ci,
734            "utf32_swedish_ci" => Collation::utf32_swedish_ci,
735            "utf32_turkish_ci" => Collation::utf32_turkish_ci,
736            "utf32_czech_ci" => Collation::utf32_czech_ci,
737            "utf32_danish_ci" => Collation::utf32_danish_ci,
738            "utf32_lithuanian_ci" => Collation::utf32_lithuanian_ci,
739            "utf32_slovak_ci" => Collation::utf32_slovak_ci,
740            "utf32_spanish2_ci" => Collation::utf32_spanish2_ci,
741            "utf32_roman_ci" => Collation::utf32_roman_ci,
742            "utf32_persian_ci" => Collation::utf32_persian_ci,
743            "utf32_esperanto_ci" => Collation::utf32_esperanto_ci,
744            "utf32_hungarian_ci" => Collation::utf32_hungarian_ci,
745            "utf32_sinhala_ci" => Collation::utf32_sinhala_ci,
746            "tis620_thai_ci" => Collation::tis620_thai_ci,
747            "utf32_german2_ci" => Collation::utf32_german2_ci,
748            "utf32_croatian_ci" => Collation::utf32_croatian_ci,
749            "utf32_unicode_520_ci" => Collation::utf32_unicode_520_ci,
750            "utf32_vietnamese_ci" => Collation::utf32_vietnamese_ci,
751            "euckr_korean_ci" => Collation::euckr_korean_ci,
752            "utf8_unicode_ci" => Collation::utf8_unicode_ci,
753            "utf8_icelandic_ci" => Collation::utf8_icelandic_ci,
754            "utf8_latvian_ci" => Collation::utf8_latvian_ci,
755            "utf8_romanian_ci" => Collation::utf8_romanian_ci,
756            "utf8_slovenian_ci" => Collation::utf8_slovenian_ci,
757            "utf8_polish_ci" => Collation::utf8_polish_ci,
758            "utf8_estonian_ci" => Collation::utf8_estonian_ci,
759            "utf8_spanish_ci" => Collation::utf8_spanish_ci,
760            "latin2_czech_cs" => Collation::latin2_czech_cs,
761            "latin7_estonian_cs" => Collation::latin7_estonian_cs,
762            "utf8_swedish_ci" => Collation::utf8_swedish_ci,
763            "utf8_turkish_ci" => Collation::utf8_turkish_ci,
764            "utf8_czech_ci" => Collation::utf8_czech_ci,
765            "utf8_danish_ci" => Collation::utf8_danish_ci,
766            "utf8_lithuanian_ci" => Collation::utf8_lithuanian_ci,
767            "utf8_slovak_ci" => Collation::utf8_slovak_ci,
768            "utf8_spanish2_ci" => Collation::utf8_spanish2_ci,
769            "utf8_roman_ci" => Collation::utf8_roman_ci,
770            "utf8_persian_ci" => Collation::utf8_persian_ci,
771            "utf8_esperanto_ci" => Collation::utf8_esperanto_ci,
772            "latin2_hungarian_ci" => Collation::latin2_hungarian_ci,
773            "utf8_hungarian_ci" => Collation::utf8_hungarian_ci,
774            "utf8_sinhala_ci" => Collation::utf8_sinhala_ci,
775            "utf8_german2_ci" => Collation::utf8_german2_ci,
776            "utf8_croatian_ci" => Collation::utf8_croatian_ci,
777            "utf8_unicode_520_ci" => Collation::utf8_unicode_520_ci,
778            "utf8_vietnamese_ci" => Collation::utf8_vietnamese_ci,
779            "koi8u_general_ci" => Collation::koi8u_general_ci,
780            "utf8_general_mysql500_ci" => Collation::utf8_general_mysql500_ci,
781            "utf8mb4_unicode_ci" => Collation::utf8mb4_unicode_ci,
782            "utf8mb4_icelandic_ci" => Collation::utf8mb4_icelandic_ci,
783            "utf8mb4_latvian_ci" => Collation::utf8mb4_latvian_ci,
784            "utf8mb4_romanian_ci" => Collation::utf8mb4_romanian_ci,
785            "utf8mb4_slovenian_ci" => Collation::utf8mb4_slovenian_ci,
786            "utf8mb4_polish_ci" => Collation::utf8mb4_polish_ci,
787            "cp1251_ukrainian_ci" => Collation::cp1251_ukrainian_ci,
788            "utf8mb4_estonian_ci" => Collation::utf8mb4_estonian_ci,
789            "utf8mb4_spanish_ci" => Collation::utf8mb4_spanish_ci,
790            "utf8mb4_swedish_ci" => Collation::utf8mb4_swedish_ci,
791            "utf8mb4_turkish_ci" => Collation::utf8mb4_turkish_ci,
792            "utf8mb4_czech_ci" => Collation::utf8mb4_czech_ci,
793            "utf8mb4_danish_ci" => Collation::utf8mb4_danish_ci,
794            "utf8mb4_lithuanian_ci" => Collation::utf8mb4_lithuanian_ci,
795            "utf8mb4_slovak_ci" => Collation::utf8mb4_slovak_ci,
796            "utf8mb4_spanish2_ci" => Collation::utf8mb4_spanish2_ci,
797            "utf8mb4_roman_ci" => Collation::utf8mb4_roman_ci,
798            "gb2312_chinese_ci" => Collation::gb2312_chinese_ci,
799            "utf8mb4_persian_ci" => Collation::utf8mb4_persian_ci,
800            "utf8mb4_esperanto_ci" => Collation::utf8mb4_esperanto_ci,
801            "utf8mb4_hungarian_ci" => Collation::utf8mb4_hungarian_ci,
802            "utf8mb4_sinhala_ci" => Collation::utf8mb4_sinhala_ci,
803            "utf8mb4_german2_ci" => Collation::utf8mb4_german2_ci,
804            "utf8mb4_croatian_ci" => Collation::utf8mb4_croatian_ci,
805            "utf8mb4_unicode_520_ci" => Collation::utf8mb4_unicode_520_ci,
806            "utf8mb4_vietnamese_ci" => Collation::utf8mb4_vietnamese_ci,
807            "gb18030_chinese_ci" => Collation::gb18030_chinese_ci,
808            "gb18030_bin" => Collation::gb18030_bin,
809            "greek_general_ci" => Collation::greek_general_ci,
810            "gb18030_unicode_520_ci" => Collation::gb18030_unicode_520_ci,
811            "utf8mb4_0900_ai_ci" => Collation::utf8mb4_0900_ai_ci,
812            "cp1250_general_ci" => Collation::cp1250_general_ci,
813            "latin2_croatian_ci" => Collation::latin2_croatian_ci,
814            "gbk_chinese_ci" => Collation::gbk_chinese_ci,
815            "cp1257_lithuanian_ci" => Collation::cp1257_lithuanian_ci,
816            "dec8_swedish_ci" => Collation::dec8_swedish_ci,
817            "latin5_turkish_ci" => Collation::latin5_turkish_ci,
818            "latin1_german2_ci" => Collation::latin1_german2_ci,
819            "armscii8_general_ci" => Collation::armscii8_general_ci,
820            "utf8_general_ci" => Collation::utf8_general_ci,
821            "cp1250_czech_cs" => Collation::cp1250_czech_cs,
822            "ucs2_general_ci" => Collation::ucs2_general_ci,
823            "cp866_general_ci" => Collation::cp866_general_ci,
824            "keybcs2_general_ci" => Collation::keybcs2_general_ci,
825            "macce_general_ci" => Collation::macce_general_ci,
826            "macroman_general_ci" => Collation::macroman_general_ci,
827            "cp850_general_ci" => Collation::cp850_general_ci,
828            "cp852_general_ci" => Collation::cp852_general_ci,
829            "latin7_general_ci" => Collation::latin7_general_ci,
830            "latin7_general_cs" => Collation::latin7_general_cs,
831            "macce_bin" => Collation::macce_bin,
832            "cp1250_croatian_ci" => Collation::cp1250_croatian_ci,
833            "utf8mb4_general_ci" => Collation::utf8mb4_general_ci,
834            "utf8mb4_bin" => Collation::utf8mb4_bin,
835            "latin1_bin" => Collation::latin1_bin,
836            "latin1_general_ci" => Collation::latin1_general_ci,
837            "latin1_general_cs" => Collation::latin1_general_cs,
838            "latin1_german1_ci" => Collation::latin1_german1_ci,
839            "cp1251_bin" => Collation::cp1251_bin,
840            "cp1251_general_ci" => Collation::cp1251_general_ci,
841            "cp1251_general_cs" => Collation::cp1251_general_cs,
842            "macroman_bin" => Collation::macroman_bin,
843            "utf16_general_ci" => Collation::utf16_general_ci,
844            "utf16_bin" => Collation::utf16_bin,
845            "utf16le_general_ci" => Collation::utf16le_general_ci,
846            "cp1256_general_ci" => Collation::cp1256_general_ci,
847            "cp1257_bin" => Collation::cp1257_bin,
848            "cp1257_general_ci" => Collation::cp1257_general_ci,
849            "hp8_english_ci" => Collation::hp8_english_ci,
850            "utf32_general_ci" => Collation::utf32_general_ci,
851            "utf32_bin" => Collation::utf32_bin,
852            "utf16le_bin" => Collation::utf16le_bin,
853            "binary" => Collation::binary,
854            "armscii8_bin" => Collation::armscii8_bin,
855            "ascii_bin" => Collation::ascii_bin,
856            "cp1250_bin" => Collation::cp1250_bin,
857            "cp1256_bin" => Collation::cp1256_bin,
858            "cp866_bin" => Collation::cp866_bin,
859            "dec8_bin" => Collation::dec8_bin,
860            "koi8r_general_ci" => Collation::koi8r_general_ci,
861            "greek_bin" => Collation::greek_bin,
862            "hebrew_bin" => Collation::hebrew_bin,
863            "hp8_bin" => Collation::hp8_bin,
864            "keybcs2_bin" => Collation::keybcs2_bin,
865            "koi8r_bin" => Collation::koi8r_bin,
866            "koi8u_bin" => Collation::koi8u_bin,
867            "utf8_tolower_ci" => Collation::utf8_tolower_ci,
868            "latin2_bin" => Collation::latin2_bin,
869            "latin5_bin" => Collation::latin5_bin,
870            "latin7_bin" => Collation::latin7_bin,
871            "latin1_swedish_ci" => Collation::latin1_swedish_ci,
872            "cp850_bin" => Collation::cp850_bin,
873            "cp852_bin" => Collation::cp852_bin,
874            "swe7_bin" => Collation::swe7_bin,
875            "utf8_bin" => Collation::utf8_bin,
876            "big5_bin" => Collation::big5_bin,
877            "euckr_bin" => Collation::euckr_bin,
878            "gb2312_bin" => Collation::gb2312_bin,
879            "gbk_bin" => Collation::gbk_bin,
880            "sjis_bin" => Collation::sjis_bin,
881            "tis620_bin" => Collation::tis620_bin,
882            "latin2_general_ci" => Collation::latin2_general_ci,
883            "ucs2_bin" => Collation::ucs2_bin,
884            "ujis_bin" => Collation::ujis_bin,
885            "geostd8_general_ci" => Collation::geostd8_general_ci,
886            "geostd8_bin" => Collation::geostd8_bin,
887            "latin1_spanish_ci" => Collation::latin1_spanish_ci,
888            "cp932_japanese_ci" => Collation::cp932_japanese_ci,
889            "cp932_bin" => Collation::cp932_bin,
890            "eucjpms_japanese_ci" => Collation::eucjpms_japanese_ci,
891            "eucjpms_bin" => Collation::eucjpms_bin,
892            "cp1250_polish_ci" => Collation::cp1250_polish_ci,
893
894            _ => {
895                return Err(Error::from(format!(
896                    "unsupported MySQL collation: {}",
897                    collation
898                )));
899            }
900        })
901    }
902}