mysql2 0.4.10 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +167 -48
- data/ext/mysql2/client.c +335 -108
- data/ext/mysql2/client.h +10 -41
- data/ext/mysql2/extconf.rb +84 -26
- data/ext/mysql2/mysql2_ext.c +8 -2
- data/ext/mysql2/mysql2_ext.h +21 -4
- data/ext/mysql2/mysql_enc_name_to_ruby.h +60 -55
- data/ext/mysql2/mysql_enc_to_ruby.h +79 -3
- data/ext/mysql2/result.c +298 -92
- data/ext/mysql2/result.h +3 -3
- data/ext/mysql2/statement.c +137 -81
- data/ext/mysql2/statement.h +0 -2
- data/ext/mysql2/wait_for_single_fd.h +2 -1
- data/lib/mysql2/client.rb +55 -28
- data/lib/mysql2/em.rb +2 -4
- data/lib/mysql2/error.rb +52 -22
- data/lib/mysql2/result.rb +2 -0
- data/lib/mysql2/statement.rb +3 -11
- data/lib/mysql2/version.rb +1 -1
- data/lib/mysql2.rb +19 -15
- data/support/3A79BD29.asc +49 -0
- data/support/5072E1F5.asc +5 -5
- data/support/C74CD1D8.asc +104 -0
- data/support/mysql_enc_to_ruby.rb +9 -3
- data/support/ruby_enc_to_mysql.rb +8 -5
- metadata +19 -62
- data/examples/eventmachine.rb +0 -21
- data/examples/threaded.rb +0 -18
- data/spec/configuration.yml.example +0 -11
- data/spec/em/em_spec.rb +0 -136
- data/spec/my.cnf.example +0 -9
- data/spec/mysql2/client_spec.rb +0 -1039
- data/spec/mysql2/error_spec.rb +0 -82
- data/spec/mysql2/result_spec.rb +0 -545
- data/spec/mysql2/statement_spec.rb +0 -776
- data/spec/rcov.opts +0 -3
- data/spec/spec_helper.rb +0 -108
- data/spec/ssl/ca-cert.pem +0 -17
- data/spec/ssl/ca-key.pem +0 -27
- data/spec/ssl/ca.cnf +0 -22
- data/spec/ssl/cert.cnf +0 -22
- data/spec/ssl/client-cert.pem +0 -17
- data/spec/ssl/client-key.pem +0 -27
- data/spec/ssl/client-req.pem +0 -15
- data/spec/ssl/gen_certs.sh +0 -48
- data/spec/ssl/pkcs8-client-key.pem +0 -28
- data/spec/ssl/pkcs8-server-key.pem +0 -28
- data/spec/ssl/server-cert.pem +0 -17
- data/spec/ssl/server-key.pem +0 -27
- data/spec/ssl/server-req.pem +0 -15
- data/spec/test_data +0 -1
data/lib/mysql2/error.rb
CHANGED
@@ -1,32 +1,66 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
1
|
module Mysql2
|
4
2
|
class Error < StandardError
|
5
3
|
ENCODE_OPTS = {
|
6
|
-
:
|
7
|
-
:
|
8
|
-
:
|
4
|
+
undef: :replace,
|
5
|
+
invalid: :replace,
|
6
|
+
replace: '?'.freeze,
|
7
|
+
}.freeze
|
8
|
+
|
9
|
+
ConnectionError = Class.new(Error)
|
10
|
+
TimeoutError = Class.new(Error)
|
11
|
+
|
12
|
+
CODES = {
|
13
|
+
1205 => TimeoutError, # ER_LOCK_WAIT_TIMEOUT
|
14
|
+
|
15
|
+
1044 => ConnectionError, # ER_DBACCESS_DENIED_ERROR
|
16
|
+
1045 => ConnectionError, # ER_ACCESS_DENIED_ERROR
|
17
|
+
1152 => ConnectionError, # ER_ABORTING_CONNECTION
|
18
|
+
1153 => ConnectionError, # ER_NET_PACKET_TOO_LARGE
|
19
|
+
1154 => ConnectionError, # ER_NET_READ_ERROR_FROM_PIPE
|
20
|
+
1155 => ConnectionError, # ER_NET_FCNTL_ERROR
|
21
|
+
1156 => ConnectionError, # ER_NET_PACKETS_OUT_OF_ORDER
|
22
|
+
1157 => ConnectionError, # ER_NET_UNCOMPRESS_ERROR
|
23
|
+
1158 => ConnectionError, # ER_NET_READ_ERROR
|
24
|
+
1159 => ConnectionError, # ER_NET_READ_INTERRUPTED
|
25
|
+
1160 => ConnectionError, # ER_NET_ERROR_ON_WRITE
|
26
|
+
1161 => ConnectionError, # ER_NET_WRITE_INTERRUPTED
|
27
|
+
1927 => ConnectionError, # ER_CONNECTION_KILLED
|
28
|
+
|
29
|
+
2001 => ConnectionError, # CR_SOCKET_CREATE_ERROR
|
30
|
+
2002 => ConnectionError, # CR_CONNECTION_ERROR
|
31
|
+
2003 => ConnectionError, # CR_CONN_HOST_ERROR
|
32
|
+
2004 => ConnectionError, # CR_IPSOCK_ERROR
|
33
|
+
2005 => ConnectionError, # CR_UNKNOWN_HOST
|
34
|
+
2006 => ConnectionError, # CR_SERVER_GONE_ERROR
|
35
|
+
2007 => ConnectionError, # CR_VERSION_ERROR
|
36
|
+
2009 => ConnectionError, # CR_WRONG_HOST_INFO
|
37
|
+
2012 => ConnectionError, # CR_SERVER_HANDSHAKE_ERR
|
38
|
+
2013 => ConnectionError, # CR_SERVER_LOST
|
39
|
+
2020 => ConnectionError, # CR_NET_PACKET_TOO_LARGE
|
40
|
+
2026 => ConnectionError, # CR_SSL_CONNECTION_ERROR
|
41
|
+
2027 => ConnectionError, # CR_MALFORMED_PACKET
|
42
|
+
2047 => ConnectionError, # CR_CONN_UNKNOW_PROTOCOL
|
43
|
+
2048 => ConnectionError, # CR_INVALID_CONN_HANDLE
|
44
|
+
2049 => ConnectionError, # CR_UNUSED_1
|
9
45
|
}.freeze
|
10
46
|
|
11
47
|
attr_reader :error_number, :sql_state
|
12
48
|
|
13
49
|
# Mysql gem compatibility
|
14
|
-
|
15
|
-
|
50
|
+
alias errno error_number
|
51
|
+
alias error message
|
16
52
|
|
17
|
-
def initialize(msg)
|
18
|
-
@server_version
|
53
|
+
def initialize(msg, server_version = nil, error_number = nil, sql_state = nil)
|
54
|
+
@server_version = server_version
|
55
|
+
@error_number = error_number
|
56
|
+
@sql_state = sql_state ? sql_state.encode(**ENCODE_OPTS) : nil
|
19
57
|
|
20
58
|
super(clean_message(msg))
|
21
59
|
end
|
22
60
|
|
23
61
|
def self.new_with_args(msg, server_version, error_number, sql_state)
|
24
|
-
|
25
|
-
|
26
|
-
err.instance_variable_set('@error_number', error_number)
|
27
|
-
err.instance_variable_set('@sql_state', sql_state.respond_to?(:encode) ? sql_state.encode(ENCODE_OPTS) : sql_state)
|
28
|
-
err.send(:initialize, msg)
|
29
|
-
err
|
62
|
+
error_class = CODES.fetch(error_number, self)
|
63
|
+
error_class.new(msg, server_version, error_number, sql_state)
|
30
64
|
end
|
31
65
|
|
32
66
|
private
|
@@ -55,16 +89,12 @@ module Mysql2
|
|
55
89
|
# encoding, we'll assume UTF-8 and clean the string of anything that's not a
|
56
90
|
# valid UTF-8 character.
|
57
91
|
#
|
58
|
-
#
|
59
|
-
#
|
60
|
-
# Returns a valid UTF-8 string in Ruby 1.9+, the original string on Ruby 1.8
|
92
|
+
# Returns a valid UTF-8 string.
|
61
93
|
def clean_message(message)
|
62
|
-
return message unless message.respond_to?(:encode)
|
63
|
-
|
64
94
|
if @server_version && @server_version > 50500
|
65
|
-
message.encode(ENCODE_OPTS)
|
95
|
+
message.encode(**ENCODE_OPTS)
|
66
96
|
else
|
67
|
-
message.encode(Encoding::UTF_8, ENCODE_OPTS)
|
97
|
+
message.encode(Encoding::UTF_8, **ENCODE_OPTS)
|
68
98
|
end
|
69
99
|
end
|
70
100
|
end
|
data/lib/mysql2/result.rb
CHANGED
data/lib/mysql2/statement.rb
CHANGED
@@ -1,16 +1,8 @@
|
|
1
1
|
module Mysql2
|
2
2
|
class Statement
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
def execute(*args)
|
7
|
-
Thread.handle_interrupt(::Mysql2::Util::TimeoutError => :never) do
|
8
|
-
_execute(*args)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
else
|
12
|
-
def execute(*args)
|
13
|
-
_execute(*args)
|
3
|
+
def execute(*args, **kwargs)
|
4
|
+
Thread.handle_interrupt(::Mysql2::Util::TIMEOUT_ERROR_NEVER) do
|
5
|
+
_execute(*args, **kwargs)
|
14
6
|
end
|
15
7
|
end
|
16
8
|
end
|
data/lib/mysql2/version.rb
CHANGED
data/lib/mysql2.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
# encoding: UTF-8
|
2
1
|
require 'date'
|
3
2
|
require 'bigdecimal'
|
4
|
-
require 'rational' unless RUBY_VERSION >= '1.9.2'
|
5
3
|
|
6
4
|
# Load libmysql.dll before requiring mysql2/mysql2.so
|
7
5
|
# This gives a chance to be flexible about the load path
|
@@ -13,16 +11,23 @@ if RUBY_PLATFORM =~ /mswin|mingw/
|
|
13
11
|
ENV['RUBY_MYSQL2_LIBMYSQL_DLL']
|
14
12
|
elsif File.exist?(File.expand_path('../vendor/libmysql.dll', File.dirname(__FILE__)))
|
15
13
|
# Use vendor/libmysql.dll if it exists, convert slashes for Win32 LoadLibrary
|
16
|
-
File.expand_path('../vendor/libmysql.dll', File.dirname(__FILE__))
|
14
|
+
File.expand_path('../vendor/libmysql.dll', File.dirname(__FILE__))
|
15
|
+
elsif defined?(RubyInstaller)
|
16
|
+
# RubyInstaller-2.4+ native build doesn't need DLL preloading
|
17
17
|
else
|
18
18
|
# This will use default / system library paths
|
19
19
|
'libmysql.dll'
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
if dll_path
|
23
|
+
require 'fiddle'
|
24
|
+
kernel32 = Fiddle.dlopen 'kernel32'
|
25
|
+
load_library = Fiddle::Function.new(
|
26
|
+
kernel32['LoadLibraryW'], [Fiddle::TYPE_VOIDP], Fiddle::TYPE_INT,
|
27
|
+
)
|
28
|
+
if load_library.call(dll_path.encode('utf-16le')).zero?
|
29
|
+
abort "Failed to load libmysql.dll from #{dll_path}"
|
30
|
+
end
|
26
31
|
end
|
27
32
|
end
|
28
33
|
|
@@ -60,6 +65,7 @@ module Mysql2
|
|
60
65
|
#
|
61
66
|
def self.key_hash_as_symbols(hash)
|
62
67
|
return nil unless hash
|
68
|
+
|
63
69
|
Hash[hash.map { |k, v| [k.to_sym, v] }]
|
64
70
|
end
|
65
71
|
|
@@ -71,14 +77,12 @@ module Mysql2
|
|
71
77
|
# Timeout::ExitException was removed in Ruby 2.3.0, 2.2.3, and 2.1.8,
|
72
78
|
# but is present in earlier 2.1.x and 2.2.x, so we provide a shim.
|
73
79
|
#
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
else
|
80
|
-
::Timeout::Error
|
81
|
-
end
|
80
|
+
require 'timeout'
|
81
|
+
TIMEOUT_ERROR_CLASS = if defined?(::Timeout::ExitException)
|
82
|
+
::Timeout::ExitException
|
83
|
+
else
|
84
|
+
::Timeout::Error
|
82
85
|
end
|
86
|
+
TIMEOUT_ERROR_NEVER = { TIMEOUT_ERROR_CLASS => :never }.freeze
|
83
87
|
end
|
84
88
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
2
|
+
Version: SKS 1.1.6
|
3
|
+
Comment: Hostname: pgp.mit.edu
|
4
|
+
|
5
|
+
mQINBGG4urcBEACrbsRa7tSSyxSfFkB+KXSbNM9rxYqoB78u107skReefq4/+Y72TpDvlDZL
|
6
|
+
mdv/lK0IpLa3bnvsM9IE1trNLrfi+JES62kaQ6hePPgn2RqxyIirt2seSi3Z3n3jlEg+mSdh
|
7
|
+
AvW+b+hFnqxo+TY0U+RBwDi4oO0YzHefkYPSmNPdlxRPQBMv4GPTNfxERx6XvVSPcL1+jQ4R
|
8
|
+
2cQFBryNhidBFIkoCOszjWhm+WnbURsLheBp757lqEyrpCufz77zlq2gEi+wtPHItfqsx3rz
|
9
|
+
xSRqatztMGYZpNUHNBJkr13npZtGW+kdN/xu980QLZxN+bZ88pNoOuzD6dKcpMJ0LkdUmTx5
|
10
|
+
z9ewiFiFbUDzZ7PECOm2g3veJrwr79CXDLE1+39Hr8rDM2kDhSr9tAlPTnHVDcaYIGgSNIBc
|
11
|
+
YfLmt91133klHQHBIdWCNVtWJjq5YcLQJ9TxG9GQzgABPrm6NDd1t9j7w1L7uwBvMB1wgpir
|
12
|
+
RTPVfnUSCd+025PEF+wTcBhfnzLtFj5xD7mNsmDmeHkF/sDfNOfAzTE1v2wq0ndYU60xbL6/
|
13
|
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yExunXnsOhg6UG872At5CGEZU0c2Nt/hlGtOR3xbt3O/Uwl+d
|
40
|
+
ErQPA4BUbW5K1T7OC6oPvtlKfF4bGZFloHgt2yE9YSNWZsTPe6XJSapemHZLPOxJLnhs3VBi
|
41
|
+
rWE31QS0bRl5AzlO/fg7ia65vQGMOCOTLpgChTbcZHtozeFqva4IeEgE4xN+6r8WtgSYeGGD
|
42
|
+
RmeMEVjPM9dzQObf+SvGd58u2z9f2agPK1H32c69RLoA0mHRe7Wkv4izeJUc5tumUY0e8Ojd
|
43
|
+
enZZjT3hjLh6tM+mrp2oWnQIoed4LxUw1dhMOj0rYXv6laLGJ1FsW5eSke7ohBLcfBBTKnMC
|
44
|
+
BohROHy2E63Wggfsdn3UYzfqZ8cfbXetkXuLS/OM3MXbiNjg+ElYzjgWrkayu7yLakZx+mx6
|
45
|
+
sHPIJYm2hzkniMG29d5mGl7ZT9emP9b+CfqGUxoXJkjs0gnDl44bwGJ0dmIBu3ajVAaHODXy
|
46
|
+
Y/zdDMGjskfEYbNXCAY2FRZSE58tgTvPKD++Kd2KGplMU2EIFT7JYfKhHAB5DGMkx92HUMid
|
47
|
+
sTSKHe+QnnnoFmu4gnmDU31i
|
48
|
+
=Xqbo
|
49
|
+
-----END PGP PUBLIC KEY BLOCK-----
|
data/support/5072E1F5.asc
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
2
|
-
Version: GnuPG v1
|
2
|
+
Version: GnuPG v1
|
3
3
|
|
4
4
|
mQGiBD4+owwRBAC14GIfUfCyEDSIePvEW3SAFUdJBtoQHH/nJKZyQT7h9bPlUWC3
|
5
5
|
RODjQReyCITRrdwyrKUGku2FmeVGwn2u2WmDMNABLnpprWPkBdCk96+OmSLN9brZ
|
@@ -11,9 +11,9 @@ kYpXBACmWpP8NJTkamEnPCia2ZoOHODANwpUkP43I7jsDmgtobZX9qnrAXw+uNDI
|
|
11
11
|
QJEXM6FSbi0LLtZci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eFcY0xbb6RVIv1UwGDYfQARAQABwsFfBBgBCAAJBQJW/BCrAhsMAAoJ
|
92
|
+
EPFlbyTHTNHYEBIQAJhFTh1u34Q+5bnfiM2dAdCr6T6w4Y1v9ePiIYdSImeseJS2
|
93
|
+
yRglpLcMjW0uEA9KXiRtC/Nm/ClnqYJzCKeIaweHqH6dIgJKaXZFt1Uaia7X9tDD
|
94
|
+
wqALGu97irUrrV1Kh9IkM0J29Vid5amakrdS4mwt2uEISSnCi7pfVoEro+S7tYQ9
|
95
|
+
iH6APVIwqWvcaty3cANdwKWfUQZ6a9IQ08xqzaMhMp2VzhVrWkq3B0j2aRoZR7BN
|
96
|
+
LH2I7Z0giIM8ARjZs99aTRL+SfMEQ3sUxNLb3KWP/n1lSFbrk4HGzqUBBfczESlN
|
97
|
+
c0970C6znK0H0HD11/3BTkMuPqww+Tzex4dpMQllMEKZ3wEyd9v6ba+nj/P1FHSE
|
98
|
+
y/VN6IXzd82s1lYOonKTdmXAIROcHnb0QUzwsd/mhB3jKhEDOV2ZcBTD3yHv8m7C
|
99
|
+
9G9y4hV+7yQlnPlSg3DjBp3SS5r+sOObCIy2Ad32upoXkilWa9g7GZSuhY9kyKqe
|
100
|
+
Eba1lgXXaQykEeqx0pexkWavNnb9JaPrAZHDjUGcXrREmjEyXyElRoD4CrWXySe4
|
101
|
+
6jCuNhVVlkLGo7osefynXa/+PNjQjURtx8en7M9A1FkQuRAxE8KIZgZzYxkGl5o5
|
102
|
+
POSFCA4JUoRPDcrl/sI3fuq2dIOE/BJ2r8dV+LddiR+iukhXRwJXH8RVVEUS
|
103
|
+
=mCOI
|
104
|
+
-----END PGP PUBLIC KEY BLOCK-----
|
@@ -33,6 +33,7 @@ mysql_to_rb = {
|
|
33
33
|
"macroman" => "macRoman",
|
34
34
|
"cp852" => "CP852",
|
35
35
|
"latin7" => "ISO-8859-13",
|
36
|
+
"utf8mb3" => "UTF-8",
|
36
37
|
"utf8mb4" => "UTF-8",
|
37
38
|
"cp1251" => "Windows-1251",
|
38
39
|
"utf16" => "UTF-16",
|
@@ -43,16 +44,21 @@ mysql_to_rb = {
|
|
43
44
|
"geostd8" => "NULL",
|
44
45
|
"cp932" => "Windows-31J",
|
45
46
|
"eucjpms" => "eucJP-ms",
|
47
|
+
"utf16le" => "UTF-16LE",
|
48
|
+
"gb18030" => "GB18030",
|
46
49
|
}
|
47
50
|
|
48
|
-
client = Mysql2::Client.new(:
|
49
|
-
collations = client.query "SHOW COLLATION", :
|
51
|
+
client = Mysql2::Client.new(username: user, password: pass, host: host, port: port.to_i)
|
52
|
+
collations = client.query "SHOW COLLATION", as: :array
|
50
53
|
encodings = Array.new(collations.to_a.last[2].to_i)
|
51
54
|
encodings_with_nil = Array.new(encodings.size)
|
52
55
|
|
53
56
|
collations.each do |collation|
|
54
57
|
mysql_col_idx = collation[2].to_i
|
55
|
-
rb_enc = mysql_to_rb
|
58
|
+
rb_enc = mysql_to_rb.fetch(collation[1]) do |mysql_enc|
|
59
|
+
warn "WARNING: Missing mapping for collation \"#{collation[0]}\" with encoding \"#{mysql_enc}\" and id #{mysql_col_idx}, assuming NULL"
|
60
|
+
"NULL"
|
61
|
+
end
|
56
62
|
encodings[mysql_col_idx - 1] = [mysql_col_idx, rb_enc]
|
57
63
|
end
|
58
64
|
|
@@ -28,6 +28,7 @@ mysql_to_rb = {
|
|
28
28
|
"macroman" => "macRoman",
|
29
29
|
"cp852" => "CP852",
|
30
30
|
"latin7" => "ISO-8859-13",
|
31
|
+
"utf8mb3" => "UTF-8",
|
31
32
|
"utf8mb4" => "UTF-8",
|
32
33
|
"cp1251" => "Windows-1251",
|
33
34
|
"utf16" => "UTF-16",
|
@@ -38,9 +39,11 @@ mysql_to_rb = {
|
|
38
39
|
"geostd8" => nil,
|
39
40
|
"cp932" => "Windows-31J",
|
40
41
|
"eucjpms" => "eucJP-ms",
|
42
|
+
"utf16le" => "UTF-16LE",
|
43
|
+
"gb18030" => "GB18030",
|
41
44
|
}
|
42
45
|
|
43
|
-
puts <<-
|
46
|
+
puts <<-HEADER
|
44
47
|
%readonly-tables
|
45
48
|
%enum
|
46
49
|
%define lookup-function-name mysql2_mysql_enc_name_to_rb
|
@@ -48,13 +51,13 @@ puts <<-header
|
|
48
51
|
%struct-type
|
49
52
|
struct mysql2_mysql_enc_name_to_rb_map { const char *name; const char *rb_name; }
|
50
53
|
%%
|
51
|
-
|
54
|
+
HEADER
|
52
55
|
|
53
56
|
mysql_to_rb.each do |mysql, ruby|
|
54
|
-
if ruby.nil?
|
55
|
-
|
57
|
+
name = if ruby.nil?
|
58
|
+
"NULL"
|
56
59
|
else
|
57
|
-
|
60
|
+
"\"#{ruby}\""
|
58
61
|
end
|
59
62
|
|
60
63
|
puts "#{mysql}, #{name}"
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mysql2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Lopez
|
8
8
|
- Aaron Stone
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-02-08 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
|
-
description:
|
14
|
+
description:
|
15
15
|
email:
|
16
16
|
- seniorlopez@gmail.com
|
17
17
|
- aaron@serendipity.cx
|
@@ -23,8 +23,6 @@ files:
|
|
23
23
|
- CHANGELOG.md
|
24
24
|
- LICENSE
|
25
25
|
- README.md
|
26
|
-
- examples/eventmachine.rb
|
27
|
-
- examples/threaded.rb
|
28
26
|
- ext/mysql2/client.c
|
29
27
|
- ext/mysql2/client.h
|
30
28
|
- ext/mysql2/extconf.rb
|
@@ -48,38 +46,23 @@ files:
|
|
48
46
|
- lib/mysql2/result.rb
|
49
47
|
- lib/mysql2/statement.rb
|
50
48
|
- lib/mysql2/version.rb
|
51
|
-
-
|
52
|
-
- spec/em/em_spec.rb
|
53
|
-
- spec/my.cnf.example
|
54
|
-
- spec/mysql2/client_spec.rb
|
55
|
-
- spec/mysql2/error_spec.rb
|
56
|
-
- spec/mysql2/result_spec.rb
|
57
|
-
- spec/mysql2/statement_spec.rb
|
58
|
-
- spec/rcov.opts
|
59
|
-
- spec/spec_helper.rb
|
60
|
-
- spec/ssl/ca-cert.pem
|
61
|
-
- spec/ssl/ca-key.pem
|
62
|
-
- spec/ssl/ca.cnf
|
63
|
-
- spec/ssl/cert.cnf
|
64
|
-
- spec/ssl/client-cert.pem
|
65
|
-
- spec/ssl/client-key.pem
|
66
|
-
- spec/ssl/client-req.pem
|
67
|
-
- spec/ssl/gen_certs.sh
|
68
|
-
- spec/ssl/pkcs8-client-key.pem
|
69
|
-
- spec/ssl/pkcs8-server-key.pem
|
70
|
-
- spec/ssl/server-cert.pem
|
71
|
-
- spec/ssl/server-key.pem
|
72
|
-
- spec/ssl/server-req.pem
|
73
|
-
- spec/test_data
|
49
|
+
- support/3A79BD29.asc
|
74
50
|
- support/5072E1F5.asc
|
51
|
+
- support/C74CD1D8.asc
|
75
52
|
- support/libmysql.def
|
76
53
|
- support/mysql_enc_to_ruby.rb
|
77
54
|
- support/ruby_enc_to_mysql.rb
|
78
|
-
homepage:
|
55
|
+
homepage: https://github.com/brianmario/mysql2
|
79
56
|
licenses:
|
80
57
|
- MIT
|
81
|
-
metadata:
|
82
|
-
|
58
|
+
metadata:
|
59
|
+
bug_tracker_uri: https://github.com/brianmario/mysql2/issues
|
60
|
+
changelog_uri: https://github.com/brianmario/mysql2/releases/tag/0.5.6
|
61
|
+
documentation_uri: https://www.rubydoc.info/gems/mysql2/0.5.6
|
62
|
+
homepage_uri: https://github.com/brianmario/mysql2
|
63
|
+
source_code_uri: https://github.com/brianmario/mysql2/tree/0.5.6
|
64
|
+
msys2_mingw_dependencies: libmariadbclient
|
65
|
+
post_install_message:
|
83
66
|
rdoc_options:
|
84
67
|
- "--charset=UTF-8"
|
85
68
|
require_paths:
|
@@ -88,41 +71,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
88
71
|
requirements:
|
89
72
|
- - ">="
|
90
73
|
- !ruby/object:Gem::Version
|
91
|
-
version:
|
74
|
+
version: 2.0.0
|
92
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
76
|
requirements:
|
94
77
|
- - ">="
|
95
78
|
- !ruby/object:Gem::Version
|
96
79
|
version: '0'
|
97
80
|
requirements: []
|
98
|
-
|
99
|
-
|
100
|
-
signing_key:
|
81
|
+
rubygems_version: 3.6.0.dev
|
82
|
+
signing_key:
|
101
83
|
specification_version: 4
|
102
84
|
summary: A simple, fast Mysql library for Ruby, binding to libmysql
|
103
|
-
test_files:
|
104
|
-
- examples/eventmachine.rb
|
105
|
-
- examples/threaded.rb
|
106
|
-
- spec/configuration.yml.example
|
107
|
-
- spec/em/em_spec.rb
|
108
|
-
- spec/my.cnf.example
|
109
|
-
- spec/mysql2/client_spec.rb
|
110
|
-
- spec/mysql2/error_spec.rb
|
111
|
-
- spec/mysql2/result_spec.rb
|
112
|
-
- spec/mysql2/statement_spec.rb
|
113
|
-
- spec/rcov.opts
|
114
|
-
- spec/spec_helper.rb
|
115
|
-
- spec/ssl/ca-cert.pem
|
116
|
-
- spec/ssl/ca-key.pem
|
117
|
-
- spec/ssl/ca.cnf
|
118
|
-
- spec/ssl/cert.cnf
|
119
|
-
- spec/ssl/client-cert.pem
|
120
|
-
- spec/ssl/client-key.pem
|
121
|
-
- spec/ssl/client-req.pem
|
122
|
-
- spec/ssl/gen_certs.sh
|
123
|
-
- spec/ssl/pkcs8-client-key.pem
|
124
|
-
- spec/ssl/pkcs8-server-key.pem
|
125
|
-
- spec/ssl/server-cert.pem
|
126
|
-
- spec/ssl/server-key.pem
|
127
|
-
- spec/ssl/server-req.pem
|
128
|
-
- spec/test_data
|
85
|
+
test_files: []
|
data/examples/eventmachine.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift 'lib'
|
4
|
-
|
5
|
-
require 'rubygems'
|
6
|
-
require 'eventmachine'
|
7
|
-
require 'mysql2/em'
|
8
|
-
|
9
|
-
EM.run do
|
10
|
-
client1 = Mysql2::EM::Client.new
|
11
|
-
defer1 = client1.query "SELECT sleep(3) as first_query"
|
12
|
-
defer1.callback do |result|
|
13
|
-
puts "Result: #{result.to_a.inspect}"
|
14
|
-
end
|
15
|
-
|
16
|
-
client2 = Mysql2::EM::Client.new
|
17
|
-
defer2 = client2.query "SELECT sleep(1) second_query"
|
18
|
-
defer2.callback do |result|
|
19
|
-
puts "Result: #{result.to_a.inspect}"
|
20
|
-
end
|
21
|
-
end
|
data/examples/threaded.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift 'lib'
|
4
|
-
require 'mysql2'
|
5
|
-
require 'timeout'
|
6
|
-
|
7
|
-
# Should never exceed worst case 3.5 secs across all 20 threads
|
8
|
-
Timeout.timeout(3.5) do
|
9
|
-
20.times.map do
|
10
|
-
Thread.new do
|
11
|
-
overhead = rand(3)
|
12
|
-
puts ">> thread #{Thread.current.object_id} query, #{overhead} sec overhead"
|
13
|
-
# 3 second overhead per query
|
14
|
-
Mysql2::Client.new(:host => "localhost", :username => "root").query("SELECT sleep(#{overhead}) as result")
|
15
|
-
puts "<< thread #{Thread.current.object_id} result, #{overhead} sec overhead"
|
16
|
-
end
|
17
|
-
end.each(&:join)
|
18
|
-
end
|