Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove quoted_string_prefix entirely since PostgreSQL was the only da…

…tabase adapter relying on it.
  • Loading branch information...
commit 457a54653d83406f4fe9105416034bbde8f2e637 1 parent 5c0ad82
Jeremy Kemper jeremy authored
10 activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
View
@@ -11,12 +11,12 @@ def quote(value, column = nil)
when String, ActiveSupport::Multibyte::Chars
value = value.to_s
if column && column.type == :binary && column.class.respond_to?(:string_to_binary)
- "#{quoted_string_prefix}'#{quote_string(column.class.string_to_binary(value))}'" # ' (for ruby-mode)
+ "'#{quote_string(column.class.string_to_binary(value))}'" # ' (for ruby-mode)
elsif column && [:integer, :float].include?(column.type)
value = column.type == :integer ? value.to_i : value.to_f
value.to_s
else
- "#{quoted_string_prefix}'#{quote_string(value)}'" # ' (for ruby-mode)
+ "'#{quote_string(value)}'" # ' (for ruby-mode)
end
when NilClass then "NULL"
when TrueClass then (column && column.type == :integer ? '1' : quoted_true)
@@ -28,7 +28,7 @@ def quote(value, column = nil)
if value.acts_like?(:date) || value.acts_like?(:time)
"'#{quoted_date(value)}'"
else
- "#{quoted_string_prefix}'#{quote_string(value.to_yaml)}'"
+ "'#{quote_string(value.to_yaml)}'"
end
end
end
@@ -60,10 +60,6 @@ def quoted_false
def quoted_date(value)
value.to_s(:db)
end
-
- def quoted_string_prefix
- ''
- end
end
end
end
4 activerecord/test/cases/finder_test.rb
View
@@ -518,8 +518,8 @@ def test_named_bind_with_postgresql_type_casts
end
def test_string_sanitation
- assert_not_equal "#{ActiveRecord::Base.connection.quoted_string_prefix}'something ' 1=1'", ActiveRecord::Base.sanitize("something ' 1=1")
- assert_equal "#{ActiveRecord::Base.connection.quoted_string_prefix}'something; select table'", ActiveRecord::Base.sanitize("something; select table")
+ assert_not_equal "'something ' 1=1'", ActiveRecord::Base.sanitize("something ' 1=1")
+ assert_equal "'something; select table'", ActiveRecord::Base.sanitize("something; select table")
end
def test_count
Please sign in to comment.
Something went wrong with that request. Please try again.