mysql2 0.4.6-x86-mswin32-60 → 0.4.7-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/README.md +57 -42
- data/ext/mysql2/client.c +55 -23
- data/ext/mysql2/client.h +1 -2
- data/ext/mysql2/extconf.rb +5 -2
- data/ext/mysql2/mysql2_ext.h +2 -0
- data/ext/mysql2/statement.c +13 -2
- 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 +3 -3
- data/lib/mysql2/version.rb +1 -1
- data/spec/em/em_spec.rb +1 -0
- data/spec/mysql2/client_spec.rb +119 -72
- data/spec/mysql2/error_spec.rb +3 -5
- data/spec/mysql2/result_spec.rb +7 -12
- data/spec/mysql2/statement_spec.rb +13 -15
- data/spec/spec_helper.rb +73 -59
- data/vendor/libmysql.dll +0 -0
- metadata +4 -4
data/spec/mysql2/error_spec.rb
CHANGED
@@ -3,11 +3,9 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Mysql2::Error do
|
6
|
-
let(:client) { Mysql2::Client.new(DatabaseCredentials['root']) }
|
7
|
-
|
8
6
|
let(:error) do
|
9
7
|
begin
|
10
|
-
client.query("HAHAHA")
|
8
|
+
@client.query("HAHAHA")
|
11
9
|
rescue Mysql2::Error => e
|
12
10
|
error = e
|
13
11
|
end
|
@@ -28,7 +26,7 @@ RSpec.describe Mysql2::Error do
|
|
28
26
|
let(:valid_utf8) { '造字' }
|
29
27
|
let(:error) do
|
30
28
|
begin
|
31
|
-
client.query(valid_utf8)
|
29
|
+
@client.query(valid_utf8)
|
32
30
|
rescue Mysql2::Error => e
|
33
31
|
e
|
34
32
|
end
|
@@ -37,7 +35,7 @@ RSpec.describe Mysql2::Error do
|
|
37
35
|
let(:invalid_utf8) { ["e5c67d1f"].pack('H*').force_encoding(Encoding::UTF_8) }
|
38
36
|
let(:bad_err) do
|
39
37
|
begin
|
40
|
-
client.query(invalid_utf8)
|
38
|
+
@client.query(invalid_utf8)
|
41
39
|
rescue Mysql2::Error => e
|
42
40
|
e
|
43
41
|
end
|
data/spec/mysql2/result_spec.rb
CHANGED
@@ -153,18 +153,16 @@ RSpec.describe Mysql2::Result do
|
|
153
153
|
end
|
154
154
|
|
155
155
|
it "should raise an exception if streaming ended due to a timeout" do
|
156
|
-
|
157
|
-
client = Mysql2::Client.new DatabaseCredentials['root']
|
158
|
-
client.query "CREATE TEMPORARY TABLE streamingTest (val BINARY(255)) ENGINE=MEMORY"
|
156
|
+
@client.query "CREATE TEMPORARY TABLE streamingTest (val BINARY(255)) ENGINE=MEMORY"
|
159
157
|
|
160
158
|
# Insert enough records to force the result set into multiple reads
|
161
159
|
# (the BINARY type is used simply because it forces full width results)
|
162
160
|
10000.times do |i|
|
163
|
-
client.query "INSERT INTO streamingTest (val) VALUES ('Foo #{i}')"
|
161
|
+
@client.query "INSERT INTO streamingTest (val) VALUES ('Foo #{i}')"
|
164
162
|
end
|
165
163
|
|
166
|
-
client.query "SET net_write_timeout = 1"
|
167
|
-
res = client.query "SELECT * FROM streamingTest", :stream => true, :cache_rows => false
|
164
|
+
@client.query "SET net_write_timeout = 1"
|
165
|
+
res = @client.query "SELECT * FROM streamingTest", :stream => true, :cache_rows => false
|
168
166
|
|
169
167
|
expect {
|
170
168
|
res.each_with_index do |_, i|
|
@@ -367,10 +365,9 @@ RSpec.describe Mysql2::Result do
|
|
367
365
|
result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
|
368
366
|
expect(result['enum_test'].encoding).to eql(Encoding::UTF_8)
|
369
367
|
|
370
|
-
client2 =
|
368
|
+
client2 = new_client(:encoding => 'ascii')
|
371
369
|
result = client2.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
|
372
370
|
expect(result['enum_test'].encoding).to eql(Encoding::ASCII)
|
373
|
-
client2.close
|
374
371
|
end
|
375
372
|
end
|
376
373
|
|
@@ -400,10 +397,9 @@ RSpec.describe Mysql2::Result do
|
|
400
397
|
result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
|
401
398
|
expect(result['set_test'].encoding).to eql(Encoding::UTF_8)
|
402
399
|
|
403
|
-
client2 =
|
400
|
+
client2 = new_client(:encoding => 'ascii')
|
404
401
|
result = client2.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
|
405
402
|
expect(result['set_test'].encoding).to eql(Encoding::ASCII)
|
406
|
-
client2.close
|
407
403
|
end
|
408
404
|
end
|
409
405
|
|
@@ -494,10 +490,9 @@ RSpec.describe Mysql2::Result do
|
|
494
490
|
result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
|
495
491
|
expect(result[field].encoding).to eql(Encoding::UTF_8)
|
496
492
|
|
497
|
-
client2 =
|
493
|
+
client2 = new_client(:encoding => 'ascii')
|
498
494
|
result = client2.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
|
499
495
|
expect(result[field].encoding).to eql(Encoding::ASCII)
|
500
|
-
client2.close
|
501
496
|
end
|
502
497
|
end
|
503
498
|
|
@@ -3,7 +3,7 @@ require './spec/spec_helper.rb'
|
|
3
3
|
|
4
4
|
RSpec.describe Mysql2::Statement do
|
5
5
|
before :each do
|
6
|
-
@client =
|
6
|
+
@client = new_client(:encoding => "utf8")
|
7
7
|
end
|
8
8
|
|
9
9
|
def stmt_count
|
@@ -326,18 +326,19 @@ RSpec.describe Mysql2::Statement do
|
|
326
326
|
end
|
327
327
|
|
328
328
|
context "#fields" do
|
329
|
-
before(:each) do
|
330
|
-
@client.query "USE test"
|
331
|
-
@test_result = @client.prepare("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").execute
|
332
|
-
end
|
333
|
-
|
334
329
|
it "method should exist" do
|
335
|
-
|
330
|
+
stmt = @client.prepare("SELECT 1")
|
331
|
+
expect(stmt).to respond_to(:fields)
|
336
332
|
end
|
337
333
|
|
338
334
|
it "should return an array of field names in proper order" do
|
339
|
-
|
340
|
-
expect(
|
335
|
+
stmt = @client.prepare("SELECT 'a', 'b', 'c'")
|
336
|
+
expect(stmt.fields).to eql(%w(a b c))
|
337
|
+
end
|
338
|
+
|
339
|
+
it "should return nil for statement with no result fields" do
|
340
|
+
stmt = @client.prepare("INSERT INTO mysql2_test () VALUES ()")
|
341
|
+
expect(stmt.fields).to eql(nil)
|
341
342
|
end
|
342
343
|
end
|
343
344
|
|
@@ -524,10 +525,9 @@ RSpec.describe Mysql2::Statement do
|
|
524
525
|
result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
|
525
526
|
expect(result['enum_test'].encoding).to eql(Encoding::UTF_8)
|
526
527
|
|
527
|
-
client2 =
|
528
|
+
client2 = new_client(:encoding => 'ascii')
|
528
529
|
result = client2.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
|
529
530
|
expect(result['enum_test'].encoding).to eql(Encoding::US_ASCII)
|
530
|
-
client2.close
|
531
531
|
end
|
532
532
|
end
|
533
533
|
|
@@ -557,10 +557,9 @@ RSpec.describe Mysql2::Statement do
|
|
557
557
|
result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
|
558
558
|
expect(result['set_test'].encoding).to eql(Encoding::UTF_8)
|
559
559
|
|
560
|
-
client2 =
|
560
|
+
client2 = new_client(:encoding => 'ascii')
|
561
561
|
result = client2.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
|
562
562
|
expect(result['set_test'].encoding).to eql(Encoding::US_ASCII)
|
563
|
-
client2.close
|
564
563
|
end
|
565
564
|
end
|
566
565
|
|
@@ -651,10 +650,9 @@ RSpec.describe Mysql2::Statement do
|
|
651
650
|
result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
|
652
651
|
expect(result[field].encoding).to eql(Encoding::UTF_8)
|
653
652
|
|
654
|
-
client2 =
|
653
|
+
client2 = new_client(:encoding => 'ascii')
|
655
654
|
result = client2.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first
|
656
655
|
expect(result[field].encoding).to eql(Encoding::US_ASCII)
|
657
|
-
client2.close
|
658
656
|
end
|
659
657
|
end
|
660
658
|
|
data/spec/spec_helper.rb
CHANGED
@@ -23,72 +23,86 @@ RSpec.configure do |config|
|
|
23
23
|
$VERBOSE = old_verbose
|
24
24
|
end
|
25
25
|
|
26
|
+
def new_client(option_overrides = {})
|
27
|
+
client = Mysql2::Client.new(DatabaseCredentials['root'].merge(option_overrides))
|
28
|
+
@clients ||= []
|
29
|
+
@clients << client
|
30
|
+
return client unless block_given?
|
31
|
+
begin
|
32
|
+
yield client
|
33
|
+
ensure
|
34
|
+
client.close
|
35
|
+
@clients.delete(client)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
26
39
|
config.before :each do
|
27
|
-
@client =
|
40
|
+
@client = new_client
|
28
41
|
end
|
29
42
|
|
30
43
|
config.after :each do
|
31
|
-
@
|
44
|
+
@clients.each(&:close)
|
32
45
|
end
|
33
46
|
|
34
47
|
config.before(:all) do
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
48
|
+
new_client do |client|
|
49
|
+
client.query %[
|
50
|
+
CREATE TABLE IF NOT EXISTS mysql2_test (
|
51
|
+
id MEDIUMINT NOT NULL AUTO_INCREMENT,
|
52
|
+
null_test VARCHAR(10),
|
53
|
+
bit_test BIT(64),
|
54
|
+
single_bit_test BIT(1),
|
55
|
+
tiny_int_test TINYINT,
|
56
|
+
bool_cast_test TINYINT(1),
|
57
|
+
small_int_test SMALLINT,
|
58
|
+
medium_int_test MEDIUMINT,
|
59
|
+
int_test INT,
|
60
|
+
big_int_test BIGINT,
|
61
|
+
float_test FLOAT(10,3),
|
62
|
+
float_zero_test FLOAT(10,3),
|
63
|
+
double_test DOUBLE(10,3),
|
64
|
+
decimal_test DECIMAL(10,3),
|
65
|
+
decimal_zero_test DECIMAL(10,3),
|
66
|
+
date_test DATE,
|
67
|
+
date_time_test DATETIME,
|
68
|
+
timestamp_test TIMESTAMP,
|
69
|
+
time_test TIME,
|
70
|
+
year_test YEAR(4),
|
71
|
+
char_test CHAR(10),
|
72
|
+
varchar_test VARCHAR(10),
|
73
|
+
binary_test BINARY(10),
|
74
|
+
varbinary_test VARBINARY(10),
|
75
|
+
tiny_blob_test TINYBLOB,
|
76
|
+
tiny_text_test TINYTEXT,
|
77
|
+
blob_test BLOB,
|
78
|
+
text_test TEXT,
|
79
|
+
medium_blob_test MEDIUMBLOB,
|
80
|
+
medium_text_test MEDIUMTEXT,
|
81
|
+
long_blob_test LONGBLOB,
|
82
|
+
long_text_test LONGTEXT,
|
83
|
+
enum_test ENUM('val1', 'val2'),
|
84
|
+
set_test SET('val1', 'val2'),
|
85
|
+
PRIMARY KEY (id)
|
86
|
+
)
|
87
|
+
]
|
88
|
+
client.query "DELETE FROM mysql2_test;"
|
89
|
+
client.query %[
|
90
|
+
INSERT INTO mysql2_test (
|
91
|
+
null_test, bit_test, single_bit_test, tiny_int_test, bool_cast_test, small_int_test, medium_int_test, int_test, big_int_test,
|
92
|
+
float_test, float_zero_test, double_test, decimal_test, decimal_zero_test, date_test, date_time_test, timestamp_test, time_test,
|
93
|
+
year_test, char_test, varchar_test, binary_test, varbinary_test, tiny_blob_test,
|
94
|
+
tiny_text_test, blob_test, text_test, medium_blob_test, medium_text_test,
|
95
|
+
long_blob_test, long_text_test, enum_test, set_test
|
96
|
+
)
|
84
97
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
98
|
+
VALUES (
|
99
|
+
NULL, b'101', b'1', 1, 1, 10, 10, 10, 10,
|
100
|
+
10.3, 0, 10.3, 10.3, 0, '2010-4-4', '2010-4-4 11:44:00', '2010-4-4 11:44:00', '11:44:00',
|
101
|
+
2009, "test", "test", "test", "test", "test",
|
102
|
+
"test", "test", "test", "test", "test",
|
103
|
+
"test", "test", 'val1', 'val1,val2'
|
104
|
+
)
|
105
|
+
]
|
106
|
+
end
|
93
107
|
end
|
94
108
|
end
|
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.7
|
5
5
|
platform: x86-mswin32-60
|
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: 2017-
|
12
|
+
date: 2017-07-01 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.10.
|
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.10-win32.zip
|
99
99
|
|
100
100
|
This gem *includes* vendor/libmysql.dll with redistribution notice in vendor/README.
|
101
101
|
|