From c80efeed8d24d705e3270d96c7c0fbcd1d978c62 Mon Sep 17 00:00:00 2001 From: Nikhil Sarwate Date: Wed, 5 Feb 2014 09:53:35 -0800 Subject: [PATCH] missing parens --- lib/arel/visitors/sqlserver.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/arel/visitors/sqlserver.rb b/lib/arel/visitors/sqlserver.rb index eed6b2be6..ed750b1bb 100644 --- a/lib/arel/visitors/sqlserver.rb +++ b/lib/arel/visitors/sqlserver.rb @@ -96,7 +96,7 @@ def visit_Arel_Nodes_SelectStatementWithOutOffset(o, a, windowed = false) (projections.map{ |x| v = visit(x); v == "1" ? "1 AS [__wrp]" : v }.join(', ')), (source_with_lock_for_select_statement(o)), ("WHERE #{core.wheres.map{ |x| visit(x) }.join ' AND ' }" unless core.wheres.empty?), - ("GROUP BY #{groups.map { |x| visit x }.join ', ' }" unless groups.empty?), + ("GROUP BY #{groups.map { |x| visit(x) }.join ', ' }" unless groups.empty?), (visit(core.having) if core.having), ("ORDER BY #{orders.map{ |x| visit(x) }.join(', ')}" if !orders.empty? && !windowed) ].compact.join ' ' @@ -183,18 +183,18 @@ def single_distinct_select_statement?(o) ((p1.respond_to?(:distinct) && p1.distinct) || p1.respond_to?(:include?) && p1.include?('DISTINCT')) end - + def windowed_single_distinct_select_statement?(o) o.limit && o.offset && single_distinct_select_statement?(o) end - + def single_distinct_select_everything_statement?(o) single_distinct_select_statement?(o) && visit(o.cores.first.projections.first).ends_with?(".*") end - + def top_one_everything_for_through_join?(o) - single_distinct_select_everything_statement?(o) && - (o.limit && !o.offset) && + single_distinct_select_everything_statement?(o) && + (o.limit && !o.offset) && join_in_select_statement?(o) end @@ -212,9 +212,9 @@ def function_select_statement?(o) def eager_limiting_select_statement?(o) core = o.cores.first - single_distinct_select_statement?(o) && - (o.limit && !o.offset) && - core.groups.empty? && + single_distinct_select_statement?(o) && + (o.limit && !o.offset) && + core.groups.empty? && !single_distinct_select_everything_statement?(o) end @@ -230,7 +230,7 @@ def complex_count_sql?(o) o.limit && !join_in_select_statement?(o) end - + def select_primary_key_sql?(o) core = o.cores.first return false if core.projections.size != 1