mysql2 0.5.0 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +150 -44
  3. data/ext/mysql2/client.c +217 -58
  4. data/ext/mysql2/client.h +9 -2
  5. data/ext/mysql2/extconf.rb +60 -7
  6. data/ext/mysql2/mysql2_ext.c +6 -1
  7. data/ext/mysql2/mysql2_ext.h +13 -0
  8. data/ext/mysql2/mysql_enc_name_to_ruby.h +60 -56
  9. data/ext/mysql2/mysql_enc_to_ruby.h +64 -3
  10. data/ext/mysql2/result.c +287 -21
  11. data/ext/mysql2/result.h +1 -0
  12. data/ext/mysql2/statement.c +95 -24
  13. data/lib/mysql2/client.rb +24 -3
  14. data/lib/mysql2/error.rb +4 -3
  15. data/lib/mysql2/statement.rb +1 -3
  16. data/lib/mysql2/version.rb +1 -1
  17. data/lib/mysql2.rb +8 -3
  18. data/support/3A79BD29.asc +49 -0
  19. data/support/5072E1F5.asc +5 -5
  20. data/support/C74CD1D8.asc +104 -0
  21. data/support/mysql_enc_to_ruby.rb +6 -1
  22. data/support/ruby_enc_to_mysql.rb +2 -0
  23. metadata +11 -55
  24. data/examples/eventmachine.rb +0 -19
  25. data/examples/threaded.rb +0 -16
  26. data/spec/configuration.yml.example +0 -11
  27. data/spec/em/em_spec.rb +0 -135
  28. data/spec/my.cnf.example +0 -9
  29. data/spec/mysql2/client_spec.rb +0 -1072
  30. data/spec/mysql2/error_spec.rb +0 -78
  31. data/spec/mysql2/result_spec.rb +0 -485
  32. data/spec/mysql2/statement_spec.rb +0 -708
  33. data/spec/rcov.opts +0 -3
  34. data/spec/spec_helper.rb +0 -112
  35. data/spec/ssl/ca-cert.pem +0 -17
  36. data/spec/ssl/ca-key.pem +0 -27
  37. data/spec/ssl/ca.cnf +0 -22
  38. data/spec/ssl/cert.cnf +0 -22
  39. data/spec/ssl/client-cert.pem +0 -17
  40. data/spec/ssl/client-key.pem +0 -27
  41. data/spec/ssl/client-req.pem +0 -15
  42. data/spec/ssl/gen_certs.sh +0 -48
  43. data/spec/ssl/pkcs8-client-key.pem +0 -28
  44. data/spec/ssl/pkcs8-server-key.pem +0 -28
  45. data/spec/ssl/server-cert.pem +0 -17
  46. data/spec/ssl/server-key.pem +0 -27
  47. data/spec/ssl/server-req.pem +0 -15
  48. data/spec/test_data +0 -1
data/lib/mysql2/client.rb CHANGED
@@ -20,6 +20,7 @@ module Mysql2
20
20
 
21
21
  def initialize(opts = {})
22
22
  raise Mysql2::Error, "Options parameter must be a Hash" unless opts.is_a? Hash
23
+
23
24
  opts = Mysql2::Util.key_hash_as_symbols(opts)
24
25
  @read_timeout = nil
25
26
  @query_options = self.class.default_query_options.dup
@@ -31,8 +32,9 @@ module Mysql2
31
32
  opts[:connect_timeout] = 120 unless opts.key?(:connect_timeout)
32
33
 
33
34
  # TODO: stricter validation rather than silent massaging
34
- %i[reconnect connect_timeout local_infile read_timeout write_timeout default_file default_group secure_auth init_command automatic_close enable_cleartext_plugin].each do |key|
35
+ %i[reconnect connect_timeout local_infile read_timeout write_timeout default_file default_group secure_auth init_command automatic_close enable_cleartext_plugin default_auth].each do |key|
35
36
  next unless opts.key?(key)
37
+
36
38
  case key
37
39
  when :reconnect, :local_infile, :secure_auth, :automatic_close, :enable_cleartext_plugin
38
40
  send(:"#{key}=", !!opts[key]) # rubocop:disable Style/DoubleNegation
@@ -46,9 +48,14 @@ module Mysql2
46
48
  # force the encoding to utf8
47
49
  self.charset_name = opts[:encoding] || 'utf8'
48
50
 
51
+ mode = parse_ssl_mode(opts[:ssl_mode]) if opts[:ssl_mode]
52
+ if (mode == SSL_MODE_VERIFY_CA || mode == SSL_MODE_VERIFY_IDENTITY) && !opts[:sslca]
53
+ opts[:sslca] = find_default_ca_path
54
+ end
55
+
49
56
  ssl_options = opts.values_at(:sslkey, :sslcert, :sslca, :sslcapath, :sslcipher)
50
57
  ssl_set(*ssl_options) if ssl_options.any? || opts.key?(:sslverify)
51
- self.ssl_mode = parse_ssl_mode(opts[:ssl_mode]) if opts[:ssl_mode]
58
+ self.ssl_mode = mode if mode
52
59
 
53
60
  flags = case opts[:flags]
54
61
  when Array
@@ -115,10 +122,23 @@ module Mysql2
115
122
  end
116
123
  end
117
124
 
125
+ # Find any default system CA paths to handle system roots
126
+ # by default if stricter validation is requested and no
127
+ # path is provide.
128
+ def find_default_ca_path
129
+ [
130
+ "/etc/ssl/certs/ca-certificates.crt",
131
+ "/etc/pki/tls/certs/ca-bundle.crt",
132
+ "/etc/ssl/ca-bundle.pem",
133
+ "/etc/ssl/cert.pem",
134
+ ].find { |f| File.exist?(f) }
135
+ end
136
+
118
137
  # Set default program_name in performance_schema.session_connect_attrs
119
138
  # and performance_schema.session_account_connect_attrs
120
139
  def parse_connect_attrs(conn_attrs)
121
140
  return {} if Mysql2::Client::CONNECT_ATTRS.zero?
141
+
122
142
  conn_attrs ||= {}
123
143
  conn_attrs[:program_name] ||= $PROGRAM_NAME
124
144
  conn_attrs.each_with_object({}) do |(key, value), hash|
@@ -127,7 +147,7 @@ module Mysql2
127
147
  end
128
148
 
129
149
  def query(sql, options = {})
130
- Thread.handle_interrupt(::Mysql2::Util::TIMEOUT_ERROR_CLASS => :never) do
150
+ Thread.handle_interrupt(::Mysql2::Util::TIMEOUT_ERROR_NEVER) do
131
151
  _query(sql, @query_options.merge(options))
132
152
  end
133
153
  end
@@ -135,6 +155,7 @@ module Mysql2
135
155
  def query_info
136
156
  info = query_info_string
137
157
  return {} unless info
158
+
138
159
  info_hash = {}
139
160
  info.split.each_slice(2) { |s| info_hash[s[0].downcase.delete(':').to_sym] = s[1].to_i }
140
161
  info_hash
data/lib/mysql2/error.rb CHANGED
@@ -24,6 +24,7 @@ module Mysql2
24
24
  1159 => ConnectionError, # ER_NET_READ_INTERRUPTED
25
25
  1160 => ConnectionError, # ER_NET_ERROR_ON_WRITE
26
26
  1161 => ConnectionError, # ER_NET_WRITE_INTERRUPTED
27
+ 1927 => ConnectionError, # ER_CONNECTION_KILLED
27
28
 
28
29
  2001 => ConnectionError, # CR_SOCKET_CREATE_ERROR
29
30
  2002 => ConnectionError, # CR_CONNECTION_ERROR
@@ -52,7 +53,7 @@ module Mysql2
52
53
  def initialize(msg, server_version = nil, error_number = nil, sql_state = nil)
53
54
  @server_version = server_version
54
55
  @error_number = error_number
55
- @sql_state = sql_state ? sql_state.encode(ENCODE_OPTS) : nil
56
+ @sql_state = sql_state ? sql_state.encode(**ENCODE_OPTS) : nil
56
57
 
57
58
  super(clean_message(msg))
58
59
  end
@@ -91,9 +92,9 @@ module Mysql2
91
92
  # Returns a valid UTF-8 string.
92
93
  def clean_message(message)
93
94
  if @server_version && @server_version > 50500
94
- message.encode(ENCODE_OPTS)
95
+ message.encode(**ENCODE_OPTS)
95
96
  else
96
- message.encode(Encoding::UTF_8, ENCODE_OPTS)
97
+ message.encode(Encoding::UTF_8, **ENCODE_OPTS)
97
98
  end
98
99
  end
99
100
  end
@@ -1,9 +1,7 @@
1
1
  module Mysql2
2
2
  class Statement
3
- include Enumerable
4
-
5
3
  def execute(*args, **kwargs)
6
- Thread.handle_interrupt(::Mysql2::Util::TIMEOUT_ERROR_CLASS => :never) do
4
+ Thread.handle_interrupt(::Mysql2::Util::TIMEOUT_ERROR_NEVER) do
7
5
  _execute(*args, **kwargs)
8
6
  end
9
7
  end
@@ -1,3 +1,3 @@
1
1
  module Mysql2
2
- VERSION = "0.5.0".freeze
2
+ VERSION = "0.5.5".freeze
3
3
  end
data/lib/mysql2.rb CHANGED
@@ -20,9 +20,12 @@ if RUBY_PLATFORM =~ /mswin|mingw/
20
20
  end
21
21
 
22
22
  if dll_path
23
- require 'Win32API'
24
- LoadLibrary = Win32API.new('Kernel32', 'LoadLibrary', ['P'], 'I')
25
- if LoadLibrary.call(dll_path).zero?
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?
26
29
  abort "Failed to load libmysql.dll from #{dll_path}"
27
30
  end
28
31
  end
@@ -62,6 +65,7 @@ module Mysql2
62
65
  #
63
66
  def self.key_hash_as_symbols(hash)
64
67
  return nil unless hash
68
+
65
69
  Hash[hash.map { |k, v| [k.to_sym, v] }]
66
70
  end
67
71
 
@@ -79,5 +83,6 @@ module Mysql2
79
83
  else
80
84
  ::Timeout::Error
81
85
  end
86
+ TIMEOUT_ERROR_NEVER = { TIMEOUT_ERROR_CLASS => :never }.freeze
82
87
  end
83
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
+ yl/Nipyr7WiQjCG0m3WfkjjVDTfs7/DXUqHFDOu4WMF9v+oqw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COTLpgChTbcZHtozeFqva4IeEgE4xN+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.4.5 (GNU/Linux)
2
+ Version: GnuPG v1
3
3
 
4
4
  mQGiBD4+owwRBAC14GIfUfCyEDSIePvEW3SAFUdJBtoQHH/nJKZyQT7h9bPlUWC3
5
5
  RODjQReyCITRrdwyrKUGku2FmeVGwn2u2WmDMNABLnpprWPkBdCk96+OmSLN9brZ
@@ -11,9 +11,9 @@ kYpXBACmWpP8NJTkamEnPCia2ZoOHODANwpUkP43I7jsDmgtobZX9qnrAXw+uNDI
11
11
  QJEXM6FSbi0LLtZciNlYsafwAPEOMDKpMqAK6IyisNtPvaLd8lH0bPAnWqcyefep
12
12
  rv0sxxqUEMcM3o7wwgfN83POkDasDbs3pjwPhxvhz6//62zQJ7Q2TXlTUUwgUmVs
13
13
  ZWFzZSBFbmdpbmVlcmluZyA8bXlzcWwtYnVpbGRAb3NzLm9yYWNsZS5jb20+iGwE
14
- ExECACwCGyMCHgECF4ACGQEGCwkIBwMCBhUKCQgCAwUWAgMBAAUCWKcFIAUJHirJ
15
- FAAKCRCMcY07UHLh9VcFAJ46pUyVd8BZ2r5CppMC1tmyQ3ceRgCfVPwuVsiS0VER
16
- 5WUqtAQDt+DoetCIaQQTEQIAKQIbIwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAhkB
14
+ ExECACwCGyMCHgECF4ACGQEGCwkIBwMCBhUKCQgCAwUWAgMBAAUCXEBY+wUJI87e
15
+ 5AAKCRCMcY07UHLh9RZPAJ9uvm0zlzfCN+DHxHVaoFLFjdVYTQCfborsC9tmEZYa
16
+ whhogjeBkZkorbyIaQQTEQIAKQIbIwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAhkB
17
17
  BQJTAdRmBQkaZsvLAAoJEIxxjTtQcuH1X4MAoKNLWAbCBUj96637kv6Xa/fJuX5m
18
18
  AJwPtmgDfjUe2iuhXdTrFEPT19SB6ohmBBMRAgAmAhsjBgsJCAcDAgQVAggDBBYC
19
19
  AwECHgECF4AFAk53PioFCRP7AhUACgkQjHGNO1By4fUmzACeJdfqgc9gWTUhgmcM
@@ -428,5 +428,5 @@ GoaU9u41oyZTIiXPiFidJoIZCh7fdurP8pn3X+R5HUNXMr7M+ba8lSNxce/F3kmH
428
428
  0L7rsKqdh9d/aVxhJINJ+inVDnrXWVoXu9GBjT8Nco1iU9SIVAQYEQIADAUCTnc9
429
429
  7QUJE/sBuAASB2VHUEcAAQEJEIxxjTtQcuH1FJsAmwWK9vmwRJ/y9gTnJ8PWf0BV
430
430
  roUTAKClYAhZuX2nUNwH4vlEJQHDqYa5yQ==
431
- =HfUN
431
+ =ghXk
432
432
  -----END PGP PUBLIC KEY BLOCK-----
@@ -0,0 +1,104 @@
1
+ -----BEGIN PGP PUBLIC KEY BLOCK-----
2
+
3
+ xsFNBFb8EKsBEADwGmleOSVThrbCyCVUdCreMTKpmD5p5aPz/0jc66050MAb71Hv
4
+ TVcfuMqHYO8O66qXLpEdqZpuk4D+rw1oKyC+d8u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6ba+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-----
@@ -43,6 +43,8 @@ mysql_to_rb = {
43
43
  "geostd8" => "NULL",
44
44
  "cp932" => "Windows-31J",
45
45
  "eucjpms" => "eucJP-ms",
46
+ "utf16le" => "UTF-16LE",
47
+ "gb18030" => "GB18030",
46
48
  }
47
49
 
48
50
  client = Mysql2::Client.new(username: user, password: pass, host: host, port: port.to_i)
@@ -52,7 +54,10 @@ encodings_with_nil = Array.new(encodings.size)
52
54
 
53
55
  collations.each do |collation|
54
56
  mysql_col_idx = collation[2].to_i
55
- rb_enc = mysql_to_rb[collation[1]]
57
+ rb_enc = mysql_to_rb.fetch(collation[1]) do |mysql_enc|
58
+ warn "WARNING: Missing mapping for collation \"#{collation[0]}\" with encoding \"#{mysql_enc}\" and id #{mysql_col_idx}, assuming NULL"
59
+ "NULL"
60
+ end
56
61
  encodings[mysql_col_idx - 1] = [mysql_col_idx, rb_enc]
57
62
  end
58
63
 
@@ -38,6 +38,8 @@ mysql_to_rb = {
38
38
  "geostd8" => nil,
39
39
  "cp932" => "Windows-31J",
40
40
  "eucjpms" => "eucJP-ms",
41
+ "utf16le" => "UTF-16LE",
42
+ "gb18030" => "GB18030",
41
43
  }
42
44
 
43
45
  puts <<-HEADER
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.5.0
4
+ version: 0.5.5
5
5
  platform: ruby
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: 2018-03-20 00:00:00.000000000 Z
12
+ date: 2023-01-22 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email:
@@ -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,30 +46,9 @@ files:
48
46
  - lib/mysql2/result.rb
49
47
  - lib/mysql2/statement.rb
50
48
  - lib/mysql2/version.rb
51
- - spec/configuration.yml.example
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
@@ -79,6 +56,11 @@ homepage: https://github.com/brianmario/mysql2
79
56
  licenses:
80
57
  - MIT
81
58
  metadata:
59
+ bug_tracker_uri: https://github.com/brianmario/mysql2/issues
60
+ changelog_uri: https://github.com/brianmario/mysql2/releases/tag/0.5.5
61
+ documentation_uri: https://www.rubydoc.info/gems/mysql2/0.5.5
62
+ homepage_uri: https://github.com/brianmario/mysql2
63
+ source_code_uri: https://github.com/brianmario/mysql2/tree/0.5.5
82
64
  msys2_mingw_dependencies: libmariadbclient
83
65
  post_install_message:
84
66
  rdoc_options:
@@ -96,34 +78,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
78
  - !ruby/object:Gem::Version
97
79
  version: '0'
98
80
  requirements: []
99
- rubyforge_project:
100
- rubygems_version: 2.5.2
81
+ rubygems_version: 3.0.3.1
101
82
  signing_key:
102
83
  specification_version: 4
103
84
  summary: A simple, fast Mysql library for Ruby, binding to libmysql
104
- test_files:
105
- - examples/eventmachine.rb
106
- - examples/threaded.rb
107
- - spec/configuration.yml.example
108
- - spec/em/em_spec.rb
109
- - spec/my.cnf.example
110
- - spec/mysql2/client_spec.rb
111
- - spec/mysql2/error_spec.rb
112
- - spec/mysql2/result_spec.rb
113
- - spec/mysql2/statement_spec.rb
114
- - spec/rcov.opts
115
- - spec/spec_helper.rb
116
- - spec/ssl/ca-cert.pem
117
- - spec/ssl/ca-key.pem
118
- - spec/ssl/ca.cnf
119
- - spec/ssl/cert.cnf
120
- - spec/ssl/client-cert.pem
121
- - spec/ssl/client-key.pem
122
- - spec/ssl/client-req.pem
123
- - spec/ssl/gen_certs.sh
124
- - spec/ssl/pkcs8-client-key.pem
125
- - spec/ssl/pkcs8-server-key.pem
126
- - spec/ssl/server-cert.pem
127
- - spec/ssl/server-key.pem
128
- - spec/ssl/server-req.pem
129
- - spec/test_data
85
+ test_files: []
@@ -1,19 +0,0 @@
1
- $LOAD_PATH.unshift 'lib'
2
-
3
- require 'rubygems'
4
- require 'eventmachine'
5
- require 'mysql2/em'
6
-
7
- EM.run do
8
- client1 = Mysql2::EM::Client.new
9
- defer1 = client1.query "SELECT sleep(3) as first_query"
10
- defer1.callback do |result|
11
- puts "Result: #{result.to_a.inspect}"
12
- end
13
-
14
- client2 = Mysql2::EM::Client.new
15
- defer2 = client2.query "SELECT sleep(1) second_query"
16
- defer2.callback do |result|
17
- puts "Result: #{result.to_a.inspect}"
18
- end
19
- end
data/examples/threaded.rb DELETED
@@ -1,16 +0,0 @@
1
- $LOAD_PATH.unshift 'lib'
2
- require 'mysql2'
3
- require 'timeout'
4
-
5
- # Should never exceed worst case 3.5 secs across all 20 threads
6
- Timeout.timeout(3.5) do
7
- Array.new(20) do
8
- Thread.new do
9
- overhead = rand(3)
10
- puts ">> thread #{Thread.current.object_id} query, #{overhead} sec overhead"
11
- # 3 second overhead per query
12
- Mysql2::Client.new(host: "localhost", username: "root").query("SELECT sleep(#{overhead}) as result")
13
- puts "<< thread #{Thread.current.object_id} result, #{overhead} sec overhead"
14
- end
15
- end.each(&:join)
16
- end
@@ -1,11 +0,0 @@
1
- root:
2
- host: localhost
3
- username: root
4
- password:
5
- database: test
6
-
7
- user:
8
- host: localhost
9
- username: LOCALUSERNAME
10
- password:
11
- database: mysql2_test
data/spec/em/em_spec.rb DELETED
@@ -1,135 +0,0 @@
1
- require 'spec_helper'
2
- begin
3
- require 'eventmachine'
4
- require 'mysql2/em'
5
-
6
- RSpec.describe Mysql2::EM::Client do
7
- it "should support async queries" do
8
- results = []
9
- EM.run do
10
- client1 = Mysql2::EM::Client.new DatabaseCredentials['root']
11
- defer1 = client1.query "SELECT sleep(0.1) as first_query"
12
- defer1.callback do |result|
13
- results << result.first
14
- client1.close
15
- EM.stop_event_loop
16
- end
17
-
18
- client2 = Mysql2::EM::Client.new DatabaseCredentials['root']
19
- defer2 = client2.query "SELECT sleep(0.025) second_query"
20
- defer2.callback do |result|
21
- results << result.first
22
- client2.close
23
- end
24
- end
25
-
26
- expect(results[0].keys).to include("second_query")
27
- expect(results[1].keys).to include("first_query")
28
- end
29
-
30
- it "should support queries in callbacks" do
31
- results = []
32
- EM.run do
33
- client = Mysql2::EM::Client.new DatabaseCredentials['root']
34
- defer1 = client.query "SELECT sleep(0.025) as first_query"
35
- defer1.callback do |result|
36
- results << result.first
37
- defer2 = client.query "SELECT sleep(0.025) as second_query"
38
- defer2.callback do |r|
39
- results << r.first
40
- client.close
41
- EM.stop_event_loop
42
- end
43
- end
44
- end
45
-
46
- expect(results[0].keys).to include("first_query")
47
- expect(results[1].keys).to include("second_query")
48
- end
49
-
50
- it "should not swallow exceptions raised in callbacks" do
51
- expect do
52
- EM.run do
53
- client = Mysql2::EM::Client.new DatabaseCredentials['root']
54
- defer = client.query "SELECT sleep(0.1) as first_query"
55
- defer.callback do
56
- client.close
57
- raise 'some error'
58
- end
59
- defer.errback do
60
- # This _shouldn't_ be run, but it needed to prevent the specs from
61
- # freezing if this test fails.
62
- EM.stop_event_loop
63
- end
64
- end
65
- end.to raise_error('some error')
66
- end
67
-
68
- context 'when an exception is raised by the client' do
69
- let(:client) { Mysql2::EM::Client.new DatabaseCredentials['root'] }
70
- let(:error) { StandardError.new('some error') }
71
- before { allow(client).to receive(:async_result).and_raise(error) }
72
- after { client.close }
73
-
74
- it "should swallow exceptions raised in by the client" do
75
- errors = []
76
- EM.run do
77
- defer = client.query "SELECT sleep(0.1) as first_query"
78
- defer.callback do
79
- # This _shouldn't_ be run, but it is needed to prevent the specs from
80
- # freezing if this test fails.
81
- EM.stop_event_loop
82
- end
83
- defer.errback do |err|
84
- errors << err
85
- EM.stop_event_loop
86
- end
87
- end
88
- expect(errors).to eq([error])
89
- end
90
-
91
- it "should fail the deferrable" do
92
- callbacks_run = []
93
- EM.run do
94
- defer = client.query "SELECT sleep(0.025) as first_query"
95
- EM.add_timer(0.1) do
96
- defer.callback do
97
- callbacks_run << :callback
98
- # This _shouldn't_ be run, but it is needed to prevent the specs from
99
- # freezing if this test fails.
100
- EM.stop_event_loop
101
- end
102
- defer.errback do
103
- callbacks_run << :errback
104
- EM.stop_event_loop
105
- end
106
- end
107
- end
108
- expect(callbacks_run).to eq([:errback])
109
- end
110
- end
111
-
112
- it "should not raise error when closing client with no query running" do
113
- callbacks_run = []
114
- EM.run do
115
- client = Mysql2::EM::Client.new DatabaseCredentials['root']
116
- defer = client.query("select sleep(0.025)")
117
- defer.callback do
118
- callbacks_run << :callback
119
- end
120
- defer.errback do
121
- callbacks_run << :errback
122
- end
123
- EM.add_timer(0.1) do
124
- expect(callbacks_run).to eq([:callback])
125
- expect do
126
- client.close
127
- end.not_to raise_error
128
- EM.stop_event_loop
129
- end
130
- end
131
- end
132
- end
133
- rescue LoadError
134
- puts "EventMachine not installed, skipping the specs that use it"
135
- end
data/spec/my.cnf.example DELETED
@@ -1,9 +0,0 @@
1
- [root]
2
- host=localhost
3
- user=LOCALUSERNAME
4
- password=
5
-
6
- [client]
7
- host=localhost
8
- user=LOCALUSERNAME
9
- password=