diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-06 13:59:15 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-06 13:59:15 +0000 |
commit | cbb65c39ec22a57d31dc2b94a0a385ad461045f2 (patch) | |
tree | ed815be6ae2416bd1fac55f2d623782275004005 | |
parent | 00fe726a764c3a935351999022d3eac5cc89aac5 (diff) | |
download | rails-cbb65c39ec22a57d31dc2b94a0a385ad461045f2.tar.gz rails-cbb65c39ec22a57d31dc2b94a0a385ad461045f2.tar.bz2 rails-cbb65c39ec22a57d31dc2b94a0a385ad461045f2.zip |
Fixed that postgresql adapter would fails when reading bytea fields with null value #771 [rodrigo k]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@849 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 8b4fb696fc..b7ca509ef8 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -143,11 +143,11 @@ module ActiveRecord end def escape_bytea(s) - s.gsub(/\\/) { '\\\\\\\\' }.gsub(/[^\\]/) { |c| sprintf('\\\\%03o', c[0].to_i) } + s.gsub(/\\/) { '\\\\\\\\' }.gsub(/[^\\]/) { |c| sprintf('\\\\%03o', c[0].to_i) } unless s.nil? end def unescape_bytea(s) - s.gsub(/\\([0-9][0-9][0-9])/) { $1.oct.chr }.gsub(/\\\\/) { '\\' } + s.gsub(/\\([0-9][0-9][0-9])/) { $1.oct.chr }.gsub(/\\\\/) { '\\' } unless s.nil? end def split_table_schema(table_name) |