sequel-activerecord_connection 1.2.0 → 1.2.1

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: ee4a6a5b6dcfceb9856ca13e48cd47ce2573f9d5f4d8923518854eb0651c1cb9
4
- data.tar.gz: 18fd0ce3a56b87b102e6534eef4ae478d1a2df10a4aac8ae984fa4069c477493
3
+ metadata.gz: 72a4a1bf22a4a83664c7925b1d0b78ee5d20777eb12ffec4df9bd4b0c60a9930
4
+ data.tar.gz: 58c32e5d224d136cb797453bd8ac70f40d964160c4996377909349c8bb324af5
5
5
  SHA512:
6
- metadata.gz: dd33df7445d400b75b29782c99f83d1afc8fc93338eeab4fd0196c4281e34fc1df21d12a0e1a8ccd130995527bef95d7b3ca1b9b16f47a33623b750842b68732
7
- data.tar.gz: c4e26c97e37efd8f8415c7c03799bdde385a478384531948b60837d43bb1f09e7a9feb899b2d080aa20d41f6fb152adfe236aaf0447a1140637696baecd1b1a7
6
+ metadata.gz: 7cc94ff1690360f805eec685404d9017b9df0f327c32110e54694dd1da148f1141990a468b69787896ea5e9a4b13d84c41783d4dcee0fd8b1f020defd9288961
7
+ data.tar.gz: b67647d492d7d31478ca6db7ba4b107914d8ba692bd41bf4596cab5f06a16ee62b2f19ab199dfce9566234ac876b349c212199a23cbec2c15884108cf1e41f79
@@ -1,3 +1,7 @@
1
+ ## 1.2.1 (2020-01-10)
2
+
3
+ * Fix original mysql2 query options not being restored after nested `DB#synchronize` calls, e.g. when using Sequel transactions (@janko)
4
+
1
5
  ## 1.2.0 (2020-11-15)
2
6
 
3
7
  * Attempt support for [activerecord-sqlserver-adapter](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter) (@janko)
@@ -5,6 +5,10 @@ module Sequel
5
5
  module Mysql2
6
6
  def synchronize(*)
7
7
  super do |conn|
8
+ if conn.instance_variable_defined?(:@sequel_default_query_options)
9
+ return yield(conn)
10
+ end
11
+
8
12
  # required for prepared statements
9
13
  conn.instance_variable_set(:@sequel_default_query_options, conn.query_options.dup)
10
14
  Utils.add_prepared_statements_cache(conn)
@@ -14,7 +18,7 @@ module Sequel
14
18
  begin
15
19
  yield conn
16
20
  ensure
17
- conn.query_options.replace(conn.instance_variable_get(:@sequel_default_query_options))
21
+ conn.query_options.replace(conn.remove_instance_variable(:@sequel_default_query_options))
18
22
  end
19
23
  end
20
24
  end
@@ -32,20 +32,12 @@ module Sequel
32
32
  module ConnectionMethods
33
33
  # The underlying exception classes to reraise as disconnect errors
34
34
  # instead of regular database errors.
35
- DISCONNECT_ERROR_CLASSES = [IOError, Errno::EPIPE, Errno::ECONNRESET, ::PG::ConnectionBad].freeze
35
+ DISCONNECT_ERROR_CLASSES = Sequel::Postgres::Adapter::DISCONNECT_ERROR_CLASSES
36
36
 
37
37
  # Since exception class based disconnect checking may not work,
38
38
  # also trying parsing the exception message to look for disconnect
39
39
  # errors.
40
- DISCONNECT_ERROR_REGEX = /\A#{Regexp.union([
41
- "ERROR: cached plan must not change result type",
42
- "could not receive data from server",
43
- "no connection to the server",
44
- "connection not open",
45
- "connection is closed",
46
- "terminating connection due to administrator command",
47
- "PQconsumeInput() "
48
- ])}/
40
+ DISCONNECT_ERROR_REGEX = Sequel::Postgres::Adapter::DISCONNECT_ERROR_RE
49
41
 
50
42
  def async_exec_params(sql, args)
51
43
  defined?(super) ? super : async_exec(sql, args)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "sequel-activerecord_connection"
3
- spec.version = "1.2.0"
3
+ spec.version = "1.2.1"
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.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-15 00:00:00.000000000 Z
11
+ date: 2021-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel