activerecord_bulkoperation 0.0.4 → 0.0.5
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
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: e0fdbe573c69d2ff5aa9df27fbf8203480723bbd
|
|
4
|
+
data.tar.gz: 7287e196ca1e4ef2f383396d1d43016a9ddc9148
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2194265b91b93611aa60fd74e783f64dc49b14bc275a1bd27ac00414f6dc39dac1c5b5ea2e12396eda60e68173cffd3cc4c8591fe7a80e62c28375903c7dfc1f
|
|
7
|
+
data.tar.gz: ead7b3f0f9a96f0923b4cb3ab22fd8340a20247ed8d69381aa938e944bb2e893c447979b07293ceca5eb30603ce78e649d0839ec1aca6cc9e37b0f026d05dc38
|
|
@@ -12,6 +12,8 @@ module ActiveRecord
|
|
|
12
12
|
fail ArgumentError.new('Array expected') unless values.is_a? Array
|
|
13
13
|
values = [values] unless values.select { |i| not i.is_a? Array }.empty?
|
|
14
14
|
|
|
15
|
+
return 0 if values.empty?
|
|
16
|
+
|
|
15
17
|
unless values.select { |i| not i.count == types.count }.empty?
|
|
16
18
|
fail ArgumentError.new('types.count must be equal to arr.count for every arr in values')
|
|
17
19
|
end
|
|
@@ -114,9 +116,11 @@ module ActiveRecord
|
|
|
114
116
|
|
|
115
117
|
result = cursor.exec_array
|
|
116
118
|
|
|
117
|
-
|
|
119
|
+
result_is_int = result.is_a? Integer
|
|
120
|
+
|
|
121
|
+
fail ExternalDataChange.new(sql) if result_is_int and result != values.count and optimistic
|
|
118
122
|
|
|
119
|
-
affected_rows += result
|
|
123
|
+
affected_rows += result_is_int ? result : 0
|
|
120
124
|
|
|
121
125
|
connection.send(:log, sql, 'Update') {}
|
|
122
126
|
ensure
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activerecord_bulkoperation
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OSP
|
|
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
112
112
|
version: '0'
|
|
113
113
|
requirements: []
|
|
114
114
|
rubyforge_project:
|
|
115
|
-
rubygems_version: 2.
|
|
115
|
+
rubygems_version: 2.5.2.1
|
|
116
116
|
signing_key:
|
|
117
117
|
specification_version: 4
|
|
118
118
|
summary: ''
|