active_record_host_pool 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- data/{LICENSE → MIT-LICENSE} +0 -0
- data/{README.md → Readme.md} +8 -1
- data/lib/active_record_host_pool/connection_adapter_mixin.rb +2 -1
- data/test/database.yml +3 -3
- data/test/helper.rb +0 -3
- metadata +40 -7
data/{LICENSE → MIT-LICENSE}
RENAMED
File without changes
|
data/{README.md → Readme.md}
RENAMED
@@ -15,10 +15,17 @@ server connection sharing multiple dbs.
|
|
15
15
|
|
16
16
|
and make sure to require 'active\_record\_host\_pool' in some way.
|
17
17
|
|
18
|
+
## Testing
|
19
|
+
You need a local user called snoopy.
|
20
|
+
|
21
|
+
mysql -uroot
|
22
|
+
CREATE USER 'snoopy'@'localhost';
|
23
|
+
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX ON *.* TO 'snoopy'@'localhost';
|
24
|
+
FLUSH PRIVILEGES;
|
18
25
|
|
19
26
|
## Copyright
|
20
27
|
|
21
|
-
Copyright (c) 2011 Zendesk. See LICENSE for details.
|
28
|
+
Copyright (c) 2011 Zendesk. See MIT-LICENSE for details.
|
22
29
|
|
23
30
|
## Authors
|
24
31
|
Ben Osheroff <ben@gimbo.net>,
|
@@ -58,12 +58,13 @@ module ActiveRecordHostPool
|
|
58
58
|
private
|
59
59
|
|
60
60
|
def _switch_connection
|
61
|
-
if _host_pool_current_database && (_host_pool_current_database != @_cached_current_database)
|
61
|
+
if _host_pool_current_database && ((_host_pool_current_database != @_cached_current_database) || @connection.object_id != @_cached_connection_object_id)
|
62
62
|
log("select_db #{_host_pool_current_database}", "SQL") do
|
63
63
|
clear_cache! if respond_to?(:clear_cache!)
|
64
64
|
raw_connection.select_db(_host_pool_current_database)
|
65
65
|
end
|
66
66
|
@_cached_current_database = _host_pool_current_database
|
67
|
+
@_cached_connection_object_id = @connection.object_id
|
67
68
|
end
|
68
69
|
end
|
69
70
|
end
|
data/test/database.yml
CHANGED
@@ -4,7 +4,7 @@ test_host_1_db_1:
|
|
4
4
|
database: arhp_test_1
|
5
5
|
username: root
|
6
6
|
password:
|
7
|
-
host:
|
7
|
+
host: 127.0.0.1
|
8
8
|
reconnect: true
|
9
9
|
|
10
10
|
test_host_1_db_2:
|
@@ -13,7 +13,7 @@ test_host_1_db_2:
|
|
13
13
|
database: arhp_test_2
|
14
14
|
username: root
|
15
15
|
password:
|
16
|
-
host:
|
16
|
+
host: 127.0.0.1
|
17
17
|
reconnect: true
|
18
18
|
|
19
19
|
test_host_2_db_3:
|
@@ -52,6 +52,6 @@ test_host_1_db_not_there:
|
|
52
52
|
database: arhp_test_no_create
|
53
53
|
username: root
|
54
54
|
password:
|
55
|
-
host:
|
55
|
+
host: 127.0.0.1
|
56
56
|
reconnect: true
|
57
57
|
|
data/test/helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_host_pool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -93,6 +93,38 @@ dependencies:
|
|
93
93
|
version: '0'
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: mocha
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 0.11.0
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.11.0
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: test-unit
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 2.5.1
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 2.5.1
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: appraisal
|
96
128
|
requirement: !ruby/object:Gem::Requirement
|
97
129
|
none: false
|
98
130
|
requirements:
|
@@ -129,21 +161,22 @@ email:
|
|
129
161
|
executables: []
|
130
162
|
extensions: []
|
131
163
|
extra_rdoc_files:
|
132
|
-
- LICENSE
|
133
|
-
-
|
164
|
+
- MIT-LICENSE
|
165
|
+
- Readme.md
|
134
166
|
files:
|
135
|
-
-
|
167
|
+
- Readme.md
|
136
168
|
- lib/active_record_host_pool.rb
|
137
169
|
- lib/active_record_host_pool/connection_adapter_mixin.rb
|
138
170
|
- lib/active_record_host_pool/connection_proxy.rb
|
139
171
|
- lib/active_record_host_pool/pool_proxy.rb
|
140
|
-
- LICENSE
|
172
|
+
- MIT-LICENSE
|
141
173
|
- test/database.yml
|
142
174
|
- test/helper.rb
|
143
175
|
- test/schema.rb
|
144
176
|
- test/test_arhp.rb
|
145
|
-
homepage:
|
146
|
-
licenses:
|
177
|
+
homepage: https://github.com/zendesk/active_record_host_pool
|
178
|
+
licenses:
|
179
|
+
- MIT
|
147
180
|
post_install_message:
|
148
181
|
rdoc_options: []
|
149
182
|
require_paths:
|