File tree 1 file changed +19
-0
lines changed
lib/active_record/connection_adapters/sqlserver/core_ext
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,25 @@ module ConnectionAdapters
6
6
module SQLServer
7
7
module CoreExt
8
8
module Calculations
9
+
10
+ # Same as original except we don't perform PostgreSQL hack that removes ordering.
11
+ def calculate ( operation , column_name )
12
+ if has_include? ( column_name )
13
+ relation = apply_join_dependency
14
+
15
+ if operation . to_s . downcase == "count"
16
+ unless distinct_value || distinct_select? ( column_name || select_for_count )
17
+ relation . distinct!
18
+ relation . select_values = [ klass . primary_key || table [ Arel . star ] ]
19
+ end
20
+ end
21
+
22
+ relation . calculate ( operation , column_name )
23
+ else
24
+ perform_calculation ( operation , column_name )
25
+ end
26
+ end
27
+
9
28
private
10
29
11
30
def build_count_subquery ( relation , column_name , distinct )
You can’t perform that action at this time.
0 commit comments