do_mysql 0.10.16-x86-mingw32 → 0.10.17-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b2c0521d2c003a9c46994ca65460727fd57cf2e
4
- data.tar.gz: 3f4c15fad7683855825eaac6f720ff4044002241
3
+ metadata.gz: 4c63de4b96a977c94254a711967c96a9da44b2e9
4
+ data.tar.gz: 7455a1debe8e977360fbe6ef0e8256dc5f4c7604
5
5
  SHA512:
6
- metadata.gz: 40877d4966aa5b6020dc06b79b2c48a1c490d2a4c532cea74926910578debc003590b34a5b2b57c10e80ba83b5ee720d8f069dca740463db58cd1d52818bb284
7
- data.tar.gz: 201e6bf11b56141d057c9c8cb0c5f68e1e010e46b549b843b15120e3db73b5395f90e3802e618e72446ba9df99516f6caf756a236f0a49cf9a1565e99097c275
6
+ metadata.gz: e5c68239d95a3c6715c2d2a4b0a28e5e30b9ebd518feccd75ff5e53b2dfde258d6a3dae2ea42136b1cff23bfea82f05b41862abb357d52f6586b62790a4d6708
7
+ data.tar.gz: 36c1de3db3600e602c722bb422d7708795d8faa5d78a2b40388b2760e0c8da06f346fff48a6b89ad1ca2d5aaf07878b93f6c9ba9ec531718e464b2ac2293ffe1
@@ -1,3 +1,14 @@
1
+ ## 0.10.17 2016-01-24
2
+
3
+ * Improve utf8mb4 support
4
+ * Fix memory leak
5
+ * Support for MySQL 5.7
6
+ * Fix bug with DateTime and wrong timezone offsets
7
+
8
+ ## 0.10.16 2015-05-17
9
+
10
+ No changes
11
+
1
12
  ## 0.10.15 2015-02-15
2
13
 
3
14
  * Ruby 2.2 support
@@ -3,6 +3,9 @@
3
3
  #include <math.h>
4
4
  #include <ctype.h>
5
5
  #include <time.h>
6
+ #ifndef _WIN32
7
+ #include <sys/time.h>
8
+ #endif
6
9
 
7
10
  #include "do_common.h"
8
11
 
@@ -1,5 +1,8 @@
1
1
  #include <ruby.h>
2
2
  #include <time.h>
3
+ #ifndef _WIN32
4
+ #include <sys/time.h>
5
+ #endif
3
6
  #include <string.h>
4
7
 
5
8
  #include <mysql.h>
@@ -166,14 +169,15 @@ MYSQL_RES *do_mysql_cCommand_execute_async(VALUE self, VALUE connection, MYSQL *
166
169
 
167
170
  int socket_fd = db->net.fd;
168
171
  rb_fdset_t rset;
172
+ rb_fd_init(&rset);
173
+ rb_fd_set(socket_fd, &rset);
169
174
 
170
175
  while (1) {
171
- rb_fd_init(&rset);
172
- rb_fd_set(socket_fd, &rset);
173
176
 
174
177
  retval = rb_thread_fd_select(socket_fd + 1, &rset, NULL, NULL, NULL);
175
178
 
176
179
  if (retval < 0) {
180
+ rb_fd_term(&rset);
177
181
  rb_sys_fail(0);
178
182
  }
179
183
 
@@ -185,6 +189,7 @@ MYSQL_RES *do_mysql_cCommand_execute_async(VALUE self, VALUE connection, MYSQL *
185
189
  break;
186
190
  }
187
191
  }
192
+ rb_fd_term(&rset);
188
193
 
189
194
  retval = mysql_read_query_result(db);
190
195
  CHECK_AND_RAISE(retval, query);
@@ -329,7 +334,11 @@ void do_mysql_full_connect(VALUE self, MYSQL *db) {
329
334
  }
330
335
  else {
331
336
  #ifdef HAVE_RUBY_ENCODING_H
332
- rb_iv_set(self, "@encoding_id", INT2FIX(rb_enc_find_index(rb_str_ptr_readonly(encoding))));
337
+ const char* ruby_encoding = rb_str_ptr_readonly(encoding);
338
+ if (strcasecmp("UTF-8-MB4", ruby_encoding) == 0) {
339
+ ruby_encoding = "UTF-8";
340
+ }
341
+ rb_iv_set(self, "@encoding_id", INT2FIX(rb_enc_find_index(ruby_encoding)));
333
342
  #endif
334
343
 
335
344
  rb_iv_set(self, "@my_encoding", my_encoding);
@@ -465,7 +474,16 @@ VALUE do_mysql_cConnection_quote_string(VALUE self, VALUE string) {
465
474
  VALUE result;
466
475
 
467
476
  // Escape 'source' using the current encoding in use on the conection 'db'
477
+ #ifdef HAVE_MYSQL_REAL_ESCAPE_STRING_QUOTE
478
+ quoted_length = mysql_real_escape_string_quote(db, escaped + 1, source, source_len, '\'');
479
+ #else
468
480
  quoted_length = mysql_real_escape_string(db, escaped + 1, source, source_len);
481
+ #endif
482
+
483
+ if (quoted_length == (unsigned long)-1) {
484
+ free(escaped);
485
+ rb_raise(rb_eArgError, "Failed to quote string. Make sure to (re)compile do_mysql against the correct libmysqlclient");
486
+ }
469
487
 
470
488
  // Wrap the escaped string in single-quotes, this is DO's convention
471
489
  escaped[0] = escaped[quoted_length + 1] = '\'';
@@ -80,6 +80,7 @@ have_func 'mysql_sqlstate', 'mysql.h'
80
80
  have_func 'mysql_get_ssl_cipher', 'mysql.h'
81
81
  have_func 'mysql_set_character_set', 'mysql.h'
82
82
  have_func 'mysql_get_server_version', 'mysql.h'
83
+ have_func 'mysql_real_escape_string_quote', 'mysql.h'
83
84
  have_struct_member 'MYSQL_FIELD', 'charsetnr', 'mysql.h'
84
85
 
85
86
  have_func('rb_thread_fd_select')
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,5 +1,5 @@
1
1
  module DataObjects
2
2
  module Mysql
3
- VERSION = '0.10.16'
3
+ VERSION = '0.10.17'
4
4
  end
5
5
  end
@@ -6,5 +6,42 @@ require 'data_objects/spec/shared/encoding_spec'
6
6
  describe DataObjects::Mysql::Connection do
7
7
  it_should_behave_like 'a driver supporting different encodings'
8
8
  it_should_behave_like 'returning correctly encoded strings for the default database encoding'
9
- it_should_behave_like 'returning correctly encoded strings for the default internal encoding'
9
+ it_should_behave_like 'returning correctly encoded strings for the default internal encoding' unless JRUBY
10
+
11
+ unless JRUBY
12
+ describe 'sets the character set through the URI' do
13
+ before do
14
+ @utf8mb4_connection = DataObjects::Connection.new("#{CONFIG.scheme}://#{CONFIG.user}:#{CONFIG.pass}@#{CONFIG.host}:#{CONFIG.port}#{CONFIG.database}?encoding=UTF-8-MB4")
15
+ end
16
+
17
+ after { @utf8mb4_connection.close }
18
+
19
+ it { @utf8mb4_connection.character_set.should == 'UTF-8-MB4' }
20
+
21
+ describe 'writing a multibyte String' do
22
+ it 'should write a multibyte String' do
23
+ @command = @utf8mb4_connection.create_command('INSERT INTO users_mb4 (name) VALUES(?)')
24
+ expect { @command.execute_non_query("😀") }.not_to raise_error(DataObjects::DataError)
25
+ end
26
+ end
27
+
28
+ describe 'reading a String' do
29
+ before do
30
+ @reader = @utf8mb4_connection.create_command("SELECT name FROM users_mb4").execute_reader
31
+ @reader.next!
32
+ @values = @reader.values
33
+ end
34
+
35
+ after do
36
+ @reader.close
37
+ end
38
+
39
+ it 'should return UTF-8 encoded String' do
40
+ @values.first.should be_kind_of(String)
41
+ @values.first.encoding.name.should == 'UTF-8'
42
+ @values.first.should == "😀"
43
+ end
44
+ end
45
+ end
46
+ end
10
47
  end
@@ -62,6 +62,10 @@ module DataObjectsSpecHelpers
62
62
  DROP TABLE IF EXISTS `users`
63
63
  EOF
64
64
 
65
+ conn.create_command(<<-EOF).execute_non_query
66
+ DROP TABLE IF EXISTS `users_mb4`
67
+ EOF
68
+
65
69
  conn.create_command(<<-EOF).execute_non_query
66
70
  DROP TABLE IF EXISTS `stuff`
67
71
  EOF
@@ -79,6 +83,14 @@ module DataObjectsSpecHelpers
79
83
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
80
84
  EOF
81
85
 
86
+ conn.create_command(<<-EOF).execute_non_query
87
+ CREATE TABLE `users_mb4` (
88
+ `id` int(11) NOT NULL auto_increment,
89
+ `name` varchar(200),
90
+ PRIMARY KEY (`id`)
91
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
92
+ EOF
93
+
82
94
  conn.create_command(<<-EOF).execute_non_query
83
95
  CREATE TABLE `invoices` (
84
96
  `invoice_number` varchar(50) NOT NULL,
@@ -56,7 +56,7 @@ begin
56
56
  ext.classpath = '../do_jdbc/lib/do_jdbc_internal.jar'
57
57
  ext.java_compiling do |gem|
58
58
  gem.add_dependency 'jdbc-mysql', '>=5.0.4'
59
- gem.add_dependency 'do_jdbc', '0.10.16'
59
+ gem.add_dependency 'do_jdbc', '0.10.17'
60
60
  end
61
61
  end
62
62
  rescue LoadError
@@ -3,7 +3,7 @@ task :build_all do
3
3
  `rake clean`
4
4
  `rake build`
5
5
  `rake java gem`
6
- `rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.3:2.0.0:2.1.5:2.2.0`
6
+ `rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.3:2.0.0:2.1.8:2.2.4:2.3.0`
7
7
  end
8
8
 
9
9
  desc 'Release all gems (native, binaries for JRuby and Windows)'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: do_mysql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.16
4
+ version: 0.10.17
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - Dirkjan Bussink
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-17 00:00:00.000000000 Z
11
+ date: 2016-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: data_objects
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.10.16
19
+ version: 0.10.17
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.10.16
26
+ version: 0.10.17
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -107,6 +107,7 @@ files:
107
107
  - lib/do_mysql/2.0/do_mysql.so
108
108
  - lib/do_mysql/2.1/do_mysql.so
109
109
  - lib/do_mysql/2.2/do_mysql.so
110
+ - lib/do_mysql/2.3/do_mysql.so
110
111
  homepage:
111
112
  licenses: []
112
113
  metadata: {}