aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorEugene Pimenov <libc@mac.com>2009-09-20 14:35:24 +0400
committerwycats <wycats@gmail.com>2010-03-28 18:04:46 -0700
commitfc6746fc3f102029020e3893cde5480a58470d59 (patch)
tree516698c73474f2abc9f5066a2955f1788229ddce /activerecord/lib
parentde2b0147d04d5460e576cc21afbb062eb012ea7e (diff)
downloadrails-fc6746fc3f102029020e3893cde5480a58470d59.tar.gz
rails-fc6746fc3f102029020e3893cde5480a58470d59.tar.bz2
rails-fc6746fc3f102029020e3893cde5480a58470d59.zip
PostgreSQL adapter: escape_bytea, quote_string and unescape_bytea aren't thread-safe in Ruby 1.8 [#3237 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index 2ae26246a2..a6042e1382 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -300,7 +300,7 @@ module ActiveRecord
# QUOTING ==================================================
# Escapes binary strings for bytea input to the database.
- def escape_bytea(value)
+ def escape_bytea(original_value)
if @connection.respond_to?(:escape_bytea)
self.class.instance_eval do
define_method(:escape_bytea) do |value|
@@ -324,13 +324,13 @@ module ActiveRecord
end
end
end
- escape_bytea(value)
+ escape_bytea(original_value)
end
# Unescapes bytea output from a database to the binary string it represents.
# NOTE: This is NOT an inverse of escape_bytea! This is only to be used
# on escaped binary output from database drive.
- def unescape_bytea(value)
+ def unescape_bytea(original_value)
# In each case, check if the value actually is escaped PostgreSQL bytea output
# or an unescaped Active Record attribute that was just written.
if PGconn.respond_to?(:unescape_bytea)
@@ -370,7 +370,7 @@ module ActiveRecord
end
end
end
- unescape_bytea(value)
+ unescape_bytea(original_value)
end
# Quotes PostgreSQL-specific data types for SQL input.
@@ -395,7 +395,7 @@ module ActiveRecord
end
# Quotes strings for use in SQL input in the postgres driver for better performance.
- def quote_string(s) #:nodoc:
+ def quote_string(original_value) #:nodoc:
if @connection.respond_to?(:escape)
self.class.instance_eval do
define_method(:quote_string) do |s|
@@ -415,7 +415,7 @@ module ActiveRecord
remove_method(:quote_string)
end
end
- quote_string(s)
+ quote_string(original_value)
end
# Checks the following cases: