sqlx_mysql/
collation.rs

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