forked from jeremy/mysql2
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Port new mappings from latest master - Add utf8mb3 -> utf_8 missing mapping - rebuild ext/mysql2/mysql_enc_to_ruby.h and ext/mysql2/mysql_enc_name_to_ruby.h from Mysql 8.0.32
- Loading branch information
Showing
4 changed files
with
183 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* C code produced by gperf version 3.0.3 */ | ||
/* Command-line: gperf */ | ||
/* ANSI-C code produced by gperf version 3.1 */ | ||
/* Command-line: /usr/bin/gperf */ | ||
/* Computed positions: -k'1,3,$' */ | ||
|
||
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | ||
|
@@ -26,11 +26,11 @@ | |
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ | ||
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) | ||
/* The character set is not based on ISO-646. */ | ||
error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu[email protected]>." | ||
#error "gperf generated tables don't work with this execution character set. Please report a bug to <[email protected]>." | ||
#endif | ||
|
||
struct mysql2_mysql_enc_name_to_rb_map { const char *name; const char *rb_name; }; | ||
/* maximum key range = 66, duplicates = 0 */ | ||
/* maximum key range = 71, duplicates = 0 */ | ||
|
||
#ifdef __GNUC__ | ||
__inline | ||
|
@@ -40,123 +40,118 @@ inline | |
#endif | ||
#endif | ||
static unsigned int | ||
mysql2_mysql_enc_name_to_rb_hash (str, len) | ||
register const char *str; | ||
register unsigned int len; | ||
mysql2_mysql_enc_name_to_rb_hash (register const char *str, register size_t len) | ||
{ | ||
static const unsigned char asso_values[] = | ||
{ | ||
69, 69, 69, 69, 69, 69, 69, 69, 69, 69, | ||
69, 69, 69, 69, 69, 69, 69, 69, 69, 69, | ||
69, 69, 69, 69, 69, 69, 69, 69, 69, 69, | ||
69, 69, 69, 69, 69, 69, 69, 69, 69, 69, | ||
69, 69, 69, 69, 69, 69, 69, 69, 40, 5, | ||
0, 69, 0, 40, 25, 20, 10, 55, 69, 69, | ||
69, 69, 69, 69, 69, 69, 69, 69, 69, 69, | ||
69, 69, 69, 69, 69, 69, 69, 69, 69, 69, | ||
69, 69, 69, 69, 69, 69, 69, 69, 69, 69, | ||
69, 69, 69, 69, 69, 69, 69, 35, 5, 0, | ||
10, 0, 20, 0, 5, 5, 69, 0, 10, 15, | ||
0, 0, 69, 69, 25, 5, 5, 0, 69, 30, | ||
69, 0, 69, 69, 69, 69, 69, 69, 69, 69, | ||
69, 69, 69, 69, 69, 69, 69, 69, 69, 69, | ||
69, 69, 69, 69, 69, 69, 69, 69, 69, 69, | ||
69, 69, 69, 69, 69, 69, 69, 69, 69, 69, | ||
69, 69, 69, 69, 69, 69, 69, 69, 69, 69, | ||
69, 69, 69, 69, 69, 69, 69, 69, 69, 69, | ||
69, 69, 69, 69, 69, 69, 69, 69, 69, 69, | ||
69, 69, 69, 69, 69, 69, 69, 69, 69, 69, | ||
69, 69, 69, 69, 69, 69, 69, 69, 69, 69, | ||
69, 69, 69, 69, 69, 69, 69, 69, 69, 69, | ||
69, 69, 69, 69, 69, 69, 69, 69, 69, 69, | ||
69, 69, 69, 69, 69, 69, 69, 69, 69, 69, | ||
69, 69, 69, 69, 69, 69, 69, 69, 69, 69, | ||
69, 69, 69, 69, 69, 69 | ||
74, 74, 74, 74, 74, 74, 74, 74, 74, 74, | ||
74, 74, 74, 74, 74, 74, 74, 74, 74, 74, | ||
74, 74, 74, 74, 74, 74, 74, 74, 74, 74, | ||
74, 74, 74, 74, 74, 74, 74, 74, 74, 74, | ||
74, 74, 74, 74, 74, 74, 74, 74, 15, 5, | ||
0, 30, 5, 25, 40, 10, 20, 50, 74, 74, | ||
74, 74, 74, 74, 74, 74, 74, 74, 74, 74, | ||
74, 74, 74, 74, 74, 74, 74, 74, 74, 74, | ||
74, 74, 74, 74, 74, 74, 74, 74, 74, 74, | ||
74, 74, 74, 74, 74, 74, 74, 40, 5, 0, | ||
15, 10, 0, 0, 0, 5, 74, 0, 25, 5, | ||
0, 5, 74, 74, 20, 5, 5, 0, 74, 45, | ||
74, 0, 74, 74, 74, 74, 74, 74, 74, 74, | ||
74, 74, 74, 74, 74, 74, 74, 74, 74, 74, | ||
74, 74, 74, 74, 74, 74, 74, 74, 74, 74, | ||
74, 74, 74, 74, 74, 74, 74, 74, 74, 74, | ||
74, 74, 74, 74, 74, 74, 74, 74, 74, 74, | ||
74, 74, 74, 74, 74, 74, 74, 74, 74, 74, | ||
74, 74, 74, 74, 74, 74, 74, 74, 74, 74, | ||
74, 74, 74, 74, 74, 74, 74, 74, 74, 74, | ||
74, 74, 74, 74, 74, 74, 74, 74, 74, 74, | ||
74, 74, 74, 74, 74, 74, 74, 74, 74, 74, | ||
74, 74, 74, 74, 74, 74, 74, 74, 74, 74, | ||
74, 74, 74, 74, 74, 74, 74, 74, 74, 74, | ||
74, 74, 74, 74, 74, 74, 74, 74, 74, 74, | ||
74, 74, 74, 74, 74, 74 | ||
}; | ||
return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]]; | ||
} | ||
|
||
#ifdef __GNUC__ | ||
__inline | ||
#ifdef __GNUC_STDC_INLINE__ | ||
__attribute__ ((__gnu_inline__)) | ||
#endif | ||
#endif | ||
const struct mysql2_mysql_enc_name_to_rb_map * | ||
mysql2_mysql_enc_name_to_rb (str, len) | ||
register const char *str; | ||
register unsigned int len; | ||
mysql2_mysql_enc_name_to_rb (register const char *str, register size_t len) | ||
{ | ||
enum | ||
{ | ||
TOTAL_KEYWORDS = 39, | ||
TOTAL_KEYWORDS = 42, | ||
MIN_WORD_LENGTH = 3, | ||
MAX_WORD_LENGTH = 8, | ||
MIN_HASH_VALUE = 3, | ||
MAX_HASH_VALUE = 68 | ||
MAX_HASH_VALUE = 73 | ||
}; | ||
|
||
static const struct mysql2_mysql_enc_name_to_rb_map wordlist[] = | ||
{ | ||
{""}, {""}, {""}, | ||
{"gbk", "GBK"}, | ||
{""}, | ||
{"greek", "ISO-8859-7"}, | ||
{"utf32", "UTF-32"}, | ||
{"gb2312", "GB2312"}, | ||
{"keybcs2", NULL}, | ||
{""}, | ||
{"ucs2", "UTF-16BE"}, | ||
{"koi8u", "KOI8-R"}, | ||
{"binary", "ASCII-8BIT"}, | ||
{"eucjpms", "eucJP-ms"}, | ||
{""}, | ||
{"utf8mb4", "UTF-8"}, | ||
{"macroman", "macRoman"}, | ||
{"ujis", "eucJP-ms"}, | ||
{"cp852", "CP852"}, | ||
{"greek", "ISO-8859-7"}, | ||
{"cp1251", "Windows-1251"}, | ||
{"geostd8", NULL}, | ||
{"utf16le", "UTF-16LE"}, | ||
{""}, | ||
{"sjis", "Shift_JIS"}, | ||
{"macce", "macCentEuro"}, | ||
{"cp1257", "Windows-1257"}, | ||
{"eucjpms", "eucJP-ms"}, | ||
{""}, | ||
{"utf8", "UTF-8"}, | ||
{"cp852", "CP852"}, | ||
{"cp1250", "Windows-1250"}, | ||
{"gb18030", "GB18030"}, | ||
{""}, | ||
{"swe7", NULL}, | ||
{"koi8r", "KOI8-R"}, | ||
{"tis620", "TIS-620"}, | ||
{"geostd8", NULL}, | ||
{""}, | ||
{"big5", "Big5"}, | ||
{"euckr", "EUC-KR"}, | ||
{"latin2", "ISO-8859-2"}, | ||
{"utf8mb3", "UTF-8"}, | ||
{""}, | ||
{"macroman", "macRoman"}, | ||
{"dec8", NULL}, | ||
{"utf32", "UTF-32"}, | ||
{"cp850", "CP850"}, | ||
{"latin1", "UTF-8"}, | ||
{"utf8mb4", "UTF-8"}, | ||
{""}, | ||
{"hp8", NULL}, | ||
{"swe7", NULL}, | ||
{"euckr", "EUC-KR"}, | ||
{"cp1257", "Windows-1257"}, | ||
{""}, {""}, | ||
{"utf8", "UTF-8"}, | ||
{"koi8r", "KOI8-R"}, | ||
{"cp1256", "Windows-1256"}, | ||
{""}, {""}, {""}, | ||
{"cp866", "IBM866"}, | ||
{""}, | ||
{"utf16", "UTF-16"}, | ||
{"latin7", "ISO-8859-13"}, | ||
{""}, {""}, {""}, | ||
{"ascii", "US-ASCII"}, | ||
{"hebrew", "ISO-8859-8"}, | ||
{""}, {""}, | ||
{"big5", "Big5"}, | ||
{"utf16", "UTF-16"}, | ||
{"cp1250", "Windows-1250"}, | ||
{""}, {""}, {""}, | ||
{"cp850", "CP850"}, | ||
{"tis620", "TIS-620"}, | ||
{"cp1256", "Windows-1256"}, | ||
{""}, {""}, {""}, | ||
{"cp932", "Windows-31J"}, | ||
{"hebrew", "ISO-8859-8"}, | ||
{""}, {""}, {""}, {""}, | ||
{"latin5", "ISO-8859-9"}, | ||
{""}, {""}, {""}, {""}, {""}, {""}, | ||
{""}, {""}, {""}, | ||
{"cp866", "IBM866"}, | ||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
{"armscii8", NULL} | ||
}; | ||
|
||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | ||
{ | ||
register int key = mysql2_mysql_enc_name_to_rb_hash (str, len); | ||
register unsigned int key = mysql2_mysql_enc_name_to_rb_hash (str, len); | ||
|
||
if (key <= MAX_HASH_VALUE && key >= 0) | ||
if (key <= MAX_HASH_VALUE) | ||
{ | ||
register const char *s = wordlist[key].name; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.