Skip to content
This repository
Browse code

Remove quoted_string_prefix entirely since PostgreSQL was the only da…

…tabase adapter relying on it.
  • Loading branch information...
commit bd3cc6bfffd02302414f1558be7d6105ac47e67a 1 parent ed0ca5d
Jeremy Kemper authored April 24, 2010
10  activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
@@ -13,12 +13,12 @@ def quote(value, column = nil)
13 13
           when String, ActiveSupport::Multibyte::Chars
14 14
             value = value.to_s
15 15
             if column && column.type == :binary && column.class.respond_to?(:string_to_binary)
16  
-              "#{quoted_string_prefix}'#{quote_string(column.class.string_to_binary(value))}'" # ' (for ruby-mode)
  16
+              "'#{quote_string(column.class.string_to_binary(value))}'" # ' (for ruby-mode)
17 17
             elsif column && [:integer, :float].include?(column.type)
18 18
               value = column.type == :integer ? value.to_i : value.to_f
19 19
               value.to_s
20 20
             else
21  
-              "#{quoted_string_prefix}'#{quote_string(value)}'" # ' (for ruby-mode)
  21
+              "'#{quote_string(value)}'" # ' (for ruby-mode)
22 22
             end
23 23
           when NilClass                 then "NULL"
24 24
           when TrueClass                then (column && column.type == :integer ? '1' : quoted_true)
@@ -30,7 +30,7 @@ def quote(value, column = nil)
30 30
             if value.acts_like?(:date) || value.acts_like?(:time)
31 31
               "'#{quoted_date(value)}'"
32 32
             else
33  
-              "#{quoted_string_prefix}'#{quote_string(value.to_yaml)}'"
  33
+              "'#{quote_string(value.to_yaml)}'"
34 34
             end
35 35
         end
36 36
       end
@@ -67,10 +67,6 @@ def quoted_date(value)
67 67
           value
68 68
         end.to_s(:db)
69 69
       end
70  
-
71  
-      def quoted_string_prefix
72  
-        ''
73  
-      end
74 70
     end
75 71
   end
76 72
 end
4  activerecord/test/cases/finder_test.rb
@@ -566,8 +566,8 @@ def test_named_bind_with_postgresql_type_casts
566 566
   end
567 567
 
568 568
   def test_string_sanitation
569  
-    assert_not_equal "#{ActiveRecord::Base.connection.quoted_string_prefix}'something ' 1=1'", ActiveRecord::Base.sanitize("something ' 1=1")
570  
-    assert_equal "#{ActiveRecord::Base.connection.quoted_string_prefix}'something; select table'", ActiveRecord::Base.sanitize("something; select table")
  569
+    assert_not_equal "'something ' 1=1'", ActiveRecord::Base.sanitize("something ' 1=1")
  570
+    assert_equal "'something; select table'", ActiveRecord::Base.sanitize("something; select table")
571 571
   end
572 572
 
573 573
   def test_count

0 notes on commit bd3cc6b

Please sign in to comment.
Something went wrong with that request. Please try again.