mysql2 0.4.5-x86-mingw32 → 0.4.6-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/ext/mysql2/client.c +25 -19
- data/ext/mysql2/result.c +2 -2
- data/ext/mysql2/result.h +3 -2
- data/ext/mysql2/statement.c +1 -1
- data/lib/mysql2/1.8/mysql2.so +0 -0
- data/lib/mysql2/1.9/mysql2.so +0 -0
- data/lib/mysql2/2.0/mysql2.so +0 -0
- data/lib/mysql2/2.1/mysql2.so +0 -0
- data/lib/mysql2/2.2/mysql2.so +0 -0
- data/lib/mysql2/2.3/mysql2.so +0 -0
- data/lib/mysql2/client.rb +1 -1
- data/lib/mysql2/version.rb +1 -1
- data/spec/mysql2/client_spec.rb +0 -9
- data/vendor/libmysql.dll +0 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71120d45d3f509d35d16462a5c57298c8ea858ab
|
4
|
+
data.tar.gz: 397f7c84bf22eb90faba4dea9d03c7ef938ddf15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf1be9eee1c4d5d4c24cb273b36d3f7b182ef66ef2f14f2a04564289ec8589e6fc0b3026fe5fad532c5a67292363fc4ed23d70874be05ea55c0695c5d8de05a9
|
7
|
+
data.tar.gz: 157c396fe379003c43451c1c557289dced2348c77ac6cc6d27db7de17fddcb10bc89782c6db958fb8d4311c217300fc25c3dc64d94c22374c9ac09f8ad38b3f1
|
data/README.md
CHANGED
@@ -85,6 +85,9 @@ You may use MacPorts, Homebrew, or a native MySQL installer package. The most
|
|
85
85
|
common paths will be automatically searched. If you want to select a specific
|
86
86
|
MySQL directory, use the `--with-mysql-dir` or `--with-mysql-config` options above.
|
87
87
|
|
88
|
+
If you have not done so already, you will need to install the XCode select tools by running
|
89
|
+
`xcode-select --install`.
|
90
|
+
|
88
91
|
### Windows
|
89
92
|
Make sure that you have Ruby and the DevKit compilers installed. We recommend
|
90
93
|
the [Ruby Installer](http://rubyinstaller.org) distribution.
|
data/ext/mysql2/client.c
CHANGED
@@ -111,7 +111,7 @@ static VALUE rb_set_ssl_mode_option(VALUE self, VALUE setting) {
|
|
111
111
|
int val = NUM2INT( setting );
|
112
112
|
if (version >= 50703 && version < 50711) {
|
113
113
|
if (val == SSL_MODE_DISABLED || val == SSL_MODE_REQUIRED) {
|
114
|
-
|
114
|
+
bool b = ( val == SSL_MODE_REQUIRED );
|
115
115
|
int result = mysql_options( wrapper->client, MYSQL_OPT_SSL_ENFORCE, &b );
|
116
116
|
return INT2NUM(result);
|
117
117
|
|
@@ -504,7 +504,7 @@ static VALUE do_send_query(void *args) {
|
|
504
504
|
*/
|
505
505
|
static void *nogvl_read_query_result(void *ptr) {
|
506
506
|
MYSQL * client = ptr;
|
507
|
-
|
507
|
+
bool res = mysql_read_query_result(client);
|
508
508
|
|
509
509
|
return (void *)(res == 0 ? Qtrue : Qfalse);
|
510
510
|
}
|
@@ -596,9 +596,11 @@ static VALUE disconnect_and_raise(VALUE self, VALUE error) {
|
|
596
596
|
/* Invalidate the MySQL socket to prevent further communication.
|
597
597
|
* The GC will come along later and call mysql_close to free it.
|
598
598
|
*/
|
599
|
-
if (
|
600
|
-
|
601
|
-
|
599
|
+
if (wrapper->client) {
|
600
|
+
if (invalidate_fd(wrapper->client->net.fd) == Qfalse) {
|
601
|
+
fprintf(stderr, "[WARN] mysql2 failed to invalidate FD safely, closing unsafely\n");
|
602
|
+
close(wrapper->client->net.fd);
|
603
|
+
}
|
602
604
|
}
|
603
605
|
|
604
606
|
rb_exc_raise(error);
|
@@ -647,26 +649,30 @@ static VALUE do_query(void *args) {
|
|
647
649
|
|
648
650
|
return Qnil;
|
649
651
|
}
|
650
|
-
#
|
651
|
-
static VALUE finish_and_mark_inactive(void *args) {
|
652
|
-
VALUE self = args;
|
653
|
-
MYSQL_RES *result;
|
652
|
+
#endif
|
654
653
|
|
654
|
+
static VALUE disconnect_and_mark_inactive(VALUE self) {
|
655
655
|
GET_CLIENT(self);
|
656
656
|
|
657
|
+
/* Check if execution terminated while result was still being read. */
|
657
658
|
if (!NIL_P(wrapper->active_thread)) {
|
658
|
-
/*
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
659
|
+
/* Invalidate the MySQL socket to prevent further communication. */
|
660
|
+
#ifndef _WIN32
|
661
|
+
if (invalidate_fd(wrapper->client->net.fd) == Qfalse) {
|
662
|
+
rb_warn("mysql2 failed to invalidate FD safely, closing unsafely\n");
|
663
|
+
close(wrapper->client->net.fd);
|
664
|
+
}
|
665
|
+
#else
|
666
|
+
close(wrapper->client->net.fd);
|
667
|
+
#endif
|
668
|
+
/* Skip mysql client check performed before command execution. */
|
669
|
+
wrapper->client->status = MYSQL_STATUS_READY;
|
664
670
|
wrapper->active_thread = Qnil;
|
671
|
+
wrapper->connected = 0;
|
665
672
|
}
|
666
673
|
|
667
674
|
return Qnil;
|
668
675
|
}
|
669
|
-
#endif
|
670
676
|
|
671
677
|
void rb_mysql_client_set_active_thread(VALUE self) {
|
672
678
|
VALUE thread_current = rb_thread_current();
|
@@ -760,13 +766,13 @@ static VALUE rb_query(VALUE self, VALUE sql, VALUE current) {
|
|
760
766
|
|
761
767
|
rb_rescue2(do_query, (VALUE)&async_args, disconnect_and_raise, self, rb_eException, (VALUE)0);
|
762
768
|
|
763
|
-
return rb_mysql_client_async_result
|
769
|
+
return rb_ensure(rb_mysql_client_async_result, self, disconnect_and_mark_inactive, self);
|
764
770
|
}
|
765
771
|
#else
|
766
772
|
do_send_query(&args);
|
767
773
|
|
768
774
|
/* this will just block until the result is ready */
|
769
|
-
return rb_ensure(rb_mysql_client_async_result, self,
|
775
|
+
return rb_ensure(rb_mysql_client_async_result, self, disconnect_and_mark_inactive, self);
|
770
776
|
#endif
|
771
777
|
}
|
772
778
|
|
@@ -825,7 +831,7 @@ static VALUE _mysql_client_options(VALUE self, int opt, VALUE value) {
|
|
825
831
|
const void *retval = NULL;
|
826
832
|
unsigned int intval = 0;
|
827
833
|
const char * charval = NULL;
|
828
|
-
|
834
|
+
bool boolval;
|
829
835
|
|
830
836
|
GET_CLIENT(self);
|
831
837
|
|
data/ext/mysql2/result.c
CHANGED
@@ -262,8 +262,8 @@ static void rb_mysql_result_alloc_result_buffers(VALUE self, MYSQL_FIELD *fields
|
|
262
262
|
if (wrapper->result_buffers != NULL) return;
|
263
263
|
|
264
264
|
wrapper->result_buffers = xcalloc(wrapper->numberOfFields, sizeof(MYSQL_BIND));
|
265
|
-
wrapper->is_null = xcalloc(wrapper->numberOfFields, sizeof(
|
266
|
-
wrapper->error = xcalloc(wrapper->numberOfFields, sizeof(
|
265
|
+
wrapper->is_null = xcalloc(wrapper->numberOfFields, sizeof(bool));
|
266
|
+
wrapper->error = xcalloc(wrapper->numberOfFields, sizeof(bool));
|
267
267
|
wrapper->length = xcalloc(wrapper->numberOfFields, sizeof(unsigned long));
|
268
268
|
|
269
269
|
for (i = 0; i < wrapper->numberOfFields; i++) {
|
data/ext/mysql2/result.h
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#ifndef MYSQL2_RESULT_H
|
2
2
|
#define MYSQL2_RESULT_H
|
3
|
+
#include <stdbool.h>
|
3
4
|
|
4
5
|
void init_mysql2_result(void);
|
5
6
|
VALUE rb_mysql_result_to_obj(VALUE client, VALUE encoding, VALUE options, MYSQL_RES *r, VALUE statement);
|
@@ -21,8 +22,8 @@ typedef struct {
|
|
21
22
|
mysql_client_wrapper *client_wrapper;
|
22
23
|
/* statement result bind buffers */
|
23
24
|
MYSQL_BIND *result_buffers;
|
24
|
-
|
25
|
-
|
25
|
+
bool *is_null;
|
26
|
+
bool *error;
|
26
27
|
unsigned long *length;
|
27
28
|
} mysql2_result_wrapper;
|
28
29
|
|
data/ext/mysql2/statement.c
CHANGED
@@ -124,7 +124,7 @@ VALUE rb_mysql_stmt_new(VALUE rb_client, VALUE sql) {
|
|
124
124
|
|
125
125
|
// set STMT_ATTR_UPDATE_MAX_LENGTH attr
|
126
126
|
{
|
127
|
-
|
127
|
+
bool truth = 1;
|
128
128
|
if (mysql_stmt_attr_set(stmt_wrapper->stmt, STMT_ATTR_UPDATE_MAX_LENGTH, &truth)) {
|
129
129
|
rb_raise(cMysql2Error, "Unable to initialize prepared statement: set STMT_ATTR_UPDATE_MAX_LENGTH");
|
130
130
|
}
|
data/lib/mysql2/1.8/mysql2.so
CHANGED
Binary file
|
data/lib/mysql2/1.9/mysql2.so
CHANGED
Binary file
|
data/lib/mysql2/2.0/mysql2.so
CHANGED
Binary file
|
data/lib/mysql2/2.1/mysql2.so
CHANGED
Binary file
|
data/lib/mysql2/2.2/mysql2.so
CHANGED
Binary file
|
data/lib/mysql2/2.3/mysql2.so
CHANGED
Binary file
|
data/lib/mysql2/client.rb
CHANGED
@@ -37,7 +37,7 @@ module Mysql2
|
|
37
37
|
when :reconnect, :local_infile, :secure_auth, :automatic_close
|
38
38
|
send(:"#{key}=", !!opts[key]) # rubocop:disable Style/DoubleNegation
|
39
39
|
when :connect_timeout, :read_timeout, :write_timeout
|
40
|
-
send(:"#{key}=", opts[key]
|
40
|
+
send(:"#{key}=", Integer(opts[key])) unless opts[key].nil?
|
41
41
|
else
|
42
42
|
send(:"#{key}=", opts[key])
|
43
43
|
end
|
data/lib/mysql2/version.rb
CHANGED
data/spec/mysql2/client_spec.rb
CHANGED
@@ -538,15 +538,6 @@ RSpec.describe Mysql2::Client do
|
|
538
538
|
}.to raise_error(Mysql2::Error)
|
539
539
|
end
|
540
540
|
|
541
|
-
it 'should be impervious to connection-corrupting timeouts in #query' do
|
542
|
-
pending('`Thread.handle_interrupt` is not defined') unless Thread.respond_to?(:handle_interrupt)
|
543
|
-
# attempt to break the connection
|
544
|
-
expect { Timeout.timeout(0.1) { @client.query('SELECT SLEEP(0.2)') } }.to raise_error(Timeout::Error)
|
545
|
-
|
546
|
-
# expect the connection to not be broken
|
547
|
-
expect { @client.query('SELECT 1') }.to_not raise_error
|
548
|
-
end
|
549
|
-
|
550
541
|
it 'should be impervious to connection-corrupting timeouts in #execute' do
|
551
542
|
# the statement handle gets corrupted and will segfault the tests if interrupted,
|
552
543
|
# so we can't even use pending on this test, really have to skip it on older Rubies.
|
data/vendor/libmysql.dll
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mysql2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: x86-mingw32
|
6
6
|
authors:
|
7
7
|
- Brian Lopez
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-05-04 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email:
|
@@ -91,11 +91,11 @@ post_install_message: |2+
|
|
91
91
|
======================================================================================================
|
92
92
|
|
93
93
|
You've installed the binary version of mysql2.
|
94
|
-
It was built using MySQL Connector/C version 6.1.
|
94
|
+
It was built using MySQL Connector/C version 6.1.9.
|
95
95
|
It's recommended to use the exact same version to avoid potential issues.
|
96
96
|
|
97
97
|
At the time of building this gem, the necessary DLL files were retrieved from:
|
98
|
-
http://cdn.mysql.com/Downloads/Connector-C/mysql-connector-c-6.1.
|
98
|
+
http://cdn.mysql.com/Downloads/Connector-C/mysql-connector-c-6.1.9-win32.zip
|
99
99
|
|
100
100
|
This gem *includes* vendor/libmysql.dll with redistribution notice in vendor/README.
|
101
101
|
|