mysql2 0.4.3-x64-mingw32 → 0.4.4-x64-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 +6 -6
- data/ext/mysql2/result.c +18 -16
- 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/version.rb +1 -1
- data/spec/mysql2/client_spec.rb +4 -4
- data/spec/mysql2/result_spec.rb +5 -0
- data/spec/mysql2/statement_spec.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78a3c50c356b8282160771687048af69689a49ff
|
4
|
+
data.tar.gz: 16470c86222b19de7edf602a009d304825d60d75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7b5d5682af838858343a74a789691dc967ab5f11bc7524b8e41a567155c0bc170a76b8f853140100aa81afdef535310d445f82fb5e64228f5ca80186e11bf15
|
7
|
+
data.tar.gz: 261e040b1337b0906261db18c92b0dd5e0928782728da5a193a50d94d32b7432aef80f37fbd0f0c76a291f17cbfc5ecaf9278f67d7013f05cf6f0c2abc88338b
|
data/README.md
CHANGED
@@ -484,9 +484,9 @@ As for field values themselves, I'm workin on it - but expect that soon.
|
|
484
484
|
|
485
485
|
This gem is tested with the following Ruby versions on Linux and Mac OS X:
|
486
486
|
|
487
|
-
* Ruby MRI 1.8.7, 1.9.3, 2.0.0, 2.1.x, 2.2.x
|
487
|
+
* Ruby MRI 1.8.7, 1.9.3, 2.0.0, 2.1.x, 2.2.x, 2.3.x
|
488
488
|
* Ruby Enterprise Edition (based on MRI 1.8.7)
|
489
|
-
* Rubinius 2.x
|
489
|
+
* Rubinius 2.x, 3.x
|
490
490
|
|
491
491
|
This gem is tested with the following MySQL and MariaDB versions:
|
492
492
|
|
@@ -494,11 +494,11 @@ This gem is tested with the following MySQL and MariaDB versions:
|
|
494
494
|
* MySQL Connector/C 6.0 and 6.1 (primarily on Windows)
|
495
495
|
* MariaDB 5.5, 10.0, 10.1
|
496
496
|
|
497
|
-
### Rails / Active Record
|
497
|
+
### Ruby on Rails / Active Record
|
498
498
|
|
499
|
-
* mysql2 0.4.x works with Active Record 4.2.5 and higher.
|
500
|
-
* mysql2 0.3.x works with Active Record 3.1
|
501
|
-
* mysql2 0.2.x
|
499
|
+
* mysql2 0.4.x works with Rails / Active Record 4.2.5 - 5.0 and higher.
|
500
|
+
* mysql2 0.3.x works with Rails / Active Record 3.1, 3.2, 4.x, 5.0.
|
501
|
+
* mysql2 0.2.x works with Rails / Active Record 2.3 - 3.0.
|
502
502
|
|
503
503
|
### Asynchronous Active Record
|
504
504
|
|
data/ext/mysql2/result.c
CHANGED
@@ -346,15 +346,15 @@ static VALUE rb_mysql_result_fetch_row_stmt(VALUE self, MYSQL_FIELD * fields, co
|
|
346
346
|
conn_enc = rb_to_encoding(wrapper->encoding);
|
347
347
|
#endif
|
348
348
|
|
349
|
+
if (wrapper->fields == Qnil) {
|
350
|
+
wrapper->numberOfFields = mysql_num_fields(wrapper->result);
|
351
|
+
wrapper->fields = rb_ary_new2(wrapper->numberOfFields);
|
352
|
+
}
|
349
353
|
if (args->asArray) {
|
350
354
|
rowVal = rb_ary_new2(wrapper->numberOfFields);
|
351
355
|
} else {
|
352
356
|
rowVal = rb_hash_new();
|
353
357
|
}
|
354
|
-
if (wrapper->fields == Qnil) {
|
355
|
-
wrapper->numberOfFields = mysql_num_fields(wrapper->result);
|
356
|
-
wrapper->fields = rb_ary_new2(wrapper->numberOfFields);
|
357
|
-
}
|
358
358
|
|
359
359
|
if (wrapper->result_buffers == NULL) {
|
360
360
|
rb_mysql_result_alloc_result_buffers(self, fields);
|
@@ -541,16 +541,16 @@ static VALUE rb_mysql_result_fetch_row(VALUE self, MYSQL_FIELD * fields, const r
|
|
541
541
|
return Qnil;
|
542
542
|
}
|
543
543
|
|
544
|
+
if (wrapper->fields == Qnil) {
|
545
|
+
wrapper->numberOfFields = mysql_num_fields(wrapper->result);
|
546
|
+
wrapper->fields = rb_ary_new2(wrapper->numberOfFields);
|
547
|
+
}
|
544
548
|
if (args->asArray) {
|
545
549
|
rowVal = rb_ary_new2(wrapper->numberOfFields);
|
546
550
|
} else {
|
547
551
|
rowVal = rb_hash_new();
|
548
552
|
}
|
549
553
|
fieldLengths = mysql_fetch_lengths(wrapper->result);
|
550
|
-
if (wrapper->fields == Qnil) {
|
551
|
-
wrapper->numberOfFields = mysql_num_fields(wrapper->result);
|
552
|
-
wrapper->fields = rb_ary_new2(wrapper->numberOfFields);
|
553
|
-
}
|
554
554
|
|
555
555
|
for (i = 0; i < wrapper->numberOfFields; i++) {
|
556
556
|
VALUE field = rb_mysql_result_fetch_field(self, i, args->symbolizeKeys);
|
@@ -834,7 +834,9 @@ static VALUE rb_mysql_result_each_(VALUE self,
|
|
834
834
|
|
835
835
|
if (row == Qnil) {
|
836
836
|
/* we don't need the mysql C dataset around anymore, peace it */
|
837
|
-
|
837
|
+
if (args->cacheRows) {
|
838
|
+
rb_mysql_result_free_result(wrapper);
|
839
|
+
}
|
838
840
|
return Qnil;
|
839
841
|
}
|
840
842
|
|
@@ -842,7 +844,7 @@ static VALUE rb_mysql_result_each_(VALUE self,
|
|
842
844
|
rb_yield(row);
|
843
845
|
}
|
844
846
|
}
|
845
|
-
if (wrapper->lastRowProcessed == wrapper->numberOfRows) {
|
847
|
+
if (wrapper->lastRowProcessed == wrapper->numberOfRows && args->cacheRows) {
|
846
848
|
/* we don't need the mysql C dataset around anymore, peace it */
|
847
849
|
rb_mysql_result_free_result(wrapper);
|
848
850
|
}
|
@@ -886,6 +888,7 @@ static VALUE rb_mysql_result_each(int argc, VALUE * argv, VALUE self) {
|
|
886
888
|
|
887
889
|
if (wrapper->stmt_wrapper && !cacheRows && !wrapper->is_streaming) {
|
888
890
|
rb_warn(":cache_rows is forced for prepared statements (if not streaming)");
|
891
|
+
cacheRows = 1;
|
889
892
|
}
|
890
893
|
|
891
894
|
if (wrapper->stmt_wrapper && !cast) {
|
@@ -913,13 +916,12 @@ static VALUE rb_mysql_result_each(int argc, VALUE * argv, VALUE self) {
|
|
913
916
|
app_timezone = Qnil;
|
914
917
|
}
|
915
918
|
|
916
|
-
if (wrapper->
|
919
|
+
if (wrapper->rows == Qnil && !wrapper->is_streaming) {
|
917
920
|
wrapper->numberOfRows = wrapper->stmt_wrapper ? mysql_stmt_num_rows(wrapper->stmt_wrapper->stmt) : mysql_num_rows(wrapper->result);
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
}
|
921
|
+
wrapper->rows = rb_ary_new2(wrapper->numberOfRows);
|
922
|
+
} else if (wrapper->rows && !cacheRows) {
|
923
|
+
mysql_data_seek(wrapper->result, 0);
|
924
|
+
wrapper->lastRowProcessed = 0;
|
923
925
|
wrapper->rows = rb_ary_new2(wrapper->numberOfRows);
|
924
926
|
}
|
925
927
|
|
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/version.rb
CHANGED
data/spec/mysql2/client_spec.rb
CHANGED
@@ -382,24 +382,24 @@ RSpec.describe Mysql2::Client do
|
|
382
382
|
|
383
383
|
it "should expect connect_timeout to be a positive integer" do
|
384
384
|
expect {
|
385
|
-
Mysql2::Client.new(:connect_timeout => -1)
|
385
|
+
Mysql2::Client.new(DatabaseCredentials['root'].merge(:connect_timeout => -1))
|
386
386
|
}.to raise_error(Mysql2::Error)
|
387
387
|
end
|
388
388
|
|
389
389
|
it "should expect read_timeout to be a positive integer" do
|
390
390
|
expect {
|
391
|
-
Mysql2::Client.new(:read_timeout => -1)
|
391
|
+
Mysql2::Client.new(DatabaseCredentials['root'].merge(:read_timeout => -1))
|
392
392
|
}.to raise_error(Mysql2::Error)
|
393
393
|
end
|
394
394
|
|
395
395
|
it "should expect write_timeout to be a positive integer" do
|
396
396
|
expect {
|
397
|
-
Mysql2::Client.new(:write_timeout => -1)
|
397
|
+
Mysql2::Client.new(DatabaseCredentials['root'].merge(:write_timeout => -1))
|
398
398
|
}.to raise_error(Mysql2::Error)
|
399
399
|
end
|
400
400
|
|
401
401
|
it "should allow nil read_timeout" do
|
402
|
-
client = Mysql2::Client.new(:read_timeout => nil)
|
402
|
+
client = Mysql2::Client.new(DatabaseCredentials['root'].merge(:read_timeout => nil))
|
403
403
|
|
404
404
|
expect(client.read_timeout).to be_nil
|
405
405
|
end
|
data/spec/mysql2/result_spec.rb
CHANGED
@@ -82,6 +82,11 @@ RSpec.describe Mysql2::Result do
|
|
82
82
|
expect(result.first.object_id).not_to eql(result.first.object_id)
|
83
83
|
end
|
84
84
|
|
85
|
+
it "should be able to iterate a second time even if cache_rows is disabled" do
|
86
|
+
result = @client.query "SELECT 1 UNION SELECT 2", :cache_rows => false
|
87
|
+
expect(result.to_a).to eql(result.to_a)
|
88
|
+
end
|
89
|
+
|
85
90
|
it "should yield different value for #first if streaming" do
|
86
91
|
result = @client.query "SELECT 1 UNION SELECT 2", :stream => true, :cache_rows => false
|
87
92
|
expect(result.first).not_to eql(result.first)
|
@@ -128,6 +128,14 @@ RSpec.describe Mysql2::Statement do
|
|
128
128
|
expect(test_result['decimal_test']).to eql(123.45)
|
129
129
|
end
|
130
130
|
|
131
|
+
it "should warn but still work if cache_rows is set to false" do
|
132
|
+
@client.query_options.merge!(:cache_rows => false)
|
133
|
+
statement = @client.prepare 'SELECT 1'
|
134
|
+
result = nil
|
135
|
+
expect { result = statement.execute.to_a }.to output(/:cache_rows is forced for prepared statements/).to_stderr
|
136
|
+
expect(result.length).to eq(1)
|
137
|
+
end
|
138
|
+
|
131
139
|
context "utf8_db" do
|
132
140
|
before(:each) do
|
133
141
|
@client.query("DROP DATABASE IF EXISTS test_mysql2_stmt_utf8")
|
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.4
|
5
5
|
platform: x64-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: 2016-
|
12
|
+
date: 2016-04-19 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email:
|