activerecord-sqlserver-adapter 7.1.8 → 7.1.10
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: 51943ff8896e187bfaaacc10538c141f72cf0afe8a4b485999259ec91af62af9
|
4
|
+
data.tar.gz: 257d760d9bb1c655447a9b21cab497cbca0c3cf6aa37b840149e239fa19d8051
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad5478179fc31c9cd50ad4bedc8ba9affbff6f0d0eeb21066de9ab5d8b6a60d61f5c3221d3969d6484455be1845e8c1e9643d807f76733e0b45b4d5e75cadf7b
|
7
|
+
data.tar.gz: 4c1ececbe3b65b77a45b9234cb91f9d3b322840d6f10617def9188147b34b8b620cfb4c5a688ac6221f0e6c6b1a30345eade2e9c7e7965f4650ec4f8dfb7ce04
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## v7.1.10
|
2
|
+
|
3
|
+
#### Fixed
|
4
|
+
|
5
|
+
- [#1262](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1262) Fix distinct alias when multiple databases used.
|
6
|
+
|
7
|
+
## v7.1.9
|
8
|
+
|
9
|
+
#### Fixed
|
10
|
+
|
11
|
+
- [#1245](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1245) Allow INSERT statements with SELECT notation
|
12
|
+
|
1
13
|
## v7.1.8
|
2
14
|
|
3
15
|
#### Fixed
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.1.
|
1
|
+
7.1.10
|
@@ -347,12 +347,16 @@ module ActiveRecord
|
|
347
347
|
|
348
348
|
def columns_for_distinct(columns, orders)
|
349
349
|
order_columns = orders.reject(&:blank?).map { |s|
|
350
|
-
s = s
|
350
|
+
s = visitor.compile(s) unless s.is_a?(String)
|
351
351
|
s.gsub(/\s+(?:ASC|DESC)\b/i, "")
|
352
352
|
.gsub(/\s+NULLS\s+(?:FIRST|LAST)\b/i, "")
|
353
|
-
|
353
|
+
}
|
354
|
+
.reject(&:blank?)
|
355
|
+
.reject { |s| columns.include?(s) }
|
354
356
|
|
355
|
-
|
357
|
+
order_columns_aliased = order_columns.map.with_index { |column, i| "#{column} AS alias_#{i}" }
|
358
|
+
|
359
|
+
(order_columns_aliased << super).join(", ")
|
356
360
|
end
|
357
361
|
|
358
362
|
def update_table_definition(table_name, base)
|
@@ -681,6 +685,7 @@ module ActiveRecord
|
|
681
685
|
s.split(/INSERT INTO/i)[1]
|
682
686
|
.split(/OUTPUT INSERTED/i)[0]
|
683
687
|
.split(/(DEFAULT)?\s+VALUES/i)[0]
|
688
|
+
.split(/\bSELECT\b(?![^\[]*\])/i)[0]
|
684
689
|
.match(/\s*([^(]*)/i)[0]
|
685
690
|
elsif s.match?(/^\s*UPDATE\s+.*/i)
|
686
691
|
s.match(/UPDATE\s+([^\(\s]+)\s*/i)[1]
|
@@ -581,4 +581,13 @@ class AdapterTestSQLServer < ActiveRecord::TestCase
|
|
581
581
|
end
|
582
582
|
end
|
583
583
|
end
|
584
|
+
|
585
|
+
describe "distinct select query" do
|
586
|
+
it "generated SQL does not contain unnecessary alias projection" do
|
587
|
+
sqls = capture_sql do
|
588
|
+
Post.includes(:comments).joins(:comments).first
|
589
|
+
end
|
590
|
+
assert_no_match(/AS alias_0/, sqls.first)
|
591
|
+
end
|
592
|
+
end
|
584
593
|
end
|
@@ -96,6 +96,10 @@ class SchemaTestSQLServer < ActiveRecord::TestCase
|
|
96
96
|
it do
|
97
97
|
assert_equal "[test].[aliens]", connection.send(:get_raw_table_name, "EXEC sp_executesql N'INSERT INTO [test].[aliens] ([name]) OUTPUT INSERTED.[id] VALUES (@0)', N'@0 varchar(255)', @0 = 'Trisolarans'")
|
98
98
|
end
|
99
|
+
|
100
|
+
it do
|
101
|
+
assert_equal "[with].[select notation]", connection.send(:get_raw_table_name, "INSERT INTO [with].[select notation] SELECT * FROM [table_name]")
|
102
|
+
end
|
99
103
|
end
|
100
104
|
end
|
101
105
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-sqlserver-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.1.
|
4
|
+
version: 7.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Collins
|
@@ -15,7 +15,7 @@ authors:
|
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
|
-
date: 2024-
|
18
|
+
date: 2024-12-08 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: activerecord
|
@@ -240,8 +240,8 @@ licenses:
|
|
240
240
|
- MIT
|
241
241
|
metadata:
|
242
242
|
bug_tracker_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues
|
243
|
-
changelog_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/v7.1.
|
244
|
-
source_code_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/v7.1.
|
243
|
+
changelog_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/v7.1.10/CHANGELOG.md
|
244
|
+
source_code_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/v7.1.10
|
245
245
|
post_install_message:
|
246
246
|
rdoc_options: []
|
247
247
|
require_paths:
|
@@ -257,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
257
257
|
- !ruby/object:Gem::Version
|
258
258
|
version: '0'
|
259
259
|
requirements: []
|
260
|
-
rubygems_version: 3.5.
|
260
|
+
rubygems_version: 3.5.21
|
261
261
|
signing_key:
|
262
262
|
specification_version: 4
|
263
263
|
summary: ActiveRecord SQL Server Adapter.
|