sequel-activerecord_connection 1.2.10 → 1.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53c5925926ff3924bcef9f86b9450449c801e260196b9d25b85fefa2ce569239
4
- data.tar.gz: c7b26f34a3b40ea1691f82e28aa1dd83cf598593c2dd96aa4f7ba3f450cd97fd
3
+ metadata.gz: 9b0b564099dd7cf0627c98960d7ca34a0fb1682aaa1f5262ee03de9a9bf2ad8a
4
+ data.tar.gz: 90b84910bae08b57fcc4e3f29deafe07e1e5fb620ae662960c0058a462bc81b2
5
5
  SHA512:
6
- metadata.gz: 29c0ff34e41b468d04b24f0ab17dcea10ff63b562873a63669f137b24eb31c3b78869d35154879719c1bc270bc161893250c29ab22dd89fb45ddd4abc0d0678f
7
- data.tar.gz: 4de28a717d23a9879420c716c81ff7609768f76d224394c254f91b76338f6b7b38399584a63152745e0b4efc165a34e223ca5f113fcc54cdbb65abf92ca9448d
6
+ metadata.gz: 58fd8e6e50e2dc25dba484c1deee60c1f20681761431c4654a3da092572f2cbfb768eb992a7d7e7eb6f03a77691289e3dd5366796c03ecfdefdbf88412bbfa29
7
+ data.tar.gz: c92338695de7971f16dd4adf3b518bb00f294a033df519fb1b7077c05a3d080cda443c3ac6d245214d2a07d53c7a00c12dbb914de4cda6e8bb74547c6da6541d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.2.11 (2023-01-09)
2
+
3
+ * Raise explicit exception in case of mismatch between Active Record and Sequel adapter (@janko)
4
+
1
5
  ## 1.2.10 (2022-12-13)
2
6
 
3
7
  * Fix incorrect PG type mapping when using prepared statements in Sequel (@janko)
@@ -12,7 +16,7 @@
12
16
 
13
17
  ## 1.2.7 (2022-01-20)
14
18
 
15
- * Require Sequel 3.38+ (@janko)
19
+ * Require Sequel 5.38+ (@janko)
16
20
 
17
21
  ## 1.2.6 (2021-12-26)
18
22
 
@@ -27,6 +27,10 @@ module Sequel
27
27
  conn.query_options.replace(conn.remove_instance_variable(:@sequel_default_query_options))
28
28
  end
29
29
  end
30
+
31
+ def activerecord_connection_class
32
+ ::Mysql2::Client
33
+ end
30
34
  end
31
35
  end
32
36
  end
@@ -39,6 +39,10 @@ module Sequel
39
39
  end
40
40
  end
41
41
 
42
+ def activerecord_connection_class
43
+ ::PG::Connection
44
+ end
45
+
42
46
  # Copy-pasted from Sequel::Postgres::Adapter.
43
47
  module ConnectionMethods
44
48
  # The underlying exception classes to reraise as disconnect errors
@@ -28,6 +28,10 @@ module Sequel
28
28
  end
29
29
  end
30
30
  end
31
+
32
+ def activerecord_connection_class
33
+ ::SQLite3::Database
34
+ end
31
35
  end
32
36
  end
33
37
  end
@@ -14,6 +14,12 @@ module Sequel
14
14
  end
15
15
  end
16
16
  end
17
+
18
+ private
19
+
20
+ def activerecord_connection_class
21
+ ::TinyTds::Client
22
+ end
17
23
  end
18
24
  end
19
25
  end
@@ -35,7 +35,13 @@ module Sequel
35
35
  # Avoid calling Sequel's connection pool, instead use Active Record's.
36
36
  def synchronize(*)
37
37
  activerecord_lock do
38
- yield activerecord_connection.raw_connection
38
+ conn = activerecord_connection.raw_connection
39
+
40
+ if activerecord_connection_class && !conn.is_a?(activerecord_connection_class)
41
+ fail Error, "expected Active Record connection to be a #{activerecord_connection_class}, got #{conn.class}"
42
+ end
43
+
44
+ yield conn
39
45
  end
40
46
  end
41
47
 
@@ -151,6 +157,10 @@ module Sequel
151
157
  activerecord_model.connection
152
158
  end
153
159
 
160
+ def activerecord_connection_class
161
+ # defines in adapter modules
162
+ end
163
+
154
164
  def activerecord_log(sql, &block)
155
165
  ActiveSupport::Notifications.instrument(
156
166
  "sql.active_record",
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "sequel-activerecord_connection"
3
- spec.version = "1.2.10"
3
+ spec.version = "1.2.11"
4
4
  spec.authors = ["Janko Marohnić"]
5
5
  spec.email = ["janko.marohnic@gmail.com"]
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel-activerecord_connection
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.10
4
+ version: 1.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-13 00:00:00.000000000 Z
11
+ date: 2023-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  - !ruby/object:Gem::Version
139
139
  version: '0'
140
140
  requirements: []
141
- rubygems_version: 3.3.3
141
+ rubygems_version: 3.4.1
142
142
  signing_key:
143
143
  specification_version: 4
144
144
  summary: Allows Sequel to use ActiveRecord connection for database interaction.