composite_primary_keys 12.0.4 → 12.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
2
  SHA256:
3
- metadata.gz: 7659741f962a45ac7c557ae8dcb77a01bb361bd46ac8032f9dd4c05a89b14962
4
- data.tar.gz: e88d4c5c7e8dee12e00b8d339ec5397d28f104bfb8ea526e979ad45101f0225d
3
+ metadata.gz: b2a0ca9aa38fb1dfdca5c0974049eec9faf2c5703666a8e8de2ad28f6c78c7bc
4
+ data.tar.gz: 6384ddd8291fbd65e074965bfb70b8945c4ac6b556537973cc62561a86a0c609
5
5
  SHA512:
6
- metadata.gz: f99e8ab455cf07e5030a94cf87566143486027e359ca97709aca115350abe0f2e263b4d459134c1f032fd14e046a598e144e7107b5ba2d41d5ad182591cb205e
7
- data.tar.gz: 0ace5f54f8e1338393cf1e86e24ebe7fa7e414215fe7fdcfb2f4c7059ae6ebf40f38e4fc6aca3a20357e5794f4dbdb93d668da24c3aa8eb947b0ea35f9505f63
6
+ metadata.gz: 3c8a87f9676da79d514cd3dd2b21d7c1b523ddde1e13a2b37484e69ed4d93556e94fd725bc41642117338de66679932b69aff077c90c6c45d2026792439f4d5a
7
+ data.tar.gz: 5e393c7b725a757bef1a5b99efb9ef62612e3d11b7aa8dec15399684221a6a75f1b34908434b1471a0bc86a67814e7e387905d6e92885f7dddefb521668a7f9b
@@ -1,3 +1,6 @@
1
+ == 12.0.5 (2020-12-31)
2
+ * Finally issue with SQLServer when tables are marked as exclude_output_inserted. See #535. (Charlie Savage)
3
+
1
4
  == 12.0.4 (2020-12-30)
2
5
  * Fix compatibility with Ruby Ruby 2.6 and below (ta1kt0me)
3
6
  * Finally get SQLServer mass updates and deletes working (Charlie Savage)
@@ -15,15 +15,18 @@ module ActiveRecord
15
15
 
16
16
  table_name ||= get_table_name(sql)
17
17
  exclude_output_inserted = exclude_output_inserted_table_name?(table_name, sql)
18
-
19
18
  if exclude_output_inserted
20
19
  id_sql_type = exclude_output_inserted.is_a?(TrueClass) ? "bigint" : exclude_output_inserted
20
+ # CPK
21
+ # <<~SQL.squish
22
+ # DECLARE @ssaIdInsertTable table (#{quoted_pk} #{id_sql_type});
23
+ # #{sql.dup.insert sql.index(/ (DEFAULT )?VALUES/), " OUTPUT INSERTED.#{quoted_pk} INTO @ssaIdInsertTable"}
24
+ # SELECT CAST(#{quoted_pk.join(',')} AS #{id_sql_type}) FROM @ssaIdInsertTable
25
+ # SQL
21
26
  <<~SQL.squish
22
- DECLARE @ssaIdInsertTable table (#{quoted_pk} #{id_sql_type});
23
- # CPK
24
- # #{sql.dup.insert sql.index(/ (DEFAULT )?VALUES/), " OUTPUT INSERTED.#{quoted_pk} INTO @ssaIdInsertTable"}
27
+ DECLARE @ssaIdInsertTable table (#{quoted_pk.map {|subkey| "#{subkey} #{id_sql_type}"}.join(", ")});
25
28
  #{sql.dup.insert sql.index(/ (DEFAULT )?VALUES/), " OUTPUT INSERTED.#{quoted_pk.join(', INSERTED.')} INTO @ssaIdInsertTable"}
26
- SELECT CAST(#{quoted_pk.join(',')} AS #{id_sql_type}) FROM @ssaIdInsertTable
29
+ SELECT #{quoted_pk.map {|subkey| "CAST(#{subkey} AS #{id_sql_type}) #{subkey}"}.join(", ")} FROM @ssaIdInsertTable
27
30
  SQL
28
31
  else
29
32
  # CPK
@@ -2,7 +2,7 @@ module CompositePrimaryKeys
2
2
  module VERSION
3
3
  MAJOR = 12
4
4
  MINOR = 0
5
- TINY = 4
5
+ TINY = 5
6
6
  STRING = [MAJOR, MINOR, TINY].join('.')
7
7
  end
8
8
  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
4
+ version: 12.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charlie Savage
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-30 00:00:00.000000000 Z
11
+ date: 2020-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord