mysql2 0.2.24 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +1 -0
  3. data/LICENSE +21 -0
  4. data/README.md +237 -85
  5. data/ext/mysql2/client.c +582 -249
  6. data/ext/mysql2/client.h +10 -38
  7. data/ext/mysql2/extconf.rb +217 -66
  8. data/ext/mysql2/infile.c +2 -2
  9. data/ext/mysql2/mysql2_ext.c +9 -2
  10. data/ext/mysql2/mysql2_ext.h +13 -14
  11. data/ext/mysql2/mysql_enc_name_to_ruby.h +62 -58
  12. data/ext/mysql2/mysql_enc_to_ruby.h +82 -18
  13. data/ext/mysql2/result.c +736 -200
  14. data/ext/mysql2/result.h +13 -6
  15. data/ext/mysql2/statement.c +612 -0
  16. data/ext/mysql2/statement.h +17 -0
  17. data/ext/mysql2/wait_for_single_fd.h +2 -1
  18. data/lib/mysql2/client.rb +110 -28
  19. data/lib/mysql2/console.rb +1 -1
  20. data/lib/mysql2/em.rb +15 -9
  21. data/lib/mysql2/error.rb +57 -36
  22. data/lib/mysql2/field.rb +3 -0
  23. data/lib/mysql2/result.rb +2 -0
  24. data/lib/mysql2/statement.rb +9 -0
  25. data/lib/mysql2/version.rb +1 -1
  26. data/lib/mysql2.rb +66 -15
  27. data/support/3A79BD29.asc +49 -0
  28. data/support/5072E1F5.asc +432 -0
  29. data/support/libmysql.def +219 -0
  30. data/support/mysql_enc_to_ruby.rb +15 -11
  31. data/support/ruby_enc_to_mysql.rb +8 -6
  32. metadata +30 -94
  33. data/MIT-LICENSE +0 -20
  34. data/examples/eventmachine.rb +0 -21
  35. data/examples/threaded.rb +0 -20
  36. data/lib/active_record/connection_adapters/mysql2_adapter.rb +0 -635
  37. data/lib/arel/engines/sql/compilers/mysql2_compiler.rb +0 -11
  38. data/spec/configuration.yml.example +0 -17
  39. data/spec/em/em_spec.rb +0 -114
  40. data/spec/my.cnf.example +0 -9
  41. data/spec/mysql2/client_spec.rb +0 -897
  42. data/spec/mysql2/error_spec.rb +0 -83
  43. data/spec/mysql2/result_spec.rb +0 -505
  44. data/spec/rcov.opts +0 -3
  45. data/spec/spec_helper.rb +0 -87
  46. data/spec/test_data +0 -1
@@ -1,4 +1,4 @@
1
- /* C code produced by gperf version 3.0.3 */
1
+ /* C code produced by gperf version 3.0.4 */
2
2
  /* Command-line: gperf */
3
3
  /* Computed positions: -k'1,3,$' */
4
4
 
@@ -30,7 +30,7 @@ error "gperf generated tables don't work with this execution character set. Plea
30
30
  #endif
31
31
 
32
32
  struct mysql2_mysql_enc_name_to_rb_map { const char *name; const char *rb_name; };
33
- /* maximum key range = 66, duplicates = 0 */
33
+ /* maximum key range = 71, duplicates = 0 */
34
34
 
35
35
  #ifdef __GNUC__
36
36
  __inline
@@ -46,39 +46,39 @@ mysql2_mysql_enc_name_to_rb_hash (str, len)
46
46
  {
47
47
  static const unsigned char asso_values[] =
48
48
  {
49
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
50
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
51
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
52
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
53
- 69, 69, 69, 69, 69, 69, 69, 69, 40, 5,
54
- 0, 69, 0, 40, 25, 20, 10, 55, 69, 69,
55
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
56
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
57
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
58
- 69, 69, 69, 69, 69, 69, 69, 35, 5, 0,
59
- 10, 0, 20, 0, 5, 5, 69, 0, 10, 15,
60
- 0, 0, 69, 69, 25, 5, 5, 0, 69, 30,
61
- 69, 0, 69, 69, 69, 69, 69, 69, 69, 69,
62
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
63
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
64
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
65
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
66
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
67
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
68
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
69
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
70
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
71
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
72
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
73
- 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
74
- 69, 69, 69, 69, 69, 69
49
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
50
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
51
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
52
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
53
+ 74, 74, 74, 74, 74, 74, 74, 74, 15, 5,
54
+ 0, 74, 5, 25, 40, 10, 20, 50, 74, 74,
55
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
56
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
57
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
58
+ 74, 74, 74, 74, 74, 74, 74, 40, 5, 0,
59
+ 15, 10, 0, 0, 0, 5, 74, 0, 25, 5,
60
+ 0, 5, 74, 74, 20, 5, 5, 0, 74, 45,
61
+ 74, 0, 74, 74, 74, 74, 74, 74, 74, 74,
62
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
63
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
64
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
65
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
66
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
67
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
68
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
69
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
70
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
71
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
72
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
73
+ 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
74
+ 74, 74, 74, 74, 74, 74
75
75
  };
76
76
  return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]];
77
77
  }
78
78
 
79
79
  #ifdef __GNUC__
80
80
  __inline
81
- #ifdef __GNUC_STDC_INLINE__
81
+ #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
82
82
  __attribute__ ((__gnu_inline__))
83
83
  #endif
84
84
  #endif
@@ -89,11 +89,11 @@ mysql2_mysql_enc_name_to_rb (str, len)
89
89
  {
90
90
  enum
91
91
  {
92
- TOTAL_KEYWORDS = 39,
92
+ TOTAL_KEYWORDS = 41,
93
93
  MIN_WORD_LENGTH = 3,
94
94
  MAX_WORD_LENGTH = 8,
95
95
  MIN_HASH_VALUE = 3,
96
- MAX_HASH_VALUE = 68
96
+ MAX_HASH_VALUE = 73
97
97
  };
98
98
 
99
99
  static const struct mysql2_mysql_enc_name_to_rb_map wordlist[] =
@@ -101,54 +101,58 @@ mysql2_mysql_enc_name_to_rb (str, len)
101
101
  {""}, {""}, {""},
102
102
  {"gbk", "GBK"},
103
103
  {""},
104
- {"greek", "ISO-8859-7"},
104
+ {"utf32", "UTF-32"},
105
105
  {"gb2312", "GB2312"},
106
106
  {"keybcs2", NULL},
107
107
  {""},
108
108
  {"ucs2", "UTF-16BE"},
109
109
  {"koi8u", "KOI8-R"},
110
110
  {"binary", "ASCII-8BIT"},
111
- {"eucjpms", "eucJP-ms"},
112
- {""},
111
+ {"utf8mb4", "UTF-8"},
112
+ {"macroman", "macRoman"},
113
113
  {"ujis", "eucJP-ms"},
114
- {"cp852", "CP852"},
114
+ {"greek", "ISO-8859-7"},
115
115
  {"cp1251", "Windows-1251"},
116
- {"geostd8", NULL},
116
+ {"utf16le", "UTF-16LE"},
117
117
  {""},
118
118
  {"sjis", "Shift_JIS"},
119
119
  {"macce", "macCentEuro"},
120
- {"latin2", "ISO-8859-2"},
120
+ {"cp1257", "Windows-1257"},
121
+ {"eucjpms", "eucJP-ms"},
122
+ {""},
123
+ {"utf8", "UTF-8"},
124
+ {"cp852", "CP852"},
125
+ {"cp1250", "Windows-1250"},
126
+ {"gb18030", "GB18030"},
121
127
  {""},
122
- {"macroman", "macRoman"},
123
- {"dec8", NULL},
124
- {"utf32", "UTF-32"},
125
- {"latin1", "ISO-8859-1"},
126
- {"utf8mb4", "UTF-8"},
127
- {"hp8", NULL},
128
128
  {"swe7", NULL},
129
+ {"koi8r", "KOI8-R"},
130
+ {"tis620", "TIS-620"},
131
+ {"geostd8", NULL},
132
+ {""},
133
+ {"big5", "Big5"},
129
134
  {"euckr", "EUC-KR"},
130
- {"cp1257", "Windows-1257"},
135
+ {"latin2", "ISO-8859-2"},
131
136
  {""}, {""},
132
- {"utf8", "UTF-8"},
133
- {"koi8r", "KOI8-R"},
134
- {"cp1256", "Windows-1256"},
135
- {""}, {""}, {""},
136
- {"cp866", "IBM866"},
137
+ {"dec8", NULL},
138
+ {"cp850", "CP850"},
139
+ {"latin1", "ISO-8859-1"},
140
+ {""},
141
+ {"hp8", NULL},
142
+ {""},
143
+ {"utf16", "UTF-16"},
137
144
  {"latin7", "ISO-8859-13"},
138
145
  {""}, {""}, {""},
139
146
  {"ascii", "US-ASCII"},
140
- {"hebrew", "ISO-8859-8"},
141
- {""}, {""},
142
- {"big5", "Big5"},
143
- {"utf16", "UTF-16"},
144
- {"cp1250", "Windows-1250"},
145
- {""}, {""}, {""},
146
- {"cp850", "CP850"},
147
- {"tis620", "TIS-620"},
147
+ {"cp1256", "Windows-1256"},
148
148
  {""}, {""}, {""},
149
149
  {"cp932", "Windows-31J"},
150
+ {"hebrew", "ISO-8859-8"},
151
+ {""}, {""}, {""}, {""},
150
152
  {"latin5", "ISO-8859-9"},
151
- {""}, {""}, {""}, {""}, {""}, {""},
153
+ {""}, {""}, {""},
154
+ {"cp866", "IBM866"},
155
+ {""}, {""}, {""}, {""}, {""}, {""}, {""},
152
156
  {"armscii8", NULL}
153
157
  };
154
158
 
@@ -1,4 +1,4 @@
1
- const char *mysql2_mysql_enc_to_rb[] = {
1
+ static const char *mysql2_mysql_enc_to_rb[] = {
2
2
  "Big5",
3
3
  "ISO-8859-2",
4
4
  NULL,
@@ -54,13 +54,13 @@ const char *mysql2_mysql_enc_to_rb[] = {
54
54
  "macRoman",
55
55
  "UTF-16",
56
56
  "UTF-16",
57
- NULL,
57
+ "UTF-16LE",
58
58
  "Windows-1256",
59
59
  "Windows-1257",
60
60
  "Windows-1257",
61
61
  "UTF-32",
62
62
  "UTF-32",
63
- NULL,
63
+ "UTF-16LE",
64
64
  "ASCII-8BIT",
65
65
  NULL,
66
66
  "US-ASCII",
@@ -74,7 +74,7 @@ const char *mysql2_mysql_enc_to_rb[] = {
74
74
  NULL,
75
75
  "KOI8-R",
76
76
  "KOI8-R",
77
- NULL,
77
+ "UTF-8",
78
78
  "ISO-8859-2",
79
79
  "ISO-8859-9",
80
80
  "ISO-8859-13",
@@ -119,10 +119,10 @@ const char *mysql2_mysql_enc_to_rb[] = {
119
119
  "UTF-16",
120
120
  "UTF-16",
121
121
  "UTF-16",
122
- NULL,
123
- NULL,
124
- NULL,
125
- NULL,
122
+ "UTF-16",
123
+ "UTF-16",
124
+ "UTF-16",
125
+ "UTF-16",
126
126
  NULL,
127
127
  NULL,
128
128
  NULL,
@@ -146,6 +146,10 @@ const char *mysql2_mysql_enc_to_rb[] = {
146
146
  "UTF-16BE",
147
147
  "UTF-16BE",
148
148
  "UTF-16BE",
149
+ "UTF-16BE",
150
+ "UTF-16BE",
151
+ "UTF-16BE",
152
+ "UTF-16BE",
149
153
  NULL,
150
154
  NULL,
151
155
  NULL,
@@ -153,11 +157,11 @@ const char *mysql2_mysql_enc_to_rb[] = {
153
157
  NULL,
154
158
  NULL,
155
159
  NULL,
156
- NULL,
157
- NULL,
158
- NULL,
159
- NULL,
160
- NULL,
160
+ "UTF-16BE",
161
+ "UTF-32",
162
+ "UTF-32",
163
+ "UTF-32",
164
+ "UTF-32",
161
165
  "UTF-32",
162
166
  "UTF-32",
163
167
  "UTF-32",
@@ -186,10 +190,6 @@ const char *mysql2_mysql_enc_to_rb[] = {
186
190
  NULL,
187
191
  NULL,
188
192
  NULL,
189
- NULL,
190
- NULL,
191
- NULL,
192
- NULL,
193
193
  "UTF-8",
194
194
  "UTF-8",
195
195
  "UTF-8",
@@ -210,17 +210,70 @@ const char *mysql2_mysql_enc_to_rb[] = {
210
210
  "UTF-8",
211
211
  "UTF-8",
212
212
  "UTF-8",
213
+ "UTF-8",
214
+ "UTF-8",
215
+ "UTF-8",
216
+ "UTF-8",
217
+ NULL,
213
218
  NULL,
214
219
  NULL,
215
220
  NULL,
216
221
  NULL,
217
222
  NULL,
218
223
  NULL,
224
+ "UTF-8",
225
+ "UTF-8",
226
+ "UTF-8",
227
+ "UTF-8",
228
+ "UTF-8",
229
+ "UTF-8",
230
+ "UTF-8",
231
+ "UTF-8",
232
+ "UTF-8",
233
+ "UTF-8",
234
+ "UTF-8",
235
+ "UTF-8",
236
+ "UTF-8",
237
+ "UTF-8",
238
+ "UTF-8",
239
+ "UTF-8",
240
+ "UTF-8",
241
+ "UTF-8",
242
+ "UTF-8",
243
+ "UTF-8",
244
+ "UTF-8",
245
+ "UTF-8",
246
+ "UTF-8",
247
+ "UTF-8",
248
+ "UTF-8",
249
+ "GB18030",
250
+ "GB18030",
251
+ "GB18030",
219
252
  NULL,
220
253
  NULL,
221
254
  NULL,
222
255
  NULL,
256
+ "UTF-8",
257
+ "UTF-8",
258
+ "UTF-8",
259
+ "UTF-8",
260
+ "UTF-8",
261
+ "UTF-8",
262
+ "UTF-8",
263
+ "UTF-8",
264
+ "UTF-8",
265
+ "UTF-8",
266
+ "UTF-8",
267
+ "UTF-8",
268
+ "UTF-8",
269
+ "UTF-8",
270
+ "UTF-8",
271
+ "UTF-8",
272
+ "UTF-8",
223
273
  NULL,
274
+ "UTF-8",
275
+ "UTF-8",
276
+ "UTF-8",
224
277
  NULL,
225
278
  "UTF-8",
226
279
  "UTF-8",
@@ -240,7 +293,18 @@ const char *mysql2_mysql_enc_to_rb[] = {
240
293
  "UTF-8",
241
294
  "UTF-8",
242
295
  "UTF-8",
296
+ NULL,
297
+ "UTF-8",
298
+ "UTF-8",
299
+ "UTF-8",
300
+ NULL,
301
+ "UTF-8",
302
+ NULL,
303
+ NULL,
304
+ "UTF-8",
305
+ "UTF-8",
306
+ "UTF-8",
307
+ "UTF-8",
243
308
  "UTF-8",
244
309
  "UTF-8"
245
310
  };
246
-