mysql2 0.3.18 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1 -0
  3. data/LICENSE +21 -0
  4. data/README.md +135 -55
  5. data/examples/eventmachine.rb +1 -1
  6. data/examples/threaded.rb +4 -6
  7. data/ext/mysql2/client.c +368 -197
  8. data/ext/mysql2/client.h +13 -3
  9. data/ext/mysql2/extconf.rb +118 -35
  10. data/ext/mysql2/infile.c +2 -2
  11. data/ext/mysql2/mysql2_ext.c +1 -0
  12. data/ext/mysql2/mysql2_ext.h +7 -6
  13. data/ext/mysql2/mysql_enc_name_to_ruby.h +2 -2
  14. data/ext/mysql2/mysql_enc_to_ruby.h +25 -22
  15. data/ext/mysql2/result.c +512 -138
  16. data/ext/mysql2/result.h +13 -6
  17. data/ext/mysql2/statement.c +585 -0
  18. data/ext/mysql2/statement.h +19 -0
  19. data/lib/mysql2/client.rb +85 -26
  20. data/lib/mysql2/console.rb +1 -1
  21. data/lib/mysql2/em.rb +5 -6
  22. data/lib/mysql2/error.rb +18 -27
  23. data/lib/mysql2/field.rb +3 -0
  24. data/lib/mysql2/statement.rb +17 -0
  25. data/lib/mysql2/version.rb +1 -1
  26. data/lib/mysql2.rb +38 -18
  27. data/spec/configuration.yml.example +0 -6
  28. data/spec/em/em_spec.rb +22 -21
  29. data/spec/mysql2/client_spec.rb +525 -388
  30. data/spec/mysql2/error_spec.rb +38 -39
  31. data/spec/mysql2/result_spec.rb +223 -214
  32. data/spec/mysql2/statement_spec.rb +757 -0
  33. data/spec/spec_helper.rb +80 -59
  34. data/spec/ssl/ca-cert.pem +17 -0
  35. data/spec/ssl/ca-key.pem +27 -0
  36. data/spec/ssl/ca.cnf +22 -0
  37. data/spec/ssl/cert.cnf +22 -0
  38. data/spec/ssl/client-cert.pem +17 -0
  39. data/spec/ssl/client-key.pem +27 -0
  40. data/spec/ssl/client-req.pem +15 -0
  41. data/spec/ssl/gen_certs.sh +48 -0
  42. data/spec/ssl/pkcs8-client-key.pem +28 -0
  43. data/spec/ssl/pkcs8-server-key.pem +28 -0
  44. data/spec/ssl/server-cert.pem +17 -0
  45. data/spec/ssl/server-key.pem +27 -0
  46. data/spec/ssl/server-req.pem +15 -0
  47. data/support/mysql_enc_to_ruby.rb +7 -8
  48. data/support/ruby_enc_to_mysql.rb +1 -1
  49. metadata +42 -47
data/ext/mysql2/client.h CHANGED
@@ -43,14 +43,24 @@ typedef struct {
43
43
  int reconnect_enabled;
44
44
  unsigned int connect_timeout;
45
45
  int active;
46
- int connected;
46
+ int automatic_close;
47
47
  int initialized;
48
48
  int refcount;
49
- int freed;
49
+ int closed;
50
50
  MYSQL *client;
51
51
  } mysql_client_wrapper;
52
52
 
53
- void init_mysql2_client();
53
+ void rb_mysql_client_set_active_thread(VALUE self);
54
+
55
+ #define GET_CLIENT(self) \
56
+ mysql_client_wrapper *wrapper; \
57
+ Data_Get_Struct(self, mysql_client_wrapper, wrapper);
58
+
59
+ void init_mysql2_client(void);
54
60
  void decr_mysql2_client(mysql_client_wrapper *wrapper);
55
61
 
56
62
  #endif
63
+
64
+ #ifndef HAVE_RB_HASH_DUP
65
+ VALUE rb_hash_dup(VALUE other);
66
+ #endif
@@ -1,10 +1,31 @@
1
1
  # encoding: UTF-8
2
2
  require 'mkmf'
3
+ require 'English'
3
4
 
4
- def asplode lib
5
- abort "-----\n#{lib} is missing. please check your installation of mysql and try again.\n-----"
5
+ def asplode(lib)
6
+ if RUBY_PLATFORM =~ /mingw|mswin/
7
+ abort "-----\n#{lib} is missing. Check your installation of MySQL or Connector/C, and try again.\n-----"
8
+ elsif RUBY_PLATFORM =~ /darwin/
9
+ abort "-----\n#{lib} is missing. You may need to 'brew install mysql' or 'port install mysql', and try again.\n-----"
10
+ else
11
+ abort "-----\n#{lib} is missing. You may need to 'apt-get install libmysqlclient-dev' or 'yum install mysql-devel', and try again.\n-----"
12
+ end
6
13
  end
7
14
 
15
+ def add_ssl_defines(header)
16
+ all_modes_found = %w(SSL_MODE_DISABLED SSL_MODE_PREFERRED SSL_MODE_REQUIRED SSL_MODE_VERIFY_CA SSL_MODE_VERIFY_IDENTITY).inject(true) do |m, ssl_mode|
17
+ m && have_const(ssl_mode, header)
18
+ end
19
+ $CFLAGS << ' -DFULL_SSL_MODE_SUPPORT' if all_modes_found
20
+ # if we only have ssl toggle (--ssl,--disable-ssl) from 5.7.3 to 5.7.10
21
+ has_no_support = all_modes_found ? false : !have_const('MYSQL_OPT_SSL_ENFORCE', header)
22
+ $CFLAGS << ' -DNO_SSL_MODE_SUPPORT' if has_no_support
23
+ end
24
+
25
+ # 2.1+
26
+ have_func('rb_absint_size')
27
+ have_func('rb_absint_singlebit_p')
28
+
8
29
  # 2.0-only
9
30
  have_header('ruby/thread.h') && have_func('rb_thread_call_without_gvl', 'ruby/thread.h')
10
31
 
@@ -13,10 +34,11 @@ have_func('rb_thread_blocking_region')
13
34
  have_func('rb_wait_for_single_fd')
14
35
  have_func('rb_hash_dup')
15
36
  have_func('rb_intern3')
37
+ have_func('rb_big_cmp')
16
38
 
17
39
  # borrowed from mysqlplus
18
40
  # http://github.com/oldmoe/mysqlplus/blob/master/ext/extconf.rb
19
- dirs = ENV['PATH'].split(File::PATH_SEPARATOR) + %w[
41
+ dirs = ENV.fetch('PATH').split(File::PATH_SEPARATOR) + %w(
20
42
  /opt
21
43
  /opt/local
22
44
  /opt/local/mysql
@@ -27,13 +49,18 @@ dirs = ENV['PATH'].split(File::PATH_SEPARATOR) + %w[
27
49
  /usr/local/mysql
28
50
  /usr/local/mysql-*
29
51
  /usr/local/lib/mysql5*
30
- ].map{|dir| "#{dir}/bin" }
52
+ /usr/local/opt/mysql5*
53
+ ).map { |dir| dir << '/bin' }
54
+
55
+ # For those without HOMEBREW_ROOT in PATH
56
+ dirs << "#{ENV['HOMEBREW_ROOT']}/bin" if ENV['HOMEBREW_ROOT']
31
57
 
32
- GLOB = "{#{dirs.join(',')}}/{mysql_config,mysql_config5}"
58
+ GLOB = "{#{dirs.join(',')}}/{mysql_config,mysql_config5,mariadb_config}"
33
59
 
34
60
  # If the user has provided a --with-mysql-dir argument, we must respect it or fail.
35
61
  inc, lib = dir_config('mysql')
36
62
  if inc && lib
63
+ # TODO: Remove when 2.0.0 is the minimum supported version
37
64
  # Ruby versions not incorporating the mkmf fix at
38
65
  # https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/39717
39
66
  # do not properly search for lib directories, and must be corrected
@@ -41,37 +68,33 @@ if inc && lib
41
68
  @libdir_basename = 'lib'
42
69
  inc, lib = dir_config('mysql')
43
70
  end
44
- abort "-----\nCannot find include dir(s) #{inc}\n-----" unless inc && inc.split(File::PATH_SEPARATOR).any?{|dir| File.directory?(dir)}
45
- abort "-----\nCannot find library dir(s) #{lib}\n-----" unless lib && lib.split(File::PATH_SEPARATOR).any?{|dir| File.directory?(dir)}
46
- warn "-----\nUsing --with-mysql-dir=#{File.dirname inc}\n-----"
71
+ abort "-----\nCannot find include dir(s) #{inc}\n-----" unless inc && inc.split(File::PATH_SEPARATOR).any? { |dir| File.directory?(dir) }
72
+ abort "-----\nCannot find library dir(s) #{lib}\n-----" unless lib && lib.split(File::PATH_SEPARATOR).any? { |dir| File.directory?(dir) }
73
+ warn "-----\nUsing --with-mysql-dir=#{File.dirname inc}\n-----"
47
74
  rpath_dir = lib
48
- elsif mc = (with_config('mysql-config') || Dir[GLOB].first)
75
+ elsif (mc = (with_config('mysql-config') || Dir[GLOB].first))
49
76
  # If the user has provided a --with-mysql-config argument, we must respect it or fail.
50
77
  # If the user gave --with-mysql-config with no argument means we should try to find it.
51
78
  mc = Dir[GLOB].first if mc == true
52
- abort "-----\nCannot find mysql_config at #{mc}\n-----" unless mc && File.exists?(mc)
79
+ abort "-----\nCannot find mysql_config at #{mc}\n-----" unless mc && File.exist?(mc)
53
80
  abort "-----\nCannot execute mysql_config at #{mc}\n-----" unless File.executable?(mc)
54
- warn "-----\nUsing mysql_config at #{mc}\n-----"
81
+ warn "-----\nUsing mysql_config at #{mc}\n-----"
55
82
  ver = `#{mc} --version`.chomp.to_f
56
83
  includes = `#{mc} --include`.chomp
57
- exit 1 if $? != 0
84
+ abort unless $CHILD_STATUS.success?
58
85
  libs = `#{mc} --libs_r`.chomp
59
86
  # MySQL 5.5 and above already have re-entrant code in libmysqlclient (no _r).
60
- if ver >= 5.5 || libs.empty?
61
- libs = `#{mc} --libs`.chomp
62
- end
63
- exit 1 if $? != 0
87
+ libs = `#{mc} --libs`.chomp if ver >= 5.5 || libs.empty?
88
+ abort unless $CHILD_STATUS.success?
64
89
  $INCFLAGS += ' ' + includes
65
90
  $libs = libs + " " + $libs
66
91
  rpath_dir = libs
67
92
  else
68
- inc, lib = dir_config('mysql', '/usr/local')
69
- libs = ['m', 'z', 'socket', 'nsl', 'mygcc']
70
- while not find_library('mysqlclient', 'mysql_query', lib, "#{lib}/mysql") do
71
- exit 1 if libs.empty?
72
- have_library(libs.shift)
73
- end
74
- rpath_dir = lib
93
+ _, usr_local_lib = dir_config('mysql', '/usr/local')
94
+
95
+ asplode("mysql client") unless find_library('mysqlclient', 'mysql_query', usr_local_lib, "#{usr_local_lib}/mysql")
96
+
97
+ rpath_dir = usr_local_lib
75
98
  end
76
99
 
77
100
  if have_header('mysql.h')
@@ -82,16 +105,76 @@ else
82
105
  asplode 'mysql.h'
83
106
  end
84
107
 
85
- %w{ errmsg.h mysqld_error.h }.each do |h|
108
+ %w(errmsg.h mysqld_error.h).each do |h|
86
109
  header = [prefix, h].compact.join '/'
87
- asplode h unless have_header h
110
+ asplode h unless have_header header
88
111
  end
89
112
 
90
- # These gcc style flags are also supported by clang and xcode compilers,
91
- # so we'll use a does-it-work test instead of an is-it-gcc test.
92
- gcc_flags = ' -Wall -funroll-loops'
93
- if try_link('int main() {return 0;}', gcc_flags)
94
- $CFLAGS << gcc_flags
113
+ mysql_h = [prefix, 'mysql.h'].compact.join('/')
114
+ add_ssl_defines(mysql_h)
115
+ have_struct_member('MYSQL', 'net.vio', mysql_h)
116
+ have_struct_member('MYSQL', 'net.pvio', mysql_h)
117
+
118
+ # This is our wishlist. We use whichever flags work on the host.
119
+ # -Wall and -Wextra are included by default.
120
+ wishlist = [
121
+ '-Weverything',
122
+ '-Wno-bad-function-cast', # rb_thread_call_without_gvl returns void * that we cast to VALUE
123
+ '-Wno-conditional-uninitialized', # false positive in client.c
124
+ '-Wno-covered-switch-default', # result.c -- enum_field_types (when fully covered, e.g. mysql 5.5)
125
+ '-Wno-declaration-after-statement', # GET_CLIENT followed by GET_STATEMENT in statement.c
126
+ '-Wno-disabled-macro-expansion', # rubby :(
127
+ '-Wno-documentation-unknown-command', # rubby :(
128
+ '-Wno-missing-field-initializers', # gperf generates bad code
129
+ '-Wno-missing-variable-declarations', # missing symbols due to ruby native ext initialization
130
+ '-Wno-padded', # mysql :(
131
+ '-Wno-reserved-id-macro', # rubby :(
132
+ '-Wno-sign-conversion', # gperf generates bad code
133
+ '-Wno-static-in-inline', # gperf generates bad code
134
+ '-Wno-switch-enum', # result.c -- enum_field_types (when not fully covered, e.g. mysql 5.6+)
135
+ '-Wno-undef', # rubinius :(
136
+ '-Wno-unreachable-code', # rubby :(
137
+ '-Wno-used-but-marked-unused', # rubby :(
138
+ ]
139
+
140
+ usable_flags = wishlist.select do |flag|
141
+ try_link('int main() {return 0;}', "-Werror #{flag}")
142
+ end
143
+
144
+ $CFLAGS << ' ' << usable_flags.join(' ')
145
+
146
+ enabled_sanitizers = disabled_sanitizers = []
147
+ # Specify a commna-separated list of sanitizers, or try them all by default
148
+ sanitizers = with_config('sanitize')
149
+ case sanitizers
150
+ when true
151
+ # Try them all, turn on whatever we can
152
+ enabled_sanitizers = %w(address cfi integer memory thread undefined).select do |s|
153
+ try_link('int main() {return 0;}', "-Werror -fsanitize=#{s}")
154
+ end
155
+ abort "-----\nCould not enable any sanitizers!\n-----" if enabled_sanitizers.empty?
156
+ when String
157
+ # Figure out which sanitizers are supported
158
+ enabled_sanitizers, disabled_sanitizers = sanitizers.split(',').partition do |s|
159
+ try_link('int main() {return 0;}', "-Werror -fsanitize=#{s}")
160
+ end
161
+ end
162
+
163
+ unless disabled_sanitizers.empty?
164
+ abort "-----\nCould not enable requested sanitizers: #{disabled_sanitizers.join(',')}\n-----"
165
+ end
166
+
167
+ unless enabled_sanitizers.empty?
168
+ warn "-----\nEnabling sanitizers: #{enabled_sanitizers.join(',')}\n-----"
169
+ enabled_sanitizers.each do |s|
170
+ # address sanitizer requires runtime support
171
+ if s == 'address' # rubocop:disable Style/IfUnlessModifier
172
+ have_library('asan') || $LDFLAGS << ' -fsanitize=address'
173
+ end
174
+ $CFLAGS << " -fsanitize=#{s}"
175
+ end
176
+ # Options for line numbers in backtraces
177
+ $CFLAGS << ' -g -fno-omit-frame-pointer'
95
178
  end
96
179
 
97
180
  if RUBY_PLATFORM =~ /mswin|mingw/
@@ -102,7 +185,7 @@ if RUBY_PLATFORM =~ /mswin|mingw/
102
185
  # Use rake to rebuild only if these files change
103
186
  deffile = File.expand_path('../../../support/libmysql.def', __FILE__)
104
187
  libfile = File.expand_path(File.join(rpath_dir, 'libmysql.lib'))
105
- file 'libmysql.a' => [deffile, libfile] do |t|
188
+ file 'libmysql.a' => [deffile, libfile] do
106
189
  when_writing 'building libmysql.a' do
107
190
  # Ruby kindly shows us where dllwrap is, but that tool does more than we want.
108
191
  # Maybe in the future Ruby could provide RbConfig::CONFIG['DLLTOOL'] directly.
@@ -119,8 +202,8 @@ if RUBY_PLATFORM =~ /mswin|mingw/
119
202
 
120
203
  # Make sure the generated interface library works (if cross-compiling, trust without verifying)
121
204
  unless RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
122
- abort "-----\nCannot find libmysql.a\n----" unless have_library('libmysql')
123
- abort "-----\nCannot link to libmysql.a (my_init)\n----" unless have_func('my_init')
205
+ abort "-----\nCannot find libmysql.a\n-----" unless have_library('libmysql')
206
+ abort "-----\nCannot link to libmysql.a (my_init)\n-----" unless have_func('my_init')
124
207
  end
125
208
 
126
209
  # Vendor libmysql.dll
@@ -129,7 +212,7 @@ if RUBY_PLATFORM =~ /mswin|mingw/
129
212
 
130
213
  vendordll = File.join(vendordir, 'libmysql.dll')
131
214
  dllfile = File.expand_path(File.join(rpath_dir, 'libmysql.dll'))
132
- file vendordll => [dllfile, vendordir] do |t|
215
+ file vendordll => [dllfile, vendordir] do
133
216
  when_writing 'copying libmysql.dll' do
134
217
  cp dllfile, vendordll
135
218
  end
@@ -155,7 +238,7 @@ else
155
238
  warn "-----\nSetting mysql rpath to #{explicit_rpath}\n-----"
156
239
  $LDFLAGS << rpath_flags
157
240
  else
158
- if libdir = rpath_dir[%r{(-L)?(/[^ ]+)}, 2]
241
+ if (libdir = rpath_dir[%r{(-L)?(/[^ ]+)}, 2])
159
242
  rpath_flags = " -Wl,-rpath,#{libdir}"
160
243
  if RbConfig::CONFIG["RPATHFLAG"].to_s.empty? && try_link('int main() {return 0;}', rpath_flags)
161
244
  # Usually Ruby sets RPATHFLAG the right way for each system, but not on OS X.
data/ext/mysql2/infile.c CHANGED
@@ -56,7 +56,7 @@ mysql2_local_infile_init(void **ptr, const char *filename, void *userdata)
56
56
  * < 0 error
57
57
  */
58
58
  static int
59
- mysql2_local_infile_read(void *ptr, char *buf, uint buf_len)
59
+ mysql2_local_infile_read(void *ptr, char *buf, unsigned int buf_len)
60
60
  {
61
61
  int count;
62
62
  mysql2_local_infile_data *data = (mysql2_local_infile_data *)ptr;
@@ -95,7 +95,7 @@ mysql2_local_infile_end(void *ptr)
95
95
  * Error message number (see http://dev.mysql.com/doc/refman/5.0/en/error-messages-client.html)
96
96
  */
97
97
  static int
98
- mysql2_local_infile_error(void *ptr, char *error_msg, uint error_msg_len)
98
+ mysql2_local_infile_error(void *ptr, char *error_msg, unsigned int error_msg_len)
99
99
  {
100
100
  mysql2_local_infile_data *data = (mysql2_local_infile_data *) ptr;
101
101
 
@@ -9,4 +9,5 @@ void Init_mysql2() {
9
9
 
10
10
  init_mysql2_client();
11
11
  init_mysql2_result();
12
+ init_mysql2_statement();
12
13
  }
@@ -1,28 +1,26 @@
1
1
  #ifndef MYSQL2_EXT
2
2
  #define MYSQL2_EXT
3
3
 
4
+ void Init_mysql2(void);
5
+
4
6
  /* tell rbx not to use it's caching compat layer
5
7
  by doing this we're making a promise to RBX that
6
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
11
 
10
- #ifndef HAVE_UINT
11
- #define HAVE_UINT
12
- typedef unsigned short ushort;
13
- typedef unsigned int uint;
14
- #endif
15
-
16
12
  #ifdef HAVE_MYSQL_H
17
13
  #include <mysql.h>
18
14
  #include <mysql_com.h>
19
15
  #include <errmsg.h>
20
16
  #include <mysqld_error.h>
17
+ #include <mysql_version.h>
21
18
  #else
22
19
  #include <mysql/mysql.h>
23
20
  #include <mysql/mysql_com.h>
24
21
  #include <mysql/errmsg.h>
25
22
  #include <mysql/mysqld_error.h>
23
+ #include <mysql/mysql_version.h>
26
24
  #endif
27
25
 
28
26
  #ifdef HAVE_RUBY_ENCODING_H
@@ -33,12 +31,15 @@ typedef unsigned int uint;
33
31
  #endif
34
32
 
35
33
  #if defined(__GNUC__) && (__GNUC__ >= 3)
34
+ #define RB_MYSQL_NORETURN __attribute__ ((noreturn))
36
35
  #define RB_MYSQL_UNUSED __attribute__ ((unused))
37
36
  #else
37
+ #define RB_MYSQL_NORETURN
38
38
  #define RB_MYSQL_UNUSED
39
39
  #endif
40
40
 
41
41
  #include <client.h>
42
+ #include <statement.h>
42
43
  #include <result.h>
43
44
  #include <infile.h>
44
45
 
@@ -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
 
@@ -78,7 +78,7 @@ mysql2_mysql_enc_name_to_rb_hash (str, len)
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
@@ -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
+ "",
58
58
  "Windows-1256",
59
59
  "Windows-1257",
60
60
  "Windows-1257",
61
61
  "UTF-32",
62
62
  "UTF-32",
63
- NULL,
63
+ "",
64
64
  "ASCII-8BIT",
65
65
  NULL,
66
66
  "US-ASCII",
@@ -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",
@@ -178,10 +182,6 @@ const char *mysql2_mysql_enc_to_rb[] = {
178
182
  "UTF-32",
179
183
  "UTF-32",
180
184
  "UTF-32",
181
- NULL,
182
- NULL,
183
- NULL,
184
- NULL,
185
185
  NULL,
186
186
  NULL,
187
187
  NULL,
@@ -210,6 +210,10 @@ 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",
213
217
  NULL,
214
218
  NULL,
215
219
  NULL,
@@ -217,11 +221,11 @@ const char *mysql2_mysql_enc_to_rb[] = {
217
221
  NULL,
218
222
  NULL,
219
223
  NULL,
220
- NULL,
221
- NULL,
222
- NULL,
223
- NULL,
224
- NULL,
224
+ "UTF-8",
225
+ "UTF-8",
226
+ "UTF-8",
227
+ "UTF-8",
228
+ "UTF-8",
225
229
  "UTF-8",
226
230
  "UTF-8",
227
231
  "UTF-8",
@@ -243,4 +247,3 @@ const char *mysql2_mysql_enc_to_rb[] = {
243
247
  "UTF-8",
244
248
  "UTF-8"
245
249
  };
246
-