mysql2 0.3.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +1 -151
  3. data/LICENSE +21 -0
  4. data/README.md +634 -0
  5. data/examples/eventmachine.rb +1 -3
  6. data/examples/threaded.rb +5 -9
  7. data/ext/mysql2/client.c +1154 -342
  8. data/ext/mysql2/client.h +20 -33
  9. data/ext/mysql2/extconf.rb +229 -37
  10. data/ext/mysql2/infile.c +122 -0
  11. data/ext/mysql2/infile.h +1 -0
  12. data/ext/mysql2/mysql2_ext.c +3 -1
  13. data/ext/mysql2/mysql2_ext.h +18 -16
  14. data/ext/mysql2/mysql_enc_name_to_ruby.h +168 -0
  15. data/ext/mysql2/mysql_enc_to_ruby.h +259 -0
  16. data/ext/mysql2/result.c +708 -191
  17. data/ext/mysql2/result.h +15 -6
  18. data/ext/mysql2/statement.c +602 -0
  19. data/ext/mysql2/statement.h +17 -0
  20. data/ext/mysql2/wait_for_single_fd.h +37 -0
  21. data/lib/mysql2.rb +69 -7
  22. data/lib/mysql2/client.rb +126 -211
  23. data/lib/mysql2/console.rb +5 -0
  24. data/lib/mysql2/em.rb +24 -8
  25. data/lib/mysql2/error.rb +93 -8
  26. data/lib/mysql2/field.rb +3 -0
  27. data/lib/mysql2/result.rb +2 -0
  28. data/lib/mysql2/statement.rb +11 -0
  29. data/lib/mysql2/version.rb +2 -2
  30. data/spec/configuration.yml.example +11 -0
  31. data/spec/em/em_spec.rb +101 -15
  32. data/spec/my.cnf.example +9 -0
  33. data/spec/mysql2/client_spec.rb +874 -232
  34. data/spec/mysql2/error_spec.rb +55 -46
  35. data/spec/mysql2/result_spec.rb +306 -154
  36. data/spec/mysql2/statement_spec.rb +712 -0
  37. data/spec/spec_helper.rb +103 -57
  38. data/spec/ssl/ca-cert.pem +17 -0
  39. data/spec/ssl/ca-key.pem +27 -0
  40. data/spec/ssl/ca.cnf +22 -0
  41. data/spec/ssl/cert.cnf +22 -0
  42. data/spec/ssl/client-cert.pem +17 -0
  43. data/spec/ssl/client-key.pem +27 -0
  44. data/spec/ssl/client-req.pem +15 -0
  45. data/spec/ssl/gen_certs.sh +48 -0
  46. data/spec/ssl/pkcs8-client-key.pem +28 -0
  47. data/spec/ssl/pkcs8-server-key.pem +28 -0
  48. data/spec/ssl/server-cert.pem +17 -0
  49. data/spec/ssl/server-key.pem +27 -0
  50. data/spec/ssl/server-req.pem +15 -0
  51. data/spec/test_data +1 -0
  52. data/support/5072E1F5.asc +432 -0
  53. data/support/libmysql.def +219 -0
  54. data/support/mysql_enc_to_ruby.rb +81 -0
  55. data/support/ruby_enc_to_mysql.rb +61 -0
  56. metadata +82 -188
  57. data/.gitignore +0 -12
  58. data/.rspec +0 -2
  59. data/.rvmrc +0 -1
  60. data/Gemfile +0 -3
  61. data/MIT-LICENSE +0 -20
  62. data/README.rdoc +0 -257
  63. data/Rakefile +0 -5
  64. data/benchmark/active_record.rb +0 -51
  65. data/benchmark/active_record_threaded.rb +0 -42
  66. data/benchmark/allocations.rb +0 -33
  67. data/benchmark/escape.rb +0 -36
  68. data/benchmark/query_with_mysql_casting.rb +0 -80
  69. data/benchmark/query_without_mysql_casting.rb +0 -47
  70. data/benchmark/sequel.rb +0 -37
  71. data/benchmark/setup_db.rb +0 -119
  72. data/benchmark/threaded.rb +0 -44
  73. data/lib/active_record/connection_adapters/em_mysql2_adapter.rb +0 -64
  74. data/lib/active_record/fiber_patches.rb +0 -104
  75. data/lib/mysql2/em_fiber.rb +0 -31
  76. data/mysql2.gemspec +0 -32
  77. data/spec/em/em_fiber_spec.rb +0 -22
  78. data/tasks/benchmarks.rake +0 -20
  79. data/tasks/compile.rake +0 -71
  80. data/tasks/rspec.rake +0 -16
  81. data/tasks/vendor_mysql.rake +0 -40
@@ -0,0 +1 @@
1
+ void mysql2_set_local_infile(MYSQL *mysql, void *userdata);
@@ -1,12 +1,14 @@
1
1
  #include <mysql2_ext.h>
2
2
 
3
- VALUE mMysql2, cMysql2Error;
3
+ VALUE mMysql2, cMysql2Error, cMysql2TimeoutError;
4
4
 
5
5
  /* Ruby Extension initializer */
6
6
  void Init_mysql2() {
7
7
  mMysql2 = rb_define_module("Mysql2");
8
8
  cMysql2Error = rb_const_get(mMysql2, rb_intern("Error"));
9
+ cMysql2TimeoutError = rb_const_get(cMysql2Error, rb_intern("TimeoutError"));
9
10
 
10
11
  init_mysql2_client();
11
12
  init_mysql2_result();
13
+ init_mysql2_statement();
12
14
  }
@@ -1,42 +1,44 @@
1
1
  #ifndef MYSQL2_EXT
2
2
  #define MYSQL2_EXT
3
3
 
4
- // tell rbx not to use it's caching compat layer
5
- // by doing this we're making a promize to RBX that
6
- // we'll never modify the pointers we get back from RSTRING_PTR
4
+ void Init_mysql2(void);
5
+
6
+ /* tell rbx not to use it's caching compat layer
7
+ by doing this we're making a promise to RBX that
8
+ we'll never modify the pointers we get back from RSTRING_PTR */
7
9
  #define RSTRING_NOT_MODIFIED
8
10
  #include <ruby.h>
9
- #include <fcntl.h>
10
-
11
- #ifndef HAVE_UINT
12
- #define HAVE_UINT
13
- typedef unsigned short ushort;
14
- typedef unsigned int uint;
15
- #endif
16
11
 
17
12
  #ifdef HAVE_MYSQL_H
18
13
  #include <mysql.h>
19
- #include <mysql_com.h>
20
14
  #include <errmsg.h>
21
- #include <mysqld_error.h>
22
15
  #else
23
16
  #include <mysql/mysql.h>
24
- #include <mysql/mysql_com.h>
25
17
  #include <mysql/errmsg.h>
26
- #include <mysql/mysqld_error.h>
27
18
  #endif
28
19
 
29
- #ifdef HAVE_RUBY_ENCODING_H
30
20
  #include <ruby/encoding.h>
31
- #endif
21
+ #include <ruby/thread.h>
32
22
 
33
23
  #if defined(__GNUC__) && (__GNUC__ >= 3)
24
+ #define RB_MYSQL_NORETURN __attribute__ ((noreturn))
34
25
  #define RB_MYSQL_UNUSED __attribute__ ((unused))
35
26
  #else
27
+ #define RB_MYSQL_NORETURN
36
28
  #define RB_MYSQL_UNUSED
37
29
  #endif
38
30
 
31
+ /* MySQL 8.0 replaces my_bool with C99 bool. Earlier versions of MySQL had
32
+ * a typedef to char. Gem users reported failures on big endian systems when
33
+ * using C99 bool types with older MySQLs due to mismatched behavior. */
34
+ #ifndef HAVE_TYPE_MY_BOOL
35
+ #include <stdbool.h>
36
+ typedef bool my_bool;
37
+ #endif
38
+
39
39
  #include <client.h>
40
+ #include <statement.h>
40
41
  #include <result.h>
42
+ #include <infile.h>
41
43
 
42
44
  #endif
@@ -0,0 +1,168 @@
1
+ /* C code produced by gperf version 3.0.4 */
2
+ /* Command-line: gperf */
3
+ /* Computed positions: -k'1,3,$' */
4
+
5
+ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
6
+ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
7
+ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
8
+ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
9
+ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
10
+ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
11
+ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
12
+ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
13
+ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
14
+ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
15
+ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
16
+ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
17
+ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
18
+ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
19
+ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
20
+ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
21
+ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
22
+ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
23
+ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
24
+ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
25
+ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
26
+ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
27
+ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
28
+ /* The character set is not based on ISO-646. */
29
+ error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
30
+ #endif
31
+
32
+ struct mysql2_mysql_enc_name_to_rb_map { const char *name; const char *rb_name; };
33
+ /* maximum key range = 66, duplicates = 0 */
34
+
35
+ #ifdef __GNUC__
36
+ __inline
37
+ #else
38
+ #ifdef __cplusplus
39
+ inline
40
+ #endif
41
+ #endif
42
+ static unsigned int
43
+ mysql2_mysql_enc_name_to_rb_hash (str, len)
44
+ register const char *str;
45
+ register unsigned int len;
46
+ {
47
+ static const unsigned char asso_values[] =
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
75
+ };
76
+ return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]];
77
+ }
78
+
79
+ #ifdef __GNUC__
80
+ __inline
81
+ #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
82
+ __attribute__ ((__gnu_inline__))
83
+ #endif
84
+ #endif
85
+ const struct mysql2_mysql_enc_name_to_rb_map *
86
+ mysql2_mysql_enc_name_to_rb (str, len)
87
+ register const char *str;
88
+ register unsigned int len;
89
+ {
90
+ enum
91
+ {
92
+ TOTAL_KEYWORDS = 39,
93
+ MIN_WORD_LENGTH = 3,
94
+ MAX_WORD_LENGTH = 8,
95
+ MIN_HASH_VALUE = 3,
96
+ MAX_HASH_VALUE = 68
97
+ };
98
+
99
+ static const struct mysql2_mysql_enc_name_to_rb_map wordlist[] =
100
+ {
101
+ {""}, {""}, {""},
102
+ {"gbk", "GBK"},
103
+ {""},
104
+ {"greek", "ISO-8859-7"},
105
+ {"gb2312", "GB2312"},
106
+ {"keybcs2", NULL},
107
+ {""},
108
+ {"ucs2", "UTF-16BE"},
109
+ {"koi8u", "KOI8-R"},
110
+ {"binary", "ASCII-8BIT"},
111
+ {"eucjpms", "eucJP-ms"},
112
+ {""},
113
+ {"ujis", "eucJP-ms"},
114
+ {"cp852", "CP852"},
115
+ {"cp1251", "Windows-1251"},
116
+ {"geostd8", NULL},
117
+ {""},
118
+ {"sjis", "Shift_JIS"},
119
+ {"macce", "macCentEuro"},
120
+ {"latin2", "ISO-8859-2"},
121
+ {""},
122
+ {"macroman", "macRoman"},
123
+ {"dec8", NULL},
124
+ {"utf32", "UTF-32"},
125
+ {"latin1", "ISO-8859-1"},
126
+ {"utf8mb4", "UTF-8"},
127
+ {"hp8", NULL},
128
+ {"swe7", NULL},
129
+ {"euckr", "EUC-KR"},
130
+ {"cp1257", "Windows-1257"},
131
+ {""}, {""},
132
+ {"utf8", "UTF-8"},
133
+ {"koi8r", "KOI8-R"},
134
+ {"cp1256", "Windows-1256"},
135
+ {""}, {""}, {""},
136
+ {"cp866", "IBM866"},
137
+ {"latin7", "ISO-8859-13"},
138
+ {""}, {""}, {""},
139
+ {"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"},
148
+ {""}, {""}, {""},
149
+ {"cp932", "Windows-31J"},
150
+ {"latin5", "ISO-8859-9"},
151
+ {""}, {""}, {""}, {""}, {""}, {""},
152
+ {"armscii8", NULL}
153
+ };
154
+
155
+ if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
156
+ {
157
+ register int key = mysql2_mysql_enc_name_to_rb_hash (str, len);
158
+
159
+ if (key <= MAX_HASH_VALUE && key >= 0)
160
+ {
161
+ register const char *s = wordlist[key].name;
162
+
163
+ if (*str == *s && !strcmp (str + 1, s + 1))
164
+ return &wordlist[key];
165
+ }
166
+ }
167
+ return 0;
168
+ }
@@ -0,0 +1,259 @@
1
+ static const char *mysql2_mysql_enc_to_rb[] = {
2
+ "Big5",
3
+ "ISO-8859-2",
4
+ NULL,
5
+ "CP850",
6
+ "ISO-8859-1",
7
+ NULL,
8
+ "KOI8-R",
9
+ "ISO-8859-1",
10
+ "ISO-8859-2",
11
+ NULL,
12
+ "US-ASCII",
13
+ "eucJP-ms",
14
+ "Shift_JIS",
15
+ "Windows-1251",
16
+ "ISO-8859-1",
17
+ "ISO-8859-8",
18
+ NULL,
19
+ "TIS-620",
20
+ "EUC-KR",
21
+ "ISO-8859-13",
22
+ "ISO-8859-2",
23
+ "KOI8-R",
24
+ "Windows-1251",
25
+ "GB2312",
26
+ "ISO-8859-7",
27
+ "Windows-1250",
28
+ "ISO-8859-2",
29
+ "GBK",
30
+ "Windows-1257",
31
+ "ISO-8859-9",
32
+ "ISO-8859-1",
33
+ NULL,
34
+ "UTF-8",
35
+ "Windows-1250",
36
+ "UTF-16BE",
37
+ "IBM866",
38
+ NULL,
39
+ "macCentEuro",
40
+ "macRoman",
41
+ "CP852",
42
+ "ISO-8859-13",
43
+ "ISO-8859-13",
44
+ "macCentEuro",
45
+ "Windows-1250",
46
+ "UTF-8",
47
+ "UTF-8",
48
+ "ISO-8859-1",
49
+ "ISO-8859-1",
50
+ "ISO-8859-1",
51
+ "Windows-1251",
52
+ "Windows-1251",
53
+ "Windows-1251",
54
+ "macRoman",
55
+ "UTF-16",
56
+ "UTF-16",
57
+ "",
58
+ "Windows-1256",
59
+ "Windows-1257",
60
+ "Windows-1257",
61
+ "UTF-32",
62
+ "UTF-32",
63
+ "",
64
+ "ASCII-8BIT",
65
+ NULL,
66
+ "US-ASCII",
67
+ "Windows-1250",
68
+ "Windows-1256",
69
+ "IBM866",
70
+ NULL,
71
+ "ISO-8859-7",
72
+ "ISO-8859-8",
73
+ NULL,
74
+ NULL,
75
+ "KOI8-R",
76
+ "KOI8-R",
77
+ NULL,
78
+ "ISO-8859-2",
79
+ "ISO-8859-9",
80
+ "ISO-8859-13",
81
+ "CP850",
82
+ "CP852",
83
+ NULL,
84
+ "UTF-8",
85
+ "Big5",
86
+ "EUC-KR",
87
+ "GB2312",
88
+ "GBK",
89
+ "Shift_JIS",
90
+ "TIS-620",
91
+ "UTF-16BE",
92
+ "eucJP-ms",
93
+ NULL,
94
+ NULL,
95
+ "ISO-8859-1",
96
+ "Windows-31J",
97
+ "Windows-31J",
98
+ "eucJP-ms",
99
+ "eucJP-ms",
100
+ "Windows-1250",
101
+ NULL,
102
+ "UTF-16",
103
+ "UTF-16",
104
+ "UTF-16",
105
+ "UTF-16",
106
+ "UTF-16",
107
+ "UTF-16",
108
+ "UTF-16",
109
+ "UTF-16",
110
+ "UTF-16",
111
+ "UTF-16",
112
+ "UTF-16",
113
+ "UTF-16",
114
+ "UTF-16",
115
+ "UTF-16",
116
+ "UTF-16",
117
+ "UTF-16",
118
+ "UTF-16",
119
+ "UTF-16",
120
+ "UTF-16",
121
+ "UTF-16",
122
+ "UTF-16",
123
+ "UTF-16",
124
+ "UTF-16",
125
+ "UTF-16",
126
+ NULL,
127
+ NULL,
128
+ NULL,
129
+ "UTF-16BE",
130
+ "UTF-16BE",
131
+ "UTF-16BE",
132
+ "UTF-16BE",
133
+ "UTF-16BE",
134
+ "UTF-16BE",
135
+ "UTF-16BE",
136
+ "UTF-16BE",
137
+ "UTF-16BE",
138
+ "UTF-16BE",
139
+ "UTF-16BE",
140
+ "UTF-16BE",
141
+ "UTF-16BE",
142
+ "UTF-16BE",
143
+ "UTF-16BE",
144
+ "UTF-16BE",
145
+ "UTF-16BE",
146
+ "UTF-16BE",
147
+ "UTF-16BE",
148
+ "UTF-16BE",
149
+ "UTF-16BE",
150
+ "UTF-16BE",
151
+ "UTF-16BE",
152
+ "UTF-16BE",
153
+ NULL,
154
+ NULL,
155
+ NULL,
156
+ NULL,
157
+ NULL,
158
+ NULL,
159
+ NULL,
160
+ "UTF-16BE",
161
+ "UTF-32",
162
+ "UTF-32",
163
+ "UTF-32",
164
+ "UTF-32",
165
+ "UTF-32",
166
+ "UTF-32",
167
+ "UTF-32",
168
+ "UTF-32",
169
+ "UTF-32",
170
+ "UTF-32",
171
+ "UTF-32",
172
+ "UTF-32",
173
+ "UTF-32",
174
+ "UTF-32",
175
+ "UTF-32",
176
+ "UTF-32",
177
+ "UTF-32",
178
+ "UTF-32",
179
+ "UTF-32",
180
+ "UTF-32",
181
+ "UTF-32",
182
+ "UTF-32",
183
+ "UTF-32",
184
+ "UTF-32",
185
+ NULL,
186
+ NULL,
187
+ NULL,
188
+ NULL,
189
+ NULL,
190
+ NULL,
191
+ NULL,
192
+ NULL,
193
+ "UTF-8",
194
+ "UTF-8",
195
+ "UTF-8",
196
+ "UTF-8",
197
+ "UTF-8",
198
+ "UTF-8",
199
+ "UTF-8",
200
+ "UTF-8",
201
+ "UTF-8",
202
+ "UTF-8",
203
+ "UTF-8",
204
+ "UTF-8",
205
+ "UTF-8",
206
+ "UTF-8",
207
+ "UTF-8",
208
+ "UTF-8",
209
+ "UTF-8",
210
+ "UTF-8",
211
+ "UTF-8",
212
+ "UTF-8",
213
+ "UTF-8",
214
+ "UTF-8",
215
+ "UTF-8",
216
+ "UTF-8",
217
+ NULL,
218
+ NULL,
219
+ NULL,
220
+ NULL,
221
+ NULL,
222
+ NULL,
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
+ NULL,
250
+ NULL,
251
+ NULL,
252
+ NULL,
253
+ NULL,
254
+ NULL,
255
+ NULL,
256
+ "UTF-8"
257
+ };
258
+
259
+ #define CHARSETNR_SIZE (sizeof(mysql2_mysql_enc_to_rb)/sizeof(mysql2_mysql_enc_to_rb[0]))