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 +4 -4
- data/ChangeLog.markdown +11 -0
- data/ext/do_mysql/do_common.c +3 -0
- data/ext/do_mysql/do_mysql.c +21 -3
- data/ext/do_mysql/extconf.rb +1 -0
- data/lib/do_mysql/1.8/do_mysql.so +0 -0
- data/lib/do_mysql/1.9/do_mysql.so +0 -0
- data/lib/do_mysql/2.0/do_mysql.so +0 -0
- data/lib/do_mysql/2.1/do_mysql.so +0 -0
- data/lib/do_mysql/2.2/do_mysql.so +0 -0
- data/lib/do_mysql/2.3/do_mysql.so +0 -0
- data/lib/do_mysql/version.rb +1 -1
- data/spec/encoding_spec.rb +38 -1
- data/spec/spec_helper.rb +12 -0
- data/tasks/compile.rake +1 -1
- data/tasks/release.rake +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c31641a36831e9a6b138129c87da06e13930cdb7
|
4
|
+
data.tar.gz: 9ecbd3ba7bd07e52a7f0301d220af0326fe0ccaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c61a0b0e4e43032f64be557c28c0c51825a1722175410765541543ca34c00cc7c15927828d6bd327f4b0711939215eaef49aca199801a2db59fc6a68de347c5
|
7
|
+
data.tar.gz: d9737045a6cf1fe1eb7fe063b02f4da861479349774aee8f6349b028dc9c53b0fd3a2e8a2413bf4d309b678fd9873287e7ac18b978929dfc3cb7318eb5d06138
|
data/ChangeLog.markdown
CHANGED
data/ext/do_mysql/do_common.c
CHANGED
data/ext/do_mysql/do_mysql.c
CHANGED
@@ -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
|
-
|
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] = '\'';
|
data/ext/do_mysql/extconf.rb
CHANGED
@@ -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
|
Binary file
|
data/lib/do_mysql/version.rb
CHANGED
data/spec/encoding_spec.rb
CHANGED
@@ -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
|
data/spec/spec_helper.rb
CHANGED
@@ -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,
|
data/tasks/compile.rake
CHANGED
data/tasks/release.rake
CHANGED
@@ -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.
|
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.
|
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:
|
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.
|
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.
|
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: {}
|