ruby-mysql 2.9.3 → 2.9.4

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.

data/ChangeLog CHANGED
@@ -1,3 +1,30 @@
1
+ 2011-01-02 TOMITA Masahiro <tommy@tmtm.org>
2
+
3
+ * .autotest, .rspec: for autotest.
4
+
5
+ 2010-12-31 TOMITA Masahiro <tommy@tmtm.org>
6
+
7
+ * lib/mysql.rb: add Mysql#close! method.
8
+
9
+ 2010-12-30 TOMITA Masahiro <tommy@tmtm.org>
10
+
11
+ * lib/mysql/protocol.rb: raise ClientError::ServerGoneError when
12
+ connection is disconnected.
13
+
14
+ 2010-12-29 TOMITA Masahiro <tommy@tmtm.org>
15
+
16
+ * lib/mysql/error.rb: add Mysql::ServerError::<Error> and
17
+ Mysql::ClientError::<Error> class.
18
+
19
+ * spec/mysql_spec.rb: for RSpec 2
20
+
21
+ * lib/mysql/charset.rb: add utf8mb4 charset.
22
+
23
+ 2010-12-19 TOMITA Masahiro <tommy@tmtm.org>
24
+
25
+ * lib/mysql/protocol.rb: Fix: error 'Mysql::ProtocolError Invalid
26
+ packet: f1...' occurred on MySQL 5.5
27
+
1
28
  2010-06-06 TOMITA Masahiro <tommy@tmtm.org>
2
29
 
3
30
  * lib/mysql/charset.rb: support tis620 charset.
data/README.rdoc CHANGED
@@ -10,7 +10,7 @@ MySQL connector for Ruby.
10
10
 
11
11
  === Gem Installation
12
12
 
13
- gem install ruby-mysql-v 2.9.2
13
+ gem install ruby-mysql
14
14
 
15
15
  == Features/Problems
16
16
 
@@ -59,7 +59,7 @@ MySQL connector for Ruby.
59
59
 
60
60
  * Mysql#charset= で接続 charset を指定できます。
61
61
 
62
- * Mysql::Error だけでなく、エラー種別ごとにエラークラスが用意されてます。たとえば、構文エラーの場合は Mysql::ParseError など。これらのエラーは Mysql::Error の継承クラスです。
62
+ * Mysql::Error だけでなく、エラー種別ごとにエラークラスが用意されてます。たとえば、構文エラーの場合は Mysql::ServerError::ParseError など。これらのエラーは Mysql::Error の継承クラスです。
63
63
 
64
64
  == Copyright
65
65
 
data/lib/mysql/charset.rb CHANGED
@@ -14,135 +14,156 @@ class Mysql
14
14
 
15
15
  # [[charset_number, charset_name, collation_name, default], ...]
16
16
  CHARSETS = [
17
- [ 1, "big5", "big5_chinese_ci", true ],
18
- [ 2, "latin2", "latin2_czech_cs", false],
19
- [ 3, "dec8", "dec8_swedish_ci", true ],
20
- [ 4, "cp850", "cp850_general_ci", true ],
21
- [ 5, "latin1", "latin1_german1_ci", false],
22
- [ 6, "hp8", "hp8_english_ci", true ],
23
- [ 7, "koi8r", "koi8r_general_ci", true ],
24
- [ 8, "latin1", "latin1_swedish_ci", true ],
25
- [ 9, "latin2", "latin2_general_ci", true ],
26
- [ 10, "swe7", "swe7_swedish_ci", true ],
27
- [ 11, "ascii", "ascii_general_ci", true ],
28
- [ 12, "ujis", "ujis_japanese_ci", true ],
29
- [ 13, "sjis", "sjis_japanese_ci", true ],
30
- [ 14, "cp1251", "cp1251_bulgarian_ci", false],
31
- [ 15, "latin1", "latin1_danish_ci", false],
32
- [ 16, "hebrew", "hebrew_general_ci", true ],
33
- [ 17, "filename", "filename", true ],
34
- [ 18, "tis620", "tis620_thai_ci", true ],
35
- [ 19, "euckr", "euckr_korean_ci", true ],
36
- [ 20, "latin7", "latin7_estonian_cs", false],
37
- [ 21, "latin2", "latin2_hungarian_ci", false],
38
- [ 22, "koi8u", "koi8u_general_ci", true ],
39
- [ 23, "cp1251", "cp1251_ukrainian_ci", false],
40
- [ 24, "gb2312", "gb2312_chinese_ci", true ],
41
- [ 25, "greek", "greek_general_ci", true ],
42
- [ 26, "cp1250", "cp1250_general_ci", true ],
43
- [ 27, "latin2", "latin2_croatian_ci", false],
44
- [ 28, "gbk", "gbk_chinese_ci", true ],
45
- [ 29, "cp1257", "cp1257_lithuanian_ci", false],
46
- [ 30, "latin5", "latin5_turkish_ci", true ],
47
- [ 31, "latin1", "latin1_german2_ci", false],
48
- [ 32, "armscii8", "armscii8_general_ci", true ],
49
- [ 33, "utf8", "utf8_general_ci", true ],
50
- [ 34, "cp1250", "cp1250_czech_cs", false],
51
- [ 35, "ucs2", "ucs2_general_ci", true ],
52
- [ 36, "cp866", "cp866_general_ci", true ],
53
- [ 37, "keybcs2", "keybcs2_general_ci", true ],
54
- [ 38, "macce", "macce_general_ci", true ],
55
- [ 39, "macroman", "macroman_general_ci", true ],
56
- [ 40, "cp852", "cp852_general_ci", true ],
57
- [ 41, "latin7", "latin7_general_ci", true ],
58
- [ 42, "latin7", "latin7_general_cs", false],
59
- [ 43, "macce", "macce_bin", false],
60
- [ 44, "cp1250", "cp1250_croatian_ci", false],
61
- [ 47, "latin1", "latin1_bin", false],
62
- [ 48, "latin1", "latin1_general_ci", false],
63
- [ 49, "latin1", "latin1_general_cs", false],
64
- [ 50, "cp1251", "cp1251_bin", false],
65
- [ 51, "cp1251", "cp1251_general_ci", true ],
66
- [ 52, "cp1251", "cp1251_general_cs", false],
67
- [ 53, "macroman", "macroman_bin", false],
68
- [ 57, "cp1256", "cp1256_general_ci", true ],
69
- [ 58, "cp1257", "cp1257_bin", false],
70
- [ 59, "cp1257", "cp1257_general_ci", true ],
71
- [ 63, "binary", "binary", true ],
72
- [ 64, "armscii8", "armscii8_bin", false],
73
- [ 65, "ascii", "ascii_bin", false],
74
- [ 66, "cp1250", "cp1250_bin", false],
75
- [ 67, "cp1256", "cp1256_bin", false],
76
- [ 68, "cp866", "cp866_bin", false],
77
- [ 69, "dec8", "dec8_bin", false],
78
- [ 70, "greek", "greek_bin", false],
79
- [ 71, "hebrew", "hebrew_bin", false],
80
- [ 72, "hp8", "hp8_bin", false],
81
- [ 73, "keybcs2", "keybcs2_bin", false],
82
- [ 74, "koi8r", "koi8r_bin", false],
83
- [ 75, "koi8u", "koi8u_bin", false],
84
- [ 77, "latin2", "latin2_bin", false],
85
- [ 78, "latin5", "latin5_bin", false],
86
- [ 79, "latin7", "latin7_bin", false],
87
- [ 80, "cp850", "cp850_bin", false],
88
- [ 81, "cp852", "cp852_bin", false],
89
- [ 82, "swe7", "swe7_bin", false],
90
- [ 83, "utf8", "utf8_bin", false],
91
- [ 84, "big5", "big5_bin", false],
92
- [ 85, "euckr", "euckr_bin", false],
93
- [ 86, "gb2312", "gb2312_bin", false],
94
- [ 87, "gbk", "gbk_bin", false],
95
- [ 88, "sjis", "sjis_bin", false],
96
- [ 89, "tis620", "tis620_bin", false],
97
- [ 90, "ucs2", "ucs2_bin", false],
98
- [ 91, "ujis", "ujis_bin", false],
99
- [ 92, "geostd8", "geostd8_general_ci", true ],
100
- [ 93, "geostd8", "geostd8_bin", false],
101
- [ 94, "latin1", "latin1_spanish_ci", false],
102
- [ 95, "cp932", "cp932_japanese_ci" , true ],
103
- [ 96, "cp932", "cp932_bin" , false],
104
- [ 97, "eucjpms", "eucjpms_japanese_ci", true ],
105
- [ 98, "eucjpms", "eucjpms_bin", false],
106
- [ 99, "cp1250", "cp1250_polish_ci", false],
107
- [128, "ucs2", "ucs2_unicode_ci", false],
108
- [129, "ucs2", "ucs2_icelandic_ci", false],
109
- [130, "ucs2", "ucs2_latvian_ci", false],
110
- [131, "ucs2", "ucs2_romanian_ci", false],
111
- [132, "ucs2", "ucs2_slovenian_ci", false],
112
- [133, "ucs2", "ucs2_polish_ci", false],
113
- [134, "ucs2", "ucs2_estonian_ci", false],
114
- [135, "ucs2", "ucs2_spanish_ci", false],
115
- [136, "ucs2", "ucs2_swedish_ci", false],
116
- [137, "ucs2", "ucs2_turkish_ci", false],
117
- [138, "ucs2", "ucs2_czech_ci", false],
118
- [139, "ucs2", "ucs2_danish_ci", false],
119
- [140, "ucs2", "ucs2_lithuanian_ci", false],
120
- [141, "ucs2", "ucs2_slovak_ci", false],
121
- [142, "ucs2", "ucs2_spanish2_ci", false],
122
- [143, "ucs2", "ucs2_roman_ci", false],
123
- [144, "ucs2", "ucs2_persian_ci", false],
124
- [145, "ucs2", "ucs2_esperanto_ci", false],
125
- [146, "ucs2", "ucs2_hungarian_ci", false],
126
- [192, "utf8", "utf8_unicode_ci", false],
127
- [193, "utf8", "utf8_icelandic_ci", false],
128
- [194, "utf8", "utf8_latvian_ci", false],
129
- [195, "utf8", "utf8_romanian_ci", false],
130
- [196, "utf8", "utf8_slovenian_ci", false],
131
- [197, "utf8", "utf8_polish_ci", false],
132
- [198, "utf8", "utf8_estonian_ci", false],
133
- [199, "utf8", "utf8_spanish_ci", false],
134
- [200, "utf8", "utf8_swedish_ci", false],
135
- [201, "utf8", "utf8_turkish_ci", false],
136
- [202, "utf8", "utf8_czech_ci", false],
137
- [203, "utf8", "utf8_danish_ci", false],
138
- [204, "utf8", "utf8_lithuanian_ci", false],
139
- [205, "utf8", "utf8_slovak_ci", false],
140
- [206, "utf8", "utf8_spanish2_ci", false],
141
- [207, "utf8", "utf8_roman_ci", false],
142
- [208, "utf8", "utf8_persian_ci", false],
143
- [209, "utf8", "utf8_esperanto_ci", false],
144
- [210, "utf8", "utf8_hungarian_ci", false],
145
- [254, "utf8", "utf8_general_cs", false],
17
+ [ 1, "big5", "big5_chinese_ci", true ],
18
+ [ 2, "latin2", "latin2_czech_cs", false],
19
+ [ 3, "dec8", "dec8_swedish_ci", true ],
20
+ [ 4, "cp850", "cp850_general_ci", true ],
21
+ [ 5, "latin1", "latin1_german1_ci", false],
22
+ [ 6, "hp8", "hp8_english_ci", true ],
23
+ [ 7, "koi8r", "koi8r_general_ci", true ],
24
+ [ 8, "latin1", "latin1_swedish_ci", true ],
25
+ [ 9, "latin2", "latin2_general_ci", true ],
26
+ [ 10, "swe7", "swe7_swedish_ci", true ],
27
+ [ 11, "ascii", "ascii_general_ci", true ],
28
+ [ 12, "ujis", "ujis_japanese_ci", true ],
29
+ [ 13, "sjis", "sjis_japanese_ci", true ],
30
+ [ 14, "cp1251", "cp1251_bulgarian_ci", false],
31
+ [ 15, "latin1", "latin1_danish_ci", false],
32
+ [ 16, "hebrew", "hebrew_general_ci", true ],
33
+ [ 17, "filename", "filename", true ],
34
+ [ 18, "tis620", "tis620_thai_ci", true ],
35
+ [ 19, "euckr", "euckr_korean_ci", true ],
36
+ [ 20, "latin7", "latin7_estonian_cs", false],
37
+ [ 21, "latin2", "latin2_hungarian_ci", false],
38
+ [ 22, "koi8u", "koi8u_general_ci", true ],
39
+ [ 23, "cp1251", "cp1251_ukrainian_ci", false],
40
+ [ 24, "gb2312", "gb2312_chinese_ci", true ],
41
+ [ 25, "greek", "greek_general_ci", true ],
42
+ [ 26, "cp1250", "cp1250_general_ci", true ],
43
+ [ 27, "latin2", "latin2_croatian_ci", false],
44
+ [ 28, "gbk", "gbk_chinese_ci", true ],
45
+ [ 29, "cp1257", "cp1257_lithuanian_ci", false],
46
+ [ 30, "latin5", "latin5_turkish_ci", true ],
47
+ [ 31, "latin1", "latin1_german2_ci", false],
48
+ [ 32, "armscii8", "armscii8_general_ci", true ],
49
+ [ 33, "utf8", "utf8_general_ci", true ],
50
+ [ 34, "cp1250", "cp1250_czech_cs", false],
51
+ [ 35, "ucs2", "ucs2_general_ci", true ],
52
+ [ 36, "cp866", "cp866_general_ci", true ],
53
+ [ 37, "keybcs2", "keybcs2_general_ci", true ],
54
+ [ 38, "macce", "macce_general_ci", true ],
55
+ [ 39, "macroman", "macroman_general_ci", true ],
56
+ [ 40, "cp852", "cp852_general_ci", true ],
57
+ [ 41, "latin7", "latin7_general_ci", true ],
58
+ [ 42, "latin7", "latin7_general_cs", false],
59
+ [ 43, "macce", "macce_bin", false],
60
+ [ 44, "cp1250", "cp1250_croatian_ci", false],
61
+ [ 47, "latin1", "latin1_bin", false],
62
+ [ 48, "latin1", "latin1_general_ci", false],
63
+ [ 49, "latin1", "latin1_general_cs", false],
64
+ [ 50, "cp1251", "cp1251_bin", false],
65
+ [ 51, "cp1251", "cp1251_general_ci", true ],
66
+ [ 52, "cp1251", "cp1251_general_cs", false],
67
+ [ 53, "macroman", "macroman_bin", false],
68
+ [ 57, "cp1256", "cp1256_general_ci", true ],
69
+ [ 58, "cp1257", "cp1257_bin", false],
70
+ [ 59, "cp1257", "cp1257_general_ci", true ],
71
+ [ 63, "binary", "binary", true ],
72
+ [ 64, "armscii8", "armscii8_bin", false],
73
+ [ 65, "ascii", "ascii_bin", false],
74
+ [ 66, "cp1250", "cp1250_bin", false],
75
+ [ 67, "cp1256", "cp1256_bin", false],
76
+ [ 68, "cp866", "cp866_bin", false],
77
+ [ 69, "dec8", "dec8_bin", false],
78
+ [ 70, "greek", "greek_bin", false],
79
+ [ 71, "hebrew", "hebrew_bin", false],
80
+ [ 72, "hp8", "hp8_bin", false],
81
+ [ 73, "keybcs2", "keybcs2_bin", false],
82
+ [ 74, "koi8r", "koi8r_bin", false],
83
+ [ 75, "koi8u", "koi8u_bin", false],
84
+ [ 77, "latin2", "latin2_bin", false],
85
+ [ 78, "latin5", "latin5_bin", false],
86
+ [ 79, "latin7", "latin7_bin", false],
87
+ [ 80, "cp850", "cp850_bin", false],
88
+ [ 81, "cp852", "cp852_bin", false],
89
+ [ 82, "swe7", "swe7_bin", false],
90
+ [ 83, "utf8", "utf8_bin", false],
91
+ [ 84, "big5", "big5_bin", false],
92
+ [ 85, "euckr", "euckr_bin", false],
93
+ [ 86, "gb2312", "gb2312_bin", false],
94
+ [ 87, "gbk", "gbk_bin", false],
95
+ [ 88, "sjis", "sjis_bin", false],
96
+ [ 89, "tis620", "tis620_bin", false],
97
+ [ 90, "ucs2", "ucs2_bin", false],
98
+ [ 91, "ujis", "ujis_bin", false],
99
+ [ 92, "geostd8", "geostd8_general_ci", true ],
100
+ [ 93, "geostd8", "geostd8_bin", false],
101
+ [ 94, "latin1", "latin1_spanish_ci", false],
102
+ [ 95, "cp932", "cp932_japanese_ci", true ],
103
+ [ 96, "cp932", "cp932_bin", false],
104
+ [ 97, "eucjpms", "eucjpms_japanese_ci", true ],
105
+ [ 98, "eucjpms", "eucjpms_bin", false],
106
+ [ 99, "cp1250", "cp1250_polish_ci", false],
107
+ [128, "ucs2", "ucs2_unicode_ci", false],
108
+ [129, "ucs2", "ucs2_icelandic_ci", false],
109
+ [130, "ucs2", "ucs2_latvian_ci", false],
110
+ [131, "ucs2", "ucs2_romanian_ci", false],
111
+ [132, "ucs2", "ucs2_slovenian_ci", false],
112
+ [133, "ucs2", "ucs2_polish_ci", false],
113
+ [134, "ucs2", "ucs2_estonian_ci", false],
114
+ [135, "ucs2", "ucs2_spanish_ci", false],
115
+ [136, "ucs2", "ucs2_swedish_ci", false],
116
+ [137, "ucs2", "ucs2_turkish_ci", false],
117
+ [138, "ucs2", "ucs2_czech_ci", false],
118
+ [139, "ucs2", "ucs2_danish_ci", false],
119
+ [140, "ucs2", "ucs2_lithuanian_ci", false],
120
+ [141, "ucs2", "ucs2_slovak_ci", false],
121
+ [142, "ucs2", "ucs2_spanish2_ci", false],
122
+ [143, "ucs2", "ucs2_roman_ci", false],
123
+ [144, "ucs2", "ucs2_persian_ci", false],
124
+ [145, "ucs2", "ucs2_esperanto_ci", false],
125
+ [146, "ucs2", "ucs2_hungarian_ci", false],
126
+ [192, "utf8", "utf8_unicode_ci", false],
127
+ [193, "utf8", "utf8_icelandic_ci", false],
128
+ [194, "utf8", "utf8_latvian_ci", false],
129
+ [195, "utf8", "utf8_romanian_ci", false],
130
+ [196, "utf8", "utf8_slovenian_ci", false],
131
+ [197, "utf8", "utf8_polish_ci", false],
132
+ [198, "utf8", "utf8_estonian_ci", false],
133
+ [199, "utf8", "utf8_spanish_ci", false],
134
+ [200, "utf8", "utf8_swedish_ci", false],
135
+ [201, "utf8", "utf8_turkish_ci", false],
136
+ [202, "utf8", "utf8_czech_ci", false],
137
+ [203, "utf8", "utf8_danish_ci", false],
138
+ [204, "utf8", "utf8_lithuanian_ci", false],
139
+ [205, "utf8", "utf8_slovak_ci", false],
140
+ [206, "utf8", "utf8_spanish2_ci", false],
141
+ [207, "utf8", "utf8_roman_ci", false],
142
+ [208, "utf8", "utf8_persian_ci", false],
143
+ [209, "utf8", "utf8_esperanto_ci", false],
144
+ [210, "utf8", "utf8_hungarian_ci", false],
145
+ [211, "utf8", "utf8_sinhala_ci", false],
146
+ [224, "utf8mb4", "utf8mb4_unicode_ci", false],
147
+ [225, "utf8mb4", "utf8mb4_icelandic_ci", false],
148
+ [226, "utf8mb4", "utf8mb4_latvian_ci", false],
149
+ [227, "utf8mb4", "utf8mb4_romanian_ci", false],
150
+ [228, "utf8mb4", "utf8mb4_slovenian_ci", false],
151
+ [229, "utf8mb4", "utf8mb4_polish_ci", false],
152
+ [230, "utf8mb4", "utf8mb4_estonian_ci", false],
153
+ [231, "utf8mb4", "utf8mb4_spanish_ci", false],
154
+ [232, "utf8mb4", "utf8mb4_swedish_ci", false],
155
+ [233, "utf8mb4", "utf8mb4_turkish_ci", false],
156
+ [234, "utf8mb4", "utf8mb4_czech_ci", false],
157
+ [235, "utf8mb4", "utf8mb4_danish_ci", false],
158
+ [236, "utf8mb4", "utf8mb4_lithuanian_ci", false],
159
+ [237, "utf8mb4", "utf8mb4_slovak_ci", false],
160
+ [238, "utf8mb4", "utf8mb4_spanish2_ci", false],
161
+ [239, "utf8mb4", "utf8mb4_roman_ci", false],
162
+ [240, "utf8mb4", "utf8mb4_persian_ci", false],
163
+ [241, "utf8mb4", "utf8mb4_esperanto_ci", false],
164
+ [242, "utf8mb4", "utf8mb4_hungarian_ci", false],
165
+ [243, "utf8mb4", "utf8mb4_sinhala_ci", false],
166
+ [254, "utf8", "utf8_general_cs", false],
146
167
  ]
147
168
 
148
169
  UNSAFE_CHARSET = [
@@ -211,6 +232,7 @@ class Mysql
211
232
  "ucs2" => Encoding::UTF_16BE,
212
233
  "ujis" => Encoding::EucJP_ms,
213
234
  "utf8" => Encoding::UTF_8,
235
+ "utf8mb4" => Encoding::UTF_8,
214
236
  }
215
237
 
216
238
  def self.to_binary(value)