ruby-mysql 2.9.13 → 2.9.14
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ruby-mysql might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/mysql.rb +2 -2
- data/lib/mysql/charset.rb +224 -152
- data/lib/mysql/constants.rb +84 -47
- data/lib/mysql/protocol.rb +4 -4
- data/test/test_mysql.rb +18 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 113de8c9b46c75bf18b833a65205517938daf47d
|
4
|
+
data.tar.gz: 675d64d8cc1185e7f394c4f201aa18f427b18f11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47b396bc40fa36e588d01899569f8b0cca6b256bb2d290fe2ce5ab44dc66a566c2b47d67f64cb8f4d2a8a0a62c352e878da681f88b89bc0a6811b12205754214
|
7
|
+
data.tar.gz: 2aa55a288ce9c5ca4f22be8b8a2c6750be23592a0e030b0077f622b43195691f81de20831a359098ce8a270050e3ffa4ab794439b039c267d803f0d23ad2330e
|
data/lib/mysql.rb
CHANGED
@@ -731,8 +731,8 @@ class Mysql
|
|
731
731
|
max_length = Array.new(@fields.size, 0)
|
732
732
|
@records.each_with_index do |rec, i|
|
733
733
|
rec = @records[i] = rec.to_a if rec.is_a? RawRecord
|
734
|
-
max_length.each_index do |
|
735
|
-
max_length[
|
734
|
+
max_length.each_index do |j|
|
735
|
+
max_length[j] = rec[j].length if rec[j] && rec[j].length > max_length[j]
|
736
736
|
end
|
737
737
|
end
|
738
738
|
max_length.each_with_index do |len, i|
|
data/lib/mysql/charset.rb
CHANGED
@@ -28,158 +28,230 @@ class Mysql
|
|
28
28
|
# [[charset_number, charset_name, collation_name, default], ...]
|
29
29
|
# @private
|
30
30
|
CHARSETS = [
|
31
|
-
[ 1, "big5", "big5_chinese_ci",
|
32
|
-
[ 2, "latin2", "latin2_czech_cs",
|
33
|
-
[ 3, "dec8", "dec8_swedish_ci",
|
34
|
-
[ 4, "cp850", "cp850_general_ci",
|
35
|
-
[ 5, "latin1", "latin1_german1_ci",
|
36
|
-
[ 6, "hp8", "hp8_english_ci",
|
37
|
-
[ 7, "koi8r", "koi8r_general_ci",
|
38
|
-
[ 8, "latin1", "latin1_swedish_ci",
|
39
|
-
[ 9, "latin2", "latin2_general_ci",
|
40
|
-
[ 10, "swe7", "swe7_swedish_ci",
|
41
|
-
[ 11, "ascii", "ascii_general_ci",
|
42
|
-
[ 12, "ujis", "ujis_japanese_ci",
|
43
|
-
[ 13, "sjis", "sjis_japanese_ci",
|
44
|
-
[ 14, "cp1251", "cp1251_bulgarian_ci",
|
45
|
-
[ 15, "latin1", "latin1_danish_ci",
|
46
|
-
[ 16, "hebrew", "hebrew_general_ci",
|
47
|
-
[ 17, "filename", "filename",
|
48
|
-
[ 18, "tis620", "tis620_thai_ci",
|
49
|
-
[ 19, "euckr", "euckr_korean_ci",
|
50
|
-
[ 20, "latin7", "latin7_estonian_cs",
|
51
|
-
[ 21, "latin2", "latin2_hungarian_ci",
|
52
|
-
[ 22, "koi8u", "koi8u_general_ci",
|
53
|
-
[ 23, "cp1251", "cp1251_ukrainian_ci",
|
54
|
-
[ 24, "gb2312", "gb2312_chinese_ci",
|
55
|
-
[ 25, "greek", "greek_general_ci",
|
56
|
-
[ 26, "cp1250", "cp1250_general_ci",
|
57
|
-
[ 27, "latin2", "latin2_croatian_ci",
|
58
|
-
[ 28, "gbk", "gbk_chinese_ci",
|
59
|
-
[ 29, "cp1257", "cp1257_lithuanian_ci",
|
60
|
-
[ 30, "latin5", "latin5_turkish_ci",
|
61
|
-
[ 31, "latin1", "latin1_german2_ci",
|
62
|
-
[ 32, "armscii8", "armscii8_general_ci",
|
63
|
-
[ 33, "utf8", "utf8_general_ci",
|
64
|
-
[ 34, "cp1250", "cp1250_czech_cs",
|
65
|
-
[ 35, "ucs2", "ucs2_general_ci",
|
66
|
-
[ 36, "cp866", "cp866_general_ci",
|
67
|
-
[ 37, "keybcs2", "keybcs2_general_ci",
|
68
|
-
[ 38, "macce", "macce_general_ci",
|
69
|
-
[ 39, "macroman", "macroman_general_ci",
|
70
|
-
[ 40, "cp852", "cp852_general_ci",
|
71
|
-
[ 41, "latin7", "latin7_general_ci",
|
72
|
-
[ 42, "latin7", "latin7_general_cs",
|
73
|
-
[ 43, "macce", "macce_bin",
|
74
|
-
[ 44, "cp1250", "cp1250_croatian_ci",
|
75
|
-
[ 45, "utf8mb4", "utf8mb4_general_ci",
|
76
|
-
[ 46, "utf8mb4", "utf8mb4_bin",
|
77
|
-
[ 47, "latin1", "latin1_bin",
|
78
|
-
[ 48, "latin1", "latin1_general_ci",
|
79
|
-
[ 49, "latin1", "latin1_general_cs",
|
80
|
-
[ 50, "cp1251", "cp1251_bin",
|
81
|
-
[ 51, "cp1251", "cp1251_general_ci",
|
82
|
-
[ 52, "cp1251", "cp1251_general_cs",
|
83
|
-
[ 53, "macroman", "macroman_bin",
|
84
|
-
[
|
85
|
-
[
|
86
|
-
[
|
87
|
-
[
|
88
|
-
[
|
89
|
-
[
|
90
|
-
[
|
91
|
-
[
|
92
|
-
[
|
93
|
-
[
|
94
|
-
[
|
95
|
-
[
|
96
|
-
[
|
97
|
-
[
|
98
|
-
[
|
99
|
-
[
|
100
|
-
[
|
101
|
-
[
|
102
|
-
[
|
103
|
-
[
|
104
|
-
[
|
105
|
-
[
|
106
|
-
[
|
107
|
-
[
|
108
|
-
[
|
109
|
-
[
|
110
|
-
[
|
111
|
-
[
|
112
|
-
[
|
113
|
-
[
|
114
|
-
[
|
115
|
-
[
|
116
|
-
[
|
117
|
-
[
|
118
|
-
[
|
119
|
-
[
|
120
|
-
[
|
121
|
-
[
|
122
|
-
[
|
123
|
-
[
|
124
|
-
[
|
125
|
-
[
|
126
|
-
[
|
127
|
-
[
|
128
|
-
[
|
129
|
-
[
|
130
|
-
[
|
131
|
-
[
|
132
|
-
[
|
133
|
-
[
|
134
|
-
[
|
135
|
-
[
|
136
|
-
[
|
137
|
-
[
|
138
|
-
[
|
139
|
-
[
|
140
|
-
[
|
141
|
-
[
|
142
|
-
[
|
143
|
-
[
|
144
|
-
[
|
145
|
-
[
|
146
|
-
[
|
147
|
-
[
|
148
|
-
[
|
149
|
-
[
|
150
|
-
[
|
151
|
-
[
|
152
|
-
[
|
153
|
-
[
|
154
|
-
[
|
155
|
-
[
|
156
|
-
[
|
157
|
-
[
|
158
|
-
[
|
159
|
-
[
|
160
|
-
[
|
161
|
-
[
|
162
|
-
[
|
163
|
-
[
|
164
|
-
[
|
165
|
-
[
|
166
|
-
[
|
167
|
-
[
|
168
|
-
[
|
169
|
-
[
|
170
|
-
[
|
171
|
-
[
|
172
|
-
[
|
173
|
-
[
|
174
|
-
[
|
175
|
-
[
|
176
|
-
[
|
177
|
-
[
|
178
|
-
[
|
179
|
-
[
|
180
|
-
[
|
181
|
-
[
|
182
|
-
[
|
31
|
+
[ 1, "big5", "big5_chinese_ci", true ],
|
32
|
+
[ 2, "latin2", "latin2_czech_cs", false],
|
33
|
+
[ 3, "dec8", "dec8_swedish_ci", true ],
|
34
|
+
[ 4, "cp850", "cp850_general_ci", true ],
|
35
|
+
[ 5, "latin1", "latin1_german1_ci", false],
|
36
|
+
[ 6, "hp8", "hp8_english_ci", true ],
|
37
|
+
[ 7, "koi8r", "koi8r_general_ci", true ],
|
38
|
+
[ 8, "latin1", "latin1_swedish_ci", true ],
|
39
|
+
[ 9, "latin2", "latin2_general_ci", true ],
|
40
|
+
[ 10, "swe7", "swe7_swedish_ci", true ],
|
41
|
+
[ 11, "ascii", "ascii_general_ci", true ],
|
42
|
+
[ 12, "ujis", "ujis_japanese_ci", true ],
|
43
|
+
[ 13, "sjis", "sjis_japanese_ci", true ],
|
44
|
+
[ 14, "cp1251", "cp1251_bulgarian_ci", false],
|
45
|
+
[ 15, "latin1", "latin1_danish_ci", false],
|
46
|
+
[ 16, "hebrew", "hebrew_general_ci", true ],
|
47
|
+
[ 17, "filename", "filename", true ],
|
48
|
+
[ 18, "tis620", "tis620_thai_ci", true ],
|
49
|
+
[ 19, "euckr", "euckr_korean_ci", true ],
|
50
|
+
[ 20, "latin7", "latin7_estonian_cs", false],
|
51
|
+
[ 21, "latin2", "latin2_hungarian_ci", false],
|
52
|
+
[ 22, "koi8u", "koi8u_general_ci", true ],
|
53
|
+
[ 23, "cp1251", "cp1251_ukrainian_ci", false],
|
54
|
+
[ 24, "gb2312", "gb2312_chinese_ci", true ],
|
55
|
+
[ 25, "greek", "greek_general_ci", true ],
|
56
|
+
[ 26, "cp1250", "cp1250_general_ci", true ],
|
57
|
+
[ 27, "latin2", "latin2_croatian_ci", false],
|
58
|
+
[ 28, "gbk", "gbk_chinese_ci", true ],
|
59
|
+
[ 29, "cp1257", "cp1257_lithuanian_ci", false],
|
60
|
+
[ 30, "latin5", "latin5_turkish_ci", true ],
|
61
|
+
[ 31, "latin1", "latin1_german2_ci", false],
|
62
|
+
[ 32, "armscii8", "armscii8_general_ci", true ],
|
63
|
+
[ 33, "utf8", "utf8_general_ci", true ],
|
64
|
+
[ 34, "cp1250", "cp1250_czech_cs", false],
|
65
|
+
[ 35, "ucs2", "ucs2_general_ci", true ],
|
66
|
+
[ 36, "cp866", "cp866_general_ci", true ],
|
67
|
+
[ 37, "keybcs2", "keybcs2_general_ci", true ],
|
68
|
+
[ 38, "macce", "macce_general_ci", true ],
|
69
|
+
[ 39, "macroman", "macroman_general_ci", true ],
|
70
|
+
[ 40, "cp852", "cp852_general_ci", true ],
|
71
|
+
[ 41, "latin7", "latin7_general_ci", true ],
|
72
|
+
[ 42, "latin7", "latin7_general_cs", false],
|
73
|
+
[ 43, "macce", "macce_bin", false],
|
74
|
+
[ 44, "cp1250", "cp1250_croatian_ci", false],
|
75
|
+
[ 45, "utf8mb4", "utf8mb4_general_ci", true ],
|
76
|
+
[ 46, "utf8mb4", "utf8mb4_bin", false],
|
77
|
+
[ 47, "latin1", "latin1_bin", false],
|
78
|
+
[ 48, "latin1", "latin1_general_ci", false],
|
79
|
+
[ 49, "latin1", "latin1_general_cs", false],
|
80
|
+
[ 50, "cp1251", "cp1251_bin", false],
|
81
|
+
[ 51, "cp1251", "cp1251_general_ci", true ],
|
82
|
+
[ 52, "cp1251", "cp1251_general_cs", false],
|
83
|
+
[ 53, "macroman", "macroman_bin", false],
|
84
|
+
[ 54, "utf16", "utf16_general_ci", true ],
|
85
|
+
[ 55, "utf16", "utf16_bin", false],
|
86
|
+
[ 56, "utf16le", "utf16le_general_ci", true ],
|
87
|
+
[ 57, "cp1256", "cp1256_general_ci", true ],
|
88
|
+
[ 58, "cp1257", "cp1257_bin", false],
|
89
|
+
[ 59, "cp1257", "cp1257_general_ci", true ],
|
90
|
+
[ 60, "utf32", "utf32_general_ci", true ],
|
91
|
+
[ 61, "utf32", "utf32_bin", false],
|
92
|
+
[ 62, "utf16le", "utf16le_bin", false],
|
93
|
+
[ 63, "binary", "binary", true ],
|
94
|
+
[ 64, "armscii8", "armscii8_bin", false],
|
95
|
+
[ 65, "ascii", "ascii_bin", false],
|
96
|
+
[ 66, "cp1250", "cp1250_bin", false],
|
97
|
+
[ 67, "cp1256", "cp1256_bin", false],
|
98
|
+
[ 68, "cp866", "cp866_bin", false],
|
99
|
+
[ 69, "dec8", "dec8_bin", false],
|
100
|
+
[ 70, "greek", "greek_bin", false],
|
101
|
+
[ 71, "hebrew", "hebrew_bin", false],
|
102
|
+
[ 72, "hp8", "hp8_bin", false],
|
103
|
+
[ 73, "keybcs2", "keybcs2_bin", false],
|
104
|
+
[ 74, "koi8r", "koi8r_bin", false],
|
105
|
+
[ 75, "koi8u", "koi8u_bin", false],
|
106
|
+
[ 77, "latin2", "latin2_bin", false],
|
107
|
+
[ 78, "latin5", "latin5_bin", false],
|
108
|
+
[ 79, "latin7", "latin7_bin", false],
|
109
|
+
[ 80, "cp850", "cp850_bin", false],
|
110
|
+
[ 81, "cp852", "cp852_bin", false],
|
111
|
+
[ 82, "swe7", "swe7_bin", false],
|
112
|
+
[ 83, "utf8", "utf8_bin", false],
|
113
|
+
[ 84, "big5", "big5_bin", false],
|
114
|
+
[ 85, "euckr", "euckr_bin", false],
|
115
|
+
[ 86, "gb2312", "gb2312_bin", false],
|
116
|
+
[ 87, "gbk", "gbk_bin", false],
|
117
|
+
[ 88, "sjis", "sjis_bin", false],
|
118
|
+
[ 89, "tis620", "tis620_bin", false],
|
119
|
+
[ 90, "ucs2", "ucs2_bin", false],
|
120
|
+
[ 91, "ujis", "ujis_bin", false],
|
121
|
+
[ 92, "geostd8", "geostd8_general_ci", true ],
|
122
|
+
[ 93, "geostd8", "geostd8_bin", false],
|
123
|
+
[ 94, "latin1", "latin1_spanish_ci", false],
|
124
|
+
[ 95, "cp932", "cp932_japanese_ci", true ],
|
125
|
+
[ 96, "cp932", "cp932_bin", false],
|
126
|
+
[ 97, "eucjpms", "eucjpms_japanese_ci", true ],
|
127
|
+
[ 98, "eucjpms", "eucjpms_bin", false],
|
128
|
+
[ 99, "cp1250", "cp1250_polish_ci", false],
|
129
|
+
[101, "utf16", "utf16_unicode_ci", false],
|
130
|
+
[102, "utf16", "utf16_icelandic_ci", false],
|
131
|
+
[103, "utf16", "utf16_latvian_ci", false],
|
132
|
+
[104, "utf16", "utf16_romanian_ci", false],
|
133
|
+
[105, "utf16", "utf16_slovenian_ci", false],
|
134
|
+
[106, "utf16", "utf16_polish_ci", false],
|
135
|
+
[107, "utf16", "utf16_estonian_ci", false],
|
136
|
+
[108, "utf16", "utf16_spanish_ci", false],
|
137
|
+
[109, "utf16", "utf16_swedish_ci", false],
|
138
|
+
[110, "utf16", "utf16_turkish_ci", false],
|
139
|
+
[111, "utf16", "utf16_czech_ci", false],
|
140
|
+
[112, "utf16", "utf16_danish_ci", false],
|
141
|
+
[113, "utf16", "utf16_lithuanian_ci", false],
|
142
|
+
[114, "utf16", "utf16_slovak_ci", false],
|
143
|
+
[115, "utf16", "utf16_spanish2_ci", false],
|
144
|
+
[116, "utf16", "utf16_roman_ci", false],
|
145
|
+
[117, "utf16", "utf16_persian_ci", false],
|
146
|
+
[118, "utf16", "utf16_esperanto_ci", false],
|
147
|
+
[119, "utf16", "utf16_hungarian_ci", false],
|
148
|
+
[120, "utf16", "utf16_sinhala_ci", false],
|
149
|
+
[121, "utf16", "utf16_german2_ci", false],
|
150
|
+
[122, "utf16", "utf16_croatian_ci", false],
|
151
|
+
[123, "utf16", "utf16_unicode_520_ci", false],
|
152
|
+
[124, "utf16", "utf16_vietnamese_ci", false],
|
153
|
+
[128, "ucs2", "ucs2_unicode_ci", false],
|
154
|
+
[129, "ucs2", "ucs2_icelandic_ci", false],
|
155
|
+
[130, "ucs2", "ucs2_latvian_ci", false],
|
156
|
+
[131, "ucs2", "ucs2_romanian_ci", false],
|
157
|
+
[132, "ucs2", "ucs2_slovenian_ci", false],
|
158
|
+
[133, "ucs2", "ucs2_polish_ci", false],
|
159
|
+
[134, "ucs2", "ucs2_estonian_ci", false],
|
160
|
+
[135, "ucs2", "ucs2_spanish_ci", false],
|
161
|
+
[136, "ucs2", "ucs2_swedish_ci", false],
|
162
|
+
[137, "ucs2", "ucs2_turkish_ci", false],
|
163
|
+
[138, "ucs2", "ucs2_czech_ci", false],
|
164
|
+
[139, "ucs2", "ucs2_danish_ci", false],
|
165
|
+
[140, "ucs2", "ucs2_lithuanian_ci", false],
|
166
|
+
[141, "ucs2", "ucs2_slovak_ci", false],
|
167
|
+
[142, "ucs2", "ucs2_spanish2_ci", false],
|
168
|
+
[143, "ucs2", "ucs2_roman_ci", false],
|
169
|
+
[144, "ucs2", "ucs2_persian_ci", false],
|
170
|
+
[145, "ucs2", "ucs2_esperanto_ci", false],
|
171
|
+
[146, "ucs2", "ucs2_hungarian_ci", false],
|
172
|
+
[147, "ucs2", "ucs2_sinhala_ci", false],
|
173
|
+
[148, "ucs2", "ucs2_german2_ci", false],
|
174
|
+
[149, "ucs2", "ucs2_croatian_ci", false],
|
175
|
+
[150, "ucs2", "ucs2_unicode_520_ci", false],
|
176
|
+
[151, "ucs2", "ucs2_vietnamese_ci", false],
|
177
|
+
[159, "ucs2", "ucs2_general_mysql500_ci", false],
|
178
|
+
[160, "utf32", "utf32_unicode_ci", false],
|
179
|
+
[161, "utf32", "utf32_icelandic_ci", false],
|
180
|
+
[162, "utf32", "utf32_latvian_ci", false],
|
181
|
+
[163, "utf32", "utf32_romanian_ci", false],
|
182
|
+
[164, "utf32", "utf32_slovenian_ci", false],
|
183
|
+
[165, "utf32", "utf32_polish_ci", false],
|
184
|
+
[166, "utf32", "utf32_estonian_ci", false],
|
185
|
+
[167, "utf32", "utf32_spanish_ci", false],
|
186
|
+
[168, "utf32", "utf32_swedish_ci", false],
|
187
|
+
[169, "utf32", "utf32_turkish_ci", false],
|
188
|
+
[170, "utf32", "utf32_czech_ci", false],
|
189
|
+
[171, "utf32", "utf32_danish_ci", false],
|
190
|
+
[172, "utf32", "utf32_lithuanian_ci", false],
|
191
|
+
[173, "utf32", "utf32_slovak_ci", false],
|
192
|
+
[174, "utf32", "utf32_spanish2_ci", false],
|
193
|
+
[175, "utf32", "utf32_roman_ci", false],
|
194
|
+
[176, "utf32", "utf32_persian_ci", false],
|
195
|
+
[177, "utf32", "utf32_esperanto_ci", false],
|
196
|
+
[178, "utf32", "utf32_hungarian_ci", false],
|
197
|
+
[179, "utf32", "utf32_sinhala_ci", false],
|
198
|
+
[180, "utf32", "utf32_german2_ci", false],
|
199
|
+
[181, "utf32", "utf32_croatian_ci", false],
|
200
|
+
[182, "utf32", "utf32_unicode_520_ci", false],
|
201
|
+
[183, "utf32", "utf32_vietnamese_ci", false],
|
202
|
+
[192, "utf8", "utf8_unicode_ci", false],
|
203
|
+
[193, "utf8", "utf8_icelandic_ci", false],
|
204
|
+
[194, "utf8", "utf8_latvian_ci", false],
|
205
|
+
[195, "utf8", "utf8_romanian_ci", false],
|
206
|
+
[196, "utf8", "utf8_slovenian_ci", false],
|
207
|
+
[197, "utf8", "utf8_polish_ci", false],
|
208
|
+
[198, "utf8", "utf8_estonian_ci", false],
|
209
|
+
[199, "utf8", "utf8_spanish_ci", false],
|
210
|
+
[200, "utf8", "utf8_swedish_ci", false],
|
211
|
+
[201, "utf8", "utf8_turkish_ci", false],
|
212
|
+
[202, "utf8", "utf8_czech_ci", false],
|
213
|
+
[203, "utf8", "utf8_danish_ci", false],
|
214
|
+
[204, "utf8", "utf8_lithuanian_ci", false],
|
215
|
+
[205, "utf8", "utf8_slovak_ci", false],
|
216
|
+
[206, "utf8", "utf8_spanish2_ci", false],
|
217
|
+
[207, "utf8", "utf8_roman_ci", false],
|
218
|
+
[208, "utf8", "utf8_persian_ci", false],
|
219
|
+
[209, "utf8", "utf8_esperanto_ci", false],
|
220
|
+
[210, "utf8", "utf8_hungarian_ci", false],
|
221
|
+
[211, "utf8", "utf8_sinhala_ci", false],
|
222
|
+
[212, "utf8", "utf8_german2_ci", false],
|
223
|
+
[213, "utf8", "utf8_croatian_ci", false],
|
224
|
+
[214, "utf8", "utf8_unicode_520_ci", false],
|
225
|
+
[215, "utf8", "utf8_vietnamese_ci", false],
|
226
|
+
[223, "utf8", "utf8_general_mysql500_ci", false],
|
227
|
+
[224, "utf8mb4", "utf8mb4_unicode_ci", false],
|
228
|
+
[225, "utf8mb4", "utf8mb4_icelandic_ci", false],
|
229
|
+
[226, "utf8mb4", "utf8mb4_latvian_ci", false],
|
230
|
+
[227, "utf8mb4", "utf8mb4_romanian_ci", false],
|
231
|
+
[228, "utf8mb4", "utf8mb4_slovenian_ci", false],
|
232
|
+
[229, "utf8mb4", "utf8mb4_polish_ci", false],
|
233
|
+
[230, "utf8mb4", "utf8mb4_estonian_ci", false],
|
234
|
+
[231, "utf8mb4", "utf8mb4_spanish_ci", false],
|
235
|
+
[232, "utf8mb4", "utf8mb4_swedish_ci", false],
|
236
|
+
[233, "utf8mb4", "utf8mb4_turkish_ci", false],
|
237
|
+
[234, "utf8mb4", "utf8mb4_czech_ci", false],
|
238
|
+
[235, "utf8mb4", "utf8mb4_danish_ci", false],
|
239
|
+
[236, "utf8mb4", "utf8mb4_lithuanian_ci", false],
|
240
|
+
[237, "utf8mb4", "utf8mb4_slovak_ci", false],
|
241
|
+
[238, "utf8mb4", "utf8mb4_spanish2_ci", false],
|
242
|
+
[239, "utf8mb4", "utf8mb4_roman_ci", false],
|
243
|
+
[240, "utf8mb4", "utf8mb4_persian_ci", false],
|
244
|
+
[241, "utf8mb4", "utf8mb4_esperanto_ci", false],
|
245
|
+
[242, "utf8mb4", "utf8mb4_hungarian_ci", false],
|
246
|
+
[243, "utf8mb4", "utf8mb4_sinhala_ci", false],
|
247
|
+
[244, "utf8mb4", "utf8mb4_german2_ci", false],
|
248
|
+
[245, "utf8mb4", "utf8mb4_croatian_ci", false],
|
249
|
+
[246, "utf8mb4", "utf8mb4_unicode_520_ci", false],
|
250
|
+
[247, "utf8mb4", "utf8mb4_vietnamese_ci", false],
|
251
|
+
[248, "gb18030", "gb18030_chinese_ci", true ],
|
252
|
+
[249, "gb18030", "gb18030_bin", false],
|
253
|
+
[250, "gb18030", "gb18030_unicode_520_ci", false],
|
254
|
+
[254, "utf8", "utf8_general_cs", false],
|
183
255
|
]
|
184
256
|
|
185
257
|
# @private
|
data/lib/mysql/constants.rb
CHANGED
@@ -33,26 +33,38 @@ class Mysql
|
|
33
33
|
COM_STMT_RESET = 26
|
34
34
|
COM_SET_OPTION = 27
|
35
35
|
COM_STMT_FETCH = 28
|
36
|
+
COM_DAEMON = 29
|
37
|
+
COM_BINLOG_DUMP_GTID = 30
|
38
|
+
COM_RESET_CONNECTION = 31
|
36
39
|
|
37
40
|
# Client flag
|
38
|
-
CLIENT_LONG_PASSWORD
|
39
|
-
CLIENT_FOUND_ROWS
|
40
|
-
CLIENT_LONG_FLAG
|
41
|
-
CLIENT_CONNECT_WITH_DB
|
42
|
-
CLIENT_NO_SCHEMA
|
43
|
-
CLIENT_COMPRESS
|
44
|
-
CLIENT_ODBC
|
45
|
-
CLIENT_LOCAL_FILES
|
46
|
-
CLIENT_IGNORE_SPACE
|
47
|
-
CLIENT_PROTOCOL_41
|
48
|
-
CLIENT_INTERACTIVE
|
49
|
-
CLIENT_SSL
|
50
|
-
CLIENT_IGNORE_SIGPIPE
|
51
|
-
CLIENT_TRANSACTIONS
|
52
|
-
CLIENT_RESERVED
|
53
|
-
CLIENT_SECURE_CONNECTION
|
54
|
-
CLIENT_MULTI_STATEMENTS
|
55
|
-
CLIENT_MULTI_RESULTS
|
41
|
+
CLIENT_LONG_PASSWORD = 1 # new more secure passwords
|
42
|
+
CLIENT_FOUND_ROWS = 1 << 1 # Found instead of affected rows
|
43
|
+
CLIENT_LONG_FLAG = 1 << 2 # Get all column flags
|
44
|
+
CLIENT_CONNECT_WITH_DB = 1 << 3 # One can specify db on connect
|
45
|
+
CLIENT_NO_SCHEMA = 1 << 4 # Don't allow database.table.column
|
46
|
+
CLIENT_COMPRESS = 1 << 5 # Can use compression protocol
|
47
|
+
CLIENT_ODBC = 1 << 6 # Odbc client
|
48
|
+
CLIENT_LOCAL_FILES = 1 << 7 # Can use LOAD DATA LOCAL
|
49
|
+
CLIENT_IGNORE_SPACE = 1 << 8 # Ignore spaces before '('
|
50
|
+
CLIENT_PROTOCOL_41 = 1 << 9 # New 4.1 protocol
|
51
|
+
CLIENT_INTERACTIVE = 1 << 10 # This is an interactive client
|
52
|
+
CLIENT_SSL = 1 << 11 # Switch to SSL after handshake
|
53
|
+
CLIENT_IGNORE_SIGPIPE = 1 << 12 # IGNORE sigpipes
|
54
|
+
CLIENT_TRANSACTIONS = 1 << 13 # Client knows about transactions
|
55
|
+
CLIENT_RESERVED = 1 << 14 # Old flag for 4.1 protocol
|
56
|
+
CLIENT_SECURE_CONNECTION = 1 << 15 # New 4.1 authentication
|
57
|
+
CLIENT_MULTI_STATEMENTS = 1 << 16 # Enable/disable multi-stmt support
|
58
|
+
CLIENT_MULTI_RESULTS = 1 << 17 # Enable/disable multi-results
|
59
|
+
CLIENT_PS_MULTI_RESULTS = 1 << 18 # Multi-results in PS-protocol
|
60
|
+
CLIENT_PLUGIN_AUTH = 1 << 19 # Client supports plugin authentication
|
61
|
+
CLIENT_CONNECT_ATTRS = 1 << 20 # Client supports connection attribute
|
62
|
+
CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA = 1 << 21 # Enable authentication response packet to be larger than 255 bytes.
|
63
|
+
CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS = 1 << 22 # Don't close the connection for a connection with expired password.
|
64
|
+
CLIENT_SESSION_TRACK = 1 << 23 # Capable of handling server state change information. Its a hint to the server to include the state change information in Ok packet.
|
65
|
+
CLIENT_DEPRECATE_EOF = 1 << 24 # Client no longer needs EOF packet
|
66
|
+
CLIENT_SSL_VERIFY_SERVER_CERT = 1 << 30
|
67
|
+
CLIENT_REMEMBER_OPTIONS = 1 << 31
|
56
68
|
|
57
69
|
# Connection Option
|
58
70
|
OPT_CONNECT_TIMEOUT = 0
|
@@ -92,18 +104,35 @@ class Mysql
|
|
92
104
|
SERVER_STATUS_LAST_ROW_SENT = 1 << 7
|
93
105
|
SERVER_STATUS_DB_DROPPED = 1 << 8
|
94
106
|
SERVER_STATUS_NO_BACKSLASH_ESCAPES = 1 << 9
|
107
|
+
SERVER_STATUS_METADATA_CHANGED = 1 << 10
|
108
|
+
SERVER_QUERY_WAS_SLOW = 1 << 11
|
109
|
+
SERVER_PS_OUT_PARAMS = 1 << 12
|
110
|
+
SERVER_STATUS_IN_TRANS_READONLY = 1 << 13
|
111
|
+
SERVER_SESSION_STATE_CHANGED = 1 << 14
|
95
112
|
|
96
113
|
# Refresh parameter
|
97
|
-
REFRESH_GRANT
|
98
|
-
REFRESH_LOG
|
99
|
-
REFRESH_TABLES
|
100
|
-
REFRESH_HOSTS
|
101
|
-
REFRESH_STATUS
|
102
|
-
REFRESH_THREADS
|
103
|
-
REFRESH_SLAVE
|
104
|
-
REFRESH_MASTER
|
105
|
-
|
106
|
-
|
114
|
+
REFRESH_GRANT = 1
|
115
|
+
REFRESH_LOG = 1 << 1
|
116
|
+
REFRESH_TABLES = 1 << 2
|
117
|
+
REFRESH_HOSTS = 1 << 3
|
118
|
+
REFRESH_STATUS = 1 << 4
|
119
|
+
REFRESH_THREADS = 1 << 5
|
120
|
+
REFRESH_SLAVE = 1 << 6
|
121
|
+
REFRESH_MASTER = 1 << 7
|
122
|
+
REFRESH_ERROR_LOG = 1 << 8
|
123
|
+
REFRESH_ENGINE_LOG = 1 << 9
|
124
|
+
REFRESH_BINARY_LOG = 1 << 10
|
125
|
+
REFRESH_RELAY_LOG = 1 << 11
|
126
|
+
REFRESH_GENERAL_LOG = 1 << 12
|
127
|
+
REFRESH_SLOW_LOG = 1 << 13
|
128
|
+
REFRESH_READ_LOCK = 1 << 14
|
129
|
+
REFRESH_FAST = 1 << 15
|
130
|
+
REFRESH_QUERY_CACHE = 1 << 16
|
131
|
+
REFRESH_QUERY_CACHE_FREE = 1 << 17
|
132
|
+
REFRESH_DES_KEY_FILE = 1 << 18
|
133
|
+
REFRESH_USER_RESOURCES = 1 << 19
|
134
|
+
REFRESH_FOR_EXPORT = 1 << 20
|
135
|
+
REFRESH_OPTIMIZER_COSTS = 1 << 21
|
107
136
|
|
108
137
|
class Field
|
109
138
|
# Field type
|
@@ -124,6 +153,10 @@ class Mysql
|
|
124
153
|
TYPE_NEWDATE = 14
|
125
154
|
TYPE_VARCHAR = 15
|
126
155
|
TYPE_BIT = 16
|
156
|
+
TYPE_TIMESTAMP2 = 17
|
157
|
+
TYPE_DATETIME2 = 18
|
158
|
+
TYPE_TIME2 = 19
|
159
|
+
TYPE_JSON = 245
|
127
160
|
TYPE_NEWDECIMAL = 246
|
128
161
|
TYPE_ENUM = 247
|
129
162
|
TYPE_SET = 248
|
@@ -138,28 +171,32 @@ class Mysql
|
|
138
171
|
TYPE_INTERVAL = TYPE_ENUM
|
139
172
|
|
140
173
|
# Flag
|
141
|
-
NOT_NULL_FLAG
|
142
|
-
PRI_KEY_FLAG
|
143
|
-
UNIQUE_KEY_FLAG
|
144
|
-
MULTIPLE_KEY_FLAG
|
145
|
-
BLOB_FLAG
|
146
|
-
UNSIGNED_FLAG
|
147
|
-
ZEROFILL_FLAG
|
148
|
-
BINARY_FLAG
|
149
|
-
ENUM_FLAG
|
150
|
-
AUTO_INCREMENT_FLAG
|
151
|
-
TIMESTAMP_FLAG
|
152
|
-
SET_FLAG
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
174
|
+
NOT_NULL_FLAG = 1
|
175
|
+
PRI_KEY_FLAG = 2
|
176
|
+
UNIQUE_KEY_FLAG = 4
|
177
|
+
MULTIPLE_KEY_FLAG = 8
|
178
|
+
BLOB_FLAG = 16
|
179
|
+
UNSIGNED_FLAG = 32
|
180
|
+
ZEROFILL_FLAG = 64
|
181
|
+
BINARY_FLAG = 128
|
182
|
+
ENUM_FLAG = 256
|
183
|
+
AUTO_INCREMENT_FLAG = 512
|
184
|
+
TIMESTAMP_FLAG = 1024
|
185
|
+
SET_FLAG = 2048
|
186
|
+
NO_DEFAULT_VALUE_FLAG = 4096
|
187
|
+
ON_UPDATE_NOW_FLAG = 8192
|
188
|
+
NUM_FLAG = 32768
|
189
|
+
PART_KEY_FLAG = 16384
|
190
|
+
GROUP_FLAG = 32768
|
191
|
+
UNIQUE_FLAG = 65536
|
192
|
+
BINCMP_FLAG = 131072
|
158
193
|
end
|
159
194
|
|
160
195
|
class Stmt
|
161
196
|
# Cursor type
|
162
|
-
CURSOR_TYPE_NO_CURSOR
|
163
|
-
CURSOR_TYPE_READ_ONLY
|
197
|
+
CURSOR_TYPE_NO_CURSOR = 0
|
198
|
+
CURSOR_TYPE_READ_ONLY = 1
|
199
|
+
CURSOR_TYPE_FOR_UPDATE = 2
|
200
|
+
CURSOR_TYPE_SCROLLABLE = 4
|
164
201
|
end
|
165
202
|
end
|
data/lib/mysql/protocol.rb
CHANGED
@@ -23,7 +23,7 @@ class Mysql
|
|
23
23
|
# Object :: converted value.
|
24
24
|
def self.net2value(pkt, type, unsigned)
|
25
25
|
case type
|
26
|
-
when Field::TYPE_STRING, Field::TYPE_VAR_STRING, Field::TYPE_NEWDECIMAL, Field::TYPE_BLOB
|
26
|
+
when Field::TYPE_STRING, Field::TYPE_VAR_STRING, Field::TYPE_NEWDECIMAL, Field::TYPE_BLOB, Field::TYPE_JSON
|
27
27
|
return pkt.lcs
|
28
28
|
when Field::TYPE_TINY
|
29
29
|
v = pkt.utiny
|
@@ -584,7 +584,7 @@ class Mysql
|
|
584
584
|
server_capabilities = pkt.ushort
|
585
585
|
server_charset = pkt.utiny
|
586
586
|
server_status = pkt.ushort
|
587
|
-
|
587
|
+
_f1 = pkt.read(13)
|
588
588
|
rest_scramble_buff = pkt.string
|
589
589
|
raise ProtocolError, "unsupported version: #{protocol_version}" unless protocol_version == VERSION
|
590
590
|
raise ProtocolError, "invalid packet: f0=#{f0}" unless f0 == 0
|
@@ -627,13 +627,13 @@ class Mysql
|
|
627
627
|
# Field packet
|
628
628
|
class FieldPacket
|
629
629
|
def self.parse(pkt)
|
630
|
-
|
630
|
+
_first = pkt.lcs
|
631
631
|
db = pkt.lcs
|
632
632
|
table = pkt.lcs
|
633
633
|
org_table = pkt.lcs
|
634
634
|
name = pkt.lcs
|
635
635
|
org_name = pkt.lcs
|
636
|
-
|
636
|
+
_f0 = pkt.utiny
|
637
637
|
charsetnr = pkt.ushort
|
638
638
|
length = pkt.ulong
|
639
639
|
type = pkt.utiny
|
data/test/test_mysql.rb
CHANGED
@@ -537,6 +537,10 @@ class TestMysql < Test::Unit::TestCase
|
|
537
537
|
end
|
538
538
|
|
539
539
|
sub_test_case '#warning_count' do
|
540
|
+
setup do
|
541
|
+
@m.query("set sql_mode=''")
|
542
|
+
@m.query("set sql_mode=''") # clear warnings on previous `set' statement.
|
543
|
+
end
|
540
544
|
test 'default values is zero' do
|
541
545
|
assert{ @m.warning_count == 0 }
|
542
546
|
end
|
@@ -683,7 +687,7 @@ class TestMysql < Test::Unit::TestCase
|
|
683
687
|
setup do
|
684
688
|
@m = Mysql.new(MYSQL_SERVER, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE, MYSQL_PORT, MYSQL_SOCKET)
|
685
689
|
@m.charset = 'latin1'
|
686
|
-
@m.query 'create temporary table t (id int, str char(10), primary key (id))'
|
690
|
+
@m.query 'create temporary table t (id int default 0, str char(10), primary key (id))'
|
687
691
|
@m.query "insert into t values (1,'abc'),(2,'defg'),(3,'hi'),(4,null)"
|
688
692
|
@res = @m.query 'select * from t'
|
689
693
|
end
|
@@ -707,7 +711,7 @@ class TestMysql < Test::Unit::TestCase
|
|
707
711
|
assert{ f.def == nil }
|
708
712
|
assert{ f.type == Mysql::Field::TYPE_LONG }
|
709
713
|
assert{ f.length == 11 }
|
710
|
-
f.max_length == 1
|
714
|
+
assert{ f.max_length == 1 }
|
711
715
|
assert{ f.flags == Mysql::Field::NUM_FLAG|Mysql::Field::PRI_KEY_FLAG|Mysql::Field::PART_KEY_FLAG|Mysql::Field::NOT_NULL_FLAG }
|
712
716
|
assert{ f.decimals == 0 }
|
713
717
|
|
@@ -717,7 +721,7 @@ class TestMysql < Test::Unit::TestCase
|
|
717
721
|
assert{ f.def == nil }
|
718
722
|
assert{ f.type == Mysql::Field::TYPE_STRING }
|
719
723
|
assert{ f.length == 10 }
|
720
|
-
f.max_length == 4
|
724
|
+
assert{ f.max_length == 4 }
|
721
725
|
assert{ f.flags == 0 }
|
722
726
|
assert{ f.decimals == 0 }
|
723
727
|
|
@@ -955,6 +959,7 @@ class TestMysql < Test::Unit::TestCase
|
|
955
959
|
sub_test_case 'Mysql::Stmt' do
|
956
960
|
setup do
|
957
961
|
@m = Mysql.new(MYSQL_SERVER, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE, MYSQL_PORT, MYSQL_SOCKET)
|
962
|
+
@m.query("set sql_mode=''")
|
958
963
|
@s = @m.stmt_init
|
959
964
|
end
|
960
965
|
|
@@ -1559,6 +1564,16 @@ class TestMysql < Test::Unit::TestCase
|
|
1559
1564
|
assert{ @s.entries == [[nil], [''], ['abc'], ['def'], ['abc,def'], ['abc'], ['def'], ['abc,def'], ['']] }
|
1560
1565
|
end
|
1561
1566
|
|
1567
|
+
test '#fetch json column' do
|
1568
|
+
if @m.server_version >= 50700
|
1569
|
+
@m.query "create temporary table t (i json)"
|
1570
|
+
@m.query "insert into t values ('123'),('{\"a\":1,\"b\":2,\"c\":3}'),('[1,2,3]')"
|
1571
|
+
@s.prepare 'select i from t'
|
1572
|
+
@s.execute
|
1573
|
+
assert{ @s.entries == [['123'], ['{"a": 1, "b": 2, "c": 3}'], ['[1, 2, 3]']] }
|
1574
|
+
end
|
1575
|
+
end
|
1576
|
+
|
1562
1577
|
test '#field_count' do
|
1563
1578
|
@s.prepare 'select 1,2,3'
|
1564
1579
|
assert{ @s.field_count == 3 }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-mysql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.9.
|
4
|
+
version: 2.9.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomita Masahiro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This is MySQL connector. pure Ruby version
|
14
14
|
email: tommy@tmtm.org
|
@@ -28,7 +28,7 @@ files:
|
|
28
28
|
- test/test_mysql_packet.rb
|
29
29
|
homepage: http://github.com/tmtm/ruby-mysql
|
30
30
|
licenses:
|
31
|
-
- Ruby
|
31
|
+
- Ruby
|
32
32
|
metadata: {}
|
33
33
|
post_install_message:
|
34
34
|
rdoc_options: []
|
@@ -46,7 +46,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
46
|
version: '0'
|
47
47
|
requirements: []
|
48
48
|
rubyforge_project:
|
49
|
-
rubygems_version: 2.
|
49
|
+
rubygems_version: 2.5.1
|
50
50
|
signing_key:
|
51
51
|
specification_version: 4
|
52
52
|
summary: MySQL connector
|