From 3da816a77318d28617d0e12739d29d76e372a4f9 Mon Sep 17 00:00:00 2001 From: arkadiy kraportov Date: Fri, 10 Jun 2011 12:47:55 +0900 Subject: remove unnecessary guarding agains literal --- lib/arel/visitors/mssql.rb | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'lib') diff --git a/lib/arel/visitors/mssql.rb b/lib/arel/visitors/mssql.rb index 713ad0f0f8..23dc06a936 100644 --- a/lib/arel/visitors/mssql.rb +++ b/lib/arel/visitors/mssql.rb @@ -24,7 +24,6 @@ module Arel x.projections = [row_num_literal(core_order_by)] is_select_count = true else - guard_against_select_constant! x x.projections << row_num_literal(core_order_by) end @@ -63,21 +62,12 @@ module Arel x.projections.length == 1 && Arel::Nodes::Count === x.projections.first end - def guard_against_select_constant! x - # guard against .select(1) (i.e. validate_uniqueness uses it to minimize qry result set) - # todo it won't work for .select('a'), which is probably ok. 'coz of workaround: .select("'a' as a") - x.projections.map! do |p| - p.kind_of?(Fixnum) ? Nodes::SqlLiteral.new("#{p} as _fld_#{p}") : p - end - end - # fixme raise exception of there is no pk? # fixme!! Table.primary_key will be depricated. What is the replacement?? def find_left_table_pk o return visit o.primary_key if o.instance_of? Arel::Table find_left_table_pk o.left if o.kind_of? Arel::Nodes::Join end - end end end -- cgit v1.2.3