transaction_isolation_level 1.1.0 → 1.2.0
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 +4 -4
- data/Gemfile +1 -3
- data/lib/transaction_isolation_level.rb +7 -0
- data/lib/transaction_isolation_level/adapter_patches.rb +16 -1
- data/lib/transaction_isolation_level/version.rb +1 -1
- data/test_all.sh +9 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c51e2c4cd964967053705462a744b8d77dcb8058
|
4
|
+
data.tar.gz: c03c90b9c167fc596c75df50e31ef7a4362b5859
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a03d54c3ec7bf025923b33022a260139025d0302fd89f7131303f23cd6c38e29b6f4daa4669f416643767c003906ba45ed12846ba30f899df460f845f508b410
|
7
|
+
data.tar.gz: 4892314111be7920d5111c8b9d80a96af5685fbc8cfb66ab8bdbc70b2b7d0eda2901b66930cdb3efd4733f08fe60d1c12a472ecdeb47755f959cd100446aefe4
|
data/Gemfile
CHANGED
@@ -13,6 +13,13 @@ module ActiveRecord
|
|
13
13
|
# uses the ConnectionHandler#establish_connection method we override here to load our patches once
|
14
14
|
# ActiveRecord::Base#establish_connection has loaded the class to patch.
|
15
15
|
def establish_connection_with_isolation_level_adapter_patches(*args)
|
16
|
+
# need to explicitly trigger load of the adapter for 5.1 and above, as from that point on its
|
17
|
+
# required only in establish_connection, and we don't have a way to insert our patches halfway
|
18
|
+
# through that method.
|
19
|
+
if (ActiveRecord::VERSION::MAJOR == 5 && ActiveRecord::VERSION::MINOR > 0) || ActiveRecord::VERSION::MAJOR > 5
|
20
|
+
ConnectionSpecification::Resolver.new(Base.configurations).spec(args.last)
|
21
|
+
end
|
22
|
+
|
16
23
|
require 'transaction_isolation_level/adapter_patches'
|
17
24
|
establish_connection_without_isolation_level_adapter_patches(*args)
|
18
25
|
end
|
@@ -68,8 +68,23 @@ module ActiveRecord
|
|
68
68
|
execute "BEGIN TRANSACTION #{transaction_isolation_level_sql(@transaction_isolation_level)}"
|
69
69
|
end
|
70
70
|
|
71
|
+
# the postgresql adapter calls configure_connection part way through its #initialize. after that point, it sets
|
72
|
+
# @type_map. however, by calling execute, our overridden configure_connection will run a query, and this requires
|
73
|
+
# a type map, which needs to be the postgresql-specific type that #initialize would instantiate, not the default
|
74
|
+
# created by #type_map in the abstract adapter code. so we override that default to be the same as #initialize
|
75
|
+
# will make.
|
71
76
|
def type_map
|
72
|
-
@type_map
|
77
|
+
return @type_map if instance_variable_defined?(:@type_map)
|
78
|
+
@type_map =
|
79
|
+
if PostgreSQLAdapter::OID.const_defined?(:TypeMap)
|
80
|
+
# 5.0 and below
|
81
|
+
PostgreSQLAdapter::OID::TypeMap.new
|
82
|
+
else
|
83
|
+
# 5.1 and above
|
84
|
+
Type::HashLookupTypeMap.new
|
85
|
+
end
|
86
|
+
initialize_type_map(type_map)
|
87
|
+
@type_map
|
73
88
|
end
|
74
89
|
|
75
90
|
def configure_connection
|
data/test_all.sh
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transaction_isolation_level
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Will Bryant
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -69,6 +69,7 @@ files:
|
|
69
69
|
- test/database.yml
|
70
70
|
- test/test_helper.rb
|
71
71
|
- test/transaction_isolation_level_test.rb
|
72
|
+
- test_all.sh
|
72
73
|
- transaction_isolation_level.gemspec
|
73
74
|
homepage: http://github.com/willbryant/transaction_isolation_level
|
74
75
|
licenses: []
|
@@ -89,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
90
|
version: '0'
|
90
91
|
requirements: []
|
91
92
|
rubyforge_project:
|
92
|
-
rubygems_version: 2.5.2
|
93
|
+
rubygems_version: 2.5.2.2
|
93
94
|
signing_key:
|
94
95
|
specification_version: 4
|
95
96
|
summary: 'Adds :isolation_level option to ActiveRecord #transaction calls'
|