do_mysql 0.10.16-java → 0.10.17-java

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: 01b2680113efb8e5f129d8ea4a01247a93e00ee3
4
- data.tar.gz: 3a23d0669b9f13b189e8c959055ee1ebd371b6fc
3
+ metadata.gz: 19d156069f01c95b708ae4b39584eac156c7db2b
4
+ data.tar.gz: 5da301c9eff52311e39aeb680276d21260df4772
5
5
  SHA512:
6
- metadata.gz: 1a26814c83b15d54652249ad945a7b0f3b1c8719995c7e1863642adcce58d34ac0f829388fc0c2534057059d946a63f504bfdc0d2a62e2ec3041387cf933b09c
7
- data.tar.gz: bf4d4ba17f0913c8bc64f2596f67c047afb5fa2ccbbcc71756aa839827b8018c5aa7377a907a5937c2c9d88f5a2c1aee8421a19aa997707adc400245e4804986
6
+ metadata.gz: 8b023c6161691488d5b74823158bf63b26c7aacef93e37697f26bdae8e6ce95818ebc43d7c64697e9228fce115e52e22ab10498b99549be340856cbb5c7fc41c
7
+ data.tar.gz: fef40fe45d3606316b7a6c29763c4c7eb29d19d8d1853348067814e2594b8a22fe0508ce55795421a89ec0f0dd38619f8e0673c69c8f8ab9959c779825edaa44
@@ -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
@@ -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: java
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
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 0.10.16
75
+ version: 0.10.17
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 0.10.16
82
+ version: 0.10.17
83
83
  description: Implements the DataObjects API for MySQL
84
84
  email: d.bussink@gmail.com
85
85
  executables: []