do_mysql 0.10.16-x86-mswin32-60 → 0.10.17-x86-mswin32-60

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: 6417488a164620a24756435587aae4cff863f421
4
- data.tar.gz: 886cdace05bcf379e34ac2c38bf5cc23659cdb19
3
+ metadata.gz: c31641a36831e9a6b138129c87da06e13930cdb7
4
+ data.tar.gz: 9ecbd3ba7bd07e52a7f0301d220af0326fe0ccaf
5
5
  SHA512:
6
- metadata.gz: 02887c85e7e697a9fb4f98f214408fd5e9186dae5556a5d373490734acf9b6ac0b04c0d1af677edba7f768687ea924438f03387c2fc1ba1dd9bf645145195594
7
- data.tar.gz: 9d4ca74f1d8f4ae502ff1f1d7953dd609d34de820cb002315024581e685a7007d1fbd90b81faaf75d1b719defb76ae23f509cdf014d79e4bd0d6b9db830a8123
6
+ metadata.gz: 4c61a0b0e4e43032f64be557c28c0c51825a1722175410765541543ca34c00cc7c15927828d6bd327f4b0711939215eaef49aca199801a2db59fc6a68de347c5
7
+ data.tar.gz: d9737045a6cf1fe1eb7fe063b02f4da861479349774aee8f6349b028dc9c53b0fd3a2e8a2413bf4d309b678fd9873287e7ac18b978929dfc3cb7318eb5d06138
@@ -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-mswin32-60
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: {}