@@ -640,7 +640,7 class Query < ActiveRecord::Base | |||
|
640 | 640 | sql = "#{db_table}.#{db_field} BETWEEN #{value.first.to_f - 1e-5} AND #{value.first.to_f + 1e-5}" |
|
641 | 641 | end |
|
642 | 642 | else |
|
643 | sql = "#{db_table}.#{db_field} IN (" + value.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + ")" | |
|
643 | sql = "#{db_table}.#{db_field} IN (" + value.collect{|val| "'#{ActiveRecord::Base.connection.quote_string(val)}'"}.join(",") + ")" | |
|
644 | 644 | end |
|
645 | 645 | else |
|
646 | 646 | # IN an empty set |
@@ -648,7 +648,7 class Query < ActiveRecord::Base | |||
|
648 | 648 | end |
|
649 | 649 | when "!" |
|
650 | 650 | if value.any? |
|
651 | sql = "(#{db_table}.#{db_field} IS NULL OR #{db_table}.#{db_field} NOT IN (" + value.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + "))" | |
|
651 | sql = "(#{db_table}.#{db_field} IS NULL OR #{db_table}.#{db_field} NOT IN (" + value.collect{|val| "'#{ActiveRecord::Base.connection.quote_string(val)}'"}.join(",") + "))" | |
|
652 | 652 | else |
|
653 | 653 | # NOT IN an empty set |
|
654 | 654 | sql = "1=1" |
@@ -690,9 +690,9 class Query < ActiveRecord::Base | |||
|
690 | 690 | end |
|
691 | 691 | end |
|
692 | 692 | when "o" |
|
693 | sql = "#{queried_table_name}.status_id IN (SELECT id FROM #{IssueStatus.table_name} WHERE is_closed=#{connection.quoted_false})" if field == "status_id" | |
|
693 | sql = "#{queried_table_name}.status_id IN (SELECT id FROM #{IssueStatus.table_name} WHERE is_closed=#{ActiveRecord::Base.connection.quoted_false})" if field == "status_id" | |
|
694 | 694 | when "c" |
|
695 | sql = "#{queried_table_name}.status_id IN (SELECT id FROM #{IssueStatus.table_name} WHERE is_closed=#{connection.quoted_true})" if field == "status_id" | |
|
695 | sql = "#{queried_table_name}.status_id IN (SELECT id FROM #{IssueStatus.table_name} WHERE is_closed=#{ActiveRecord::Base.connection.quoted_true})" if field == "status_id" | |
|
696 | 696 | when "><t-" |
|
697 | 697 | # between today - n days and today |
|
698 | 698 | sql = relative_date_clause(db_table, db_field, - value.first.to_i, 0) |
@@ -754,9 +754,9 class Query < ActiveRecord::Base | |||
|
754 | 754 | date = Date.today |
|
755 | 755 | sql = date_clause(db_table, db_field, date.beginning_of_year, date.end_of_year) |
|
756 | 756 | when "~" |
|
757 | sql = "LOWER(#{db_table}.#{db_field}) LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'" | |
|
757 | sql = "LOWER(#{db_table}.#{db_field}) LIKE '%#{ActiveRecord::Base.connection.quote_string(value.first.to_s.downcase)}%'" | |
|
758 | 758 | when "!~" |
|
759 | sql = "LOWER(#{db_table}.#{db_field}) NOT LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'" | |
|
759 | sql = "LOWER(#{db_table}.#{db_field}) NOT LIKE '%#{ActiveRecord::Base.connection.quote_string(value.first.to_s.downcase)}%'" | |
|
760 | 760 | else |
|
761 | 761 | raise "Unknown query operator #{operator}" |
|
762 | 762 | end |
@@ -819,7 +819,7 class Query < ActiveRecord::Base | |||
|
819 | 819 | if self.class.default_timezone == :utc |
|
820 | 820 | from = from.utc |
|
821 | 821 | end |
|
822 | s << ("#{table}.#{field} > '%s'" % [connection.quoted_date(from)]) | |
|
822 | s << ("#{table}.#{field} > '%s'" % [ActiveRecord::Base.connection.quoted_date(from)]) | |
|
823 | 823 | end |
|
824 | 824 | if to |
|
825 | 825 | if to.is_a?(Date) |
@@ -828,7 +828,7 class Query < ActiveRecord::Base | |||
|
828 | 828 | if self.class.default_timezone == :utc |
|
829 | 829 | to = to.utc |
|
830 | 830 | end |
|
831 | s << ("#{table}.#{field} <= '%s'" % [connection.quoted_date(to)]) | |
|
831 | s << ("#{table}.#{field} <= '%s'" % [ActiveRecord::Base.connection.quoted_date(to)]) | |
|
832 | 832 | end |
|
833 | 833 | s.join(' AND ') |
|
834 | 834 | end |
General Comments 0
You need to be logged in to leave comments.
Login now