diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-26 04:15:57 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-26 04:15:57 +0000 |
commit | 91ea35307a1ce21d56a147c42ecf6c9061582c67 (patch) | |
tree | 0908ed796ae4af43707f7bd1a68d91beabede69d /activerecord/lib | |
parent | a5991d849175c2ae9b803486f61b610fad9fd87e (diff) | |
download | rails-91ea35307a1ce21d56a147c42ecf6c9061582c67.tar.gz rails-91ea35307a1ce21d56a147c42ecf6c9061582c67.tar.bz2 rails-91ea35307a1ce21d56a147c42ecf6c9061582c67.zip |
Only string_to_binary if the column responds
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4040 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
4 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb index 881e22c476..2234476189 100755 --- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb @@ -116,7 +116,7 @@ module ActiveRecord # QUOTING ================================================== def quote(value, column = nil) - if value.kind_of?(String) && column && column.type == :binary + if value.kind_of?(String) && column && column.type == :binary && column.class.respond_to?(:string_to_binary) s = column.class.string_to_binary(value).unpack("H*")[0] "x'#{s}'" else diff --git a/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb b/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb index c34b3596df..c752451bff 100644 --- a/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb @@ -210,7 +210,7 @@ begin end def quote(value, column = nil) #:nodoc: - if column and column.type == :binary then %Q{empty_#{ column.sql_type }()} + if column && column.type == :binary then %Q{empty_#{ column.sql_type }()} else case value when String then %Q{'#{quote_string(value)}'} when NilClass then 'null' diff --git a/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb index 2c3353d8e5..0790dc18e1 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb @@ -330,7 +330,7 @@ module ActiveRecord def quote(value, column = nil) case value when String - if column && column.type == :binary + if column && column.type == :binary && column.class.respond_to?(:string_to_binary) "'#{quote_string(column.class.string_to_binary(value))}'" else "'#{quote_string(value)}'" diff --git a/activerecord/lib/active_record/connection_adapters/sybase_adapter.rb b/activerecord/lib/active_record/connection_adapters/sybase_adapter.rb index 75a0b4ed18..33dbebce7d 100644 --- a/activerecord/lib/active_record/connection_adapters/sybase_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sybase_adapter.rb @@ -263,7 +263,7 @@ module ActiveRecord def quote(value, column = nil) case value when String - if column && column.type == :binary + if column && column.type == :binary && column.class.respond_to?(:string_to_binary) "#{quote_string(column.class.string_to_binary(value))}" elsif value =~ /^[+-]?[0-9]+$/o value |