composite_primary_keys 12.0.7 → 12.0.8
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8349636fa2a670d60ef8f8cf288d31f805aafebb8c3f0d121c23aafb4f34dc08
|
4
|
+
data.tar.gz: 7932c338e6e3fad7831715dff3b879a9364356e19b93eeba8e5db55e74f6ad25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9659459ef7f9d4a0331e778904d7c3fe869c18c638a9b852bd1961cd8892699e6ef6e7cbea3127510926277cc6ad21a1ecd5d0e722f229b883361be02dc7aff9
|
7
|
+
data.tar.gz: 7dd7ce6eac76e6728f00337f325d55014b04e209458d826e439454a53eee9668f4e5cb165a2dfa07d4c9821d75f88666b156a66a875c78e87ce97dec35f7d262
|
data/History.rdoc
CHANGED
@@ -100,7 +100,7 @@ require_relative 'composite_primary_keys/nested_attributes'
|
|
100
100
|
|
101
101
|
require_relative 'composite_primary_keys/connection_adapters/abstract/database_statements'
|
102
102
|
require_relative 'composite_primary_keys/connection_adapters/abstract_adapter'
|
103
|
-
|
103
|
+
require_relative 'composite_primary_keys/connection_adapters/mysql/database_statements'
|
104
104
|
require_relative 'composite_primary_keys/connection_adapters/postgresql/database_statements'
|
105
105
|
require_relative 'composite_primary_keys/connection_adapters/sqlserver/database_statements'
|
106
106
|
|
@@ -5,31 +5,16 @@ module ActiveRecord
|
|
5
5
|
sql, binds = to_sql_and_binds(arel, binds)
|
6
6
|
value = exec_insert(sql, name, binds, pk, sequence_name)
|
7
7
|
|
8
|
-
return id_value if id_value
|
9
|
-
|
10
8
|
if pk.is_a?(Array) && !value.empty?
|
11
9
|
# This is a CPK model and the query result is not empty. Thus we can figure out the new ids for each
|
12
10
|
# auto incremented field
|
13
|
-
pk.map {|key| value.first[key]}
|
11
|
+
id_value || pk.map {|key| value.first[key]}
|
14
12
|
elsif pk.is_a?(Array)
|
15
|
-
# This is CPK, but we don't know what autoincremented fields were updated.
|
16
|
-
|
17
|
-
|
18
|
-
# Is there an autoincrementing field?
|
19
|
-
auto_key = pk.find do |key|
|
20
|
-
attribute = arel.ast.relation[key]
|
21
|
-
column = column_for_attribute(attribute)
|
22
|
-
if column.respond_to?(:auto_increment?)
|
23
|
-
column.auto_increment?
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
if auto_key
|
28
|
-
result[pk.index(auto_key)] = last_inserted_id(value)
|
29
|
-
end
|
30
|
-
result
|
13
|
+
# This is CPK, but we don't know what autoincremented fields were updated. So return nil, which means
|
14
|
+
# the existing id_value of the model will be used.
|
15
|
+
id_value || Array.new(pk.size)
|
31
16
|
else
|
32
|
-
last_inserted_id(value)
|
17
|
+
id_value || last_inserted_id(value)
|
33
18
|
end
|
34
19
|
end
|
35
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: composite_primary_keys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.0.
|
4
|
+
version: 12.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charlie Savage
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|