Skip to content

Commit 144732b

Browse files
authored
HOTFIX fix uninitialized constant bug (#15)
* fix uninitialized constant bug
1 parent 46d35bc commit 144732b

File tree

5 files changed

+151
-121
lines changed

5 files changed

+151
-121
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
44

55
Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.3.1] - 2024-10-30
8+
### Fixed
9+
- Fixed bug in FiberedMysqlAdapter.new_client that was causing `uninitialized constant` errors.
10+
711
## [0.3.0] - 2024-10-23
812
### Added
913
- Support for Rails 7.0.

Gemfile.lock

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,74 @@
11
PATH
22
remote: .
33
specs:
4-
fibered_mysql2 (0.3.0)
4+
fibered_mysql2 (0.3.1)
55
em-synchrony (~> 1.0)
66
rails (>= 6.1, < 7.1)
77

88
GEM
99
remote: https://rubygems.org/
1010
specs:
11-
actioncable (7.0.8.5)
12-
actionpack (= 7.0.8.5)
13-
activesupport (= 7.0.8.5)
11+
actioncable (7.0.8.6)
12+
actionpack (= 7.0.8.6)
13+
activesupport (= 7.0.8.6)
1414
nio4r (~> 2.0)
1515
websocket-driver (>= 0.6.1)
16-
actionmailbox (7.0.8.5)
17-
actionpack (= 7.0.8.5)
18-
activejob (= 7.0.8.5)
19-
activerecord (= 7.0.8.5)
20-
activestorage (= 7.0.8.5)
21-
activesupport (= 7.0.8.5)
16+
actionmailbox (7.0.8.6)
17+
actionpack (= 7.0.8.6)
18+
activejob (= 7.0.8.6)
19+
activerecord (= 7.0.8.6)
20+
activestorage (= 7.0.8.6)
21+
activesupport (= 7.0.8.6)
2222
mail (>= 2.7.1)
2323
net-imap
2424
net-pop
2525
net-smtp
26-
actionmailer (7.0.8.5)
27-
actionpack (= 7.0.8.5)
28-
actionview (= 7.0.8.5)
29-
activejob (= 7.0.8.5)
30-
activesupport (= 7.0.8.5)
26+
actionmailer (7.0.8.6)
27+
actionpack (= 7.0.8.6)
28+
actionview (= 7.0.8.6)
29+
activejob (= 7.0.8.6)
30+
activesupport (= 7.0.8.6)
3131
mail (~> 2.5, >= 2.5.4)
3232
net-imap
3333
net-pop
3434
net-smtp
3535
rails-dom-testing (~> 2.0)
36-
actionpack (7.0.8.5)
37-
actionview (= 7.0.8.5)
38-
activesupport (= 7.0.8.5)
36+
actionpack (7.0.8.6)
37+
actionview (= 7.0.8.6)
38+
activesupport (= 7.0.8.6)
3939
rack (~> 2.0, >= 2.2.4)
4040
rack-test (>= 0.6.3)
4141
rails-dom-testing (~> 2.0)
4242
rails-html-sanitizer (~> 1.0, >= 1.2.0)
43-
actiontext (7.0.8.5)
44-
actionpack (= 7.0.8.5)
45-
activerecord (= 7.0.8.5)
46-
activestorage (= 7.0.8.5)
47-
activesupport (= 7.0.8.5)
43+
actiontext (7.0.8.6)
44+
actionpack (= 7.0.8.6)
45+
activerecord (= 7.0.8.6)
46+
activestorage (= 7.0.8.6)
47+
activesupport (= 7.0.8.6)
4848
globalid (>= 0.6.0)
4949
nokogiri (>= 1.8.5)
50-
actionview (7.0.8.5)
51-
activesupport (= 7.0.8.5)
50+
actionview (7.0.8.6)
51+
activesupport (= 7.0.8.6)
5252
builder (~> 3.1)
5353
erubi (~> 1.4)
5454
rails-dom-testing (~> 2.0)
5555
rails-html-sanitizer (~> 1.1, >= 1.2.0)
56-
activejob (7.0.8.5)
57-
activesupport (= 7.0.8.5)
56+
activejob (7.0.8.6)
57+
activesupport (= 7.0.8.6)
5858
globalid (>= 0.3.6)
59-
activemodel (7.0.8.5)
60-
activesupport (= 7.0.8.5)
61-
activerecord (7.0.8.5)
62-
activemodel (= 7.0.8.5)
63-
activesupport (= 7.0.8.5)
64-
activestorage (7.0.8.5)
65-
actionpack (= 7.0.8.5)
66-
activejob (= 7.0.8.5)
67-
activerecord (= 7.0.8.5)
68-
activesupport (= 7.0.8.5)
59+
activemodel (7.0.8.6)
60+
activesupport (= 7.0.8.6)
61+
activerecord (7.0.8.6)
62+
activemodel (= 7.0.8.6)
63+
activesupport (= 7.0.8.6)
64+
activestorage (7.0.8.6)
65+
actionpack (= 7.0.8.6)
66+
activejob (= 7.0.8.6)
67+
activerecord (= 7.0.8.6)
68+
activesupport (= 7.0.8.6)
6969
marcel (~> 1.0)
7070
mini_mime (>= 1.1.0)
71-
activesupport (7.0.8.5)
71+
activesupport (7.0.8.6)
7272
concurrent-ruby (~> 1.0, >= 1.0.2)
7373
i18n (>= 1.6, < 2)
7474
minitest (>= 5.1)
@@ -103,7 +103,7 @@ GEM
103103
i18n (1.14.6)
104104
concurrent-ruby (~> 1.0)
105105
json (2.7.2)
106-
loofah (2.22.0)
106+
loofah (2.23.1)
107107
crass (~> 1.0.2)
108108
nokogiri (>= 1.12.0)
109109
mail (2.8.1)
@@ -126,7 +126,7 @@ GEM
126126
timeout
127127
net-smtp (0.5.0)
128128
net-protocol
129-
nio4r (2.7.3)
129+
nio4r (2.7.4)
130130
nokogiri (1.16.7)
131131
mini_portile2 (~> 2.8.2)
132132
racc (~> 1.4)
@@ -140,30 +140,30 @@ GEM
140140
rack (2.2.10)
141141
rack-test (2.1.0)
142142
rack (>= 1.3)
143-
rails (7.0.8.5)
144-
actioncable (= 7.0.8.5)
145-
actionmailbox (= 7.0.8.5)
146-
actionmailer (= 7.0.8.5)
147-
actionpack (= 7.0.8.5)
148-
actiontext (= 7.0.8.5)
149-
actionview (= 7.0.8.5)
150-
activejob (= 7.0.8.5)
151-
activemodel (= 7.0.8.5)
152-
activerecord (= 7.0.8.5)
153-
activestorage (= 7.0.8.5)
154-
activesupport (= 7.0.8.5)
143+
rails (7.0.8.6)
144+
actioncable (= 7.0.8.6)
145+
actionmailbox (= 7.0.8.6)
146+
actionmailer (= 7.0.8.6)
147+
actionpack (= 7.0.8.6)
148+
actiontext (= 7.0.8.6)
149+
actionview (= 7.0.8.6)
150+
activejob (= 7.0.8.6)
151+
activemodel (= 7.0.8.6)
152+
activerecord (= 7.0.8.6)
153+
activestorage (= 7.0.8.6)
154+
activesupport (= 7.0.8.6)
155155
bundler (>= 1.15.0)
156-
railties (= 7.0.8.5)
156+
railties (= 7.0.8.6)
157157
rails-dom-testing (2.2.0)
158158
activesupport (>= 5.0.0)
159159
minitest
160160
nokogiri (>= 1.6)
161161
rails-html-sanitizer (1.6.0)
162162
loofah (~> 2.21)
163163
nokogiri (~> 1.14)
164-
railties (7.0.8.5)
165-
actionpack (= 7.0.8.5)
166-
activesupport (= 7.0.8.5)
164+
railties (7.0.8.6)
165+
actionpack (= 7.0.8.6)
166+
activesupport (= 7.0.8.6)
167167
method_source
168168
rake (>= 12.2)
169169
thor (~> 1.0)

lib/active_record/connection_adapters/fibered_mysql2_adapter.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
require 'em-synchrony'
44
require 'active_model'
55
require 'active_record/errors'
6+
require 'active_record/connection_adapters/mysql2_adapter'
67
require 'active_record/connection_adapters/em_mysql2_adapter'
78

89
module FiberedMysql2
@@ -69,12 +70,8 @@ class << self
6970
def new_client(config)
7071
Mysql2::EM::Client.new(config)
7172
rescue Mysql2::Error => error
72-
if error.error_number == ConnectionAdapters::Mysql2Adapter::ER_BAD_DB_ERROR
73-
raise ActiveRecord::NoDatabaseError.db_error(config[:database])
74-
elsif error.error_number == ConnectionAdapters::Mysql2Adapter::ER_ACCESS_DENIED_ERROR
75-
raise ActiveRecord::DatabaseConnectionError.username_error(config[:username])
76-
elsif [ConnectionAdapters::Mysql2Adapter::ER_CONN_HOST_ERROR, ConnectionAdapters::Mysql2Adapter::ER_UNKNOWN_HOST_ERROR].include?(error.error_number)
77-
raise ActiveRecord::DatabaseConnectionError.hostname_error(config[:host])
73+
if error.error_number == 1049
74+
raise ActiveRecord::NoDatabaseError.new, error.message
7875
else
7976
raise ActiveRecord::ConnectionNotEstablished, error.message
8077
end

lib/fibered_mysql2/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module FiberedMysql2
4-
VERSION = "0.3.0"
4+
VERSION = "0.3.1"
55
end

0 commit comments

Comments
 (0)