aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-xactiverecord/lib/active_record/connection_adapters/mysql_adapter.rb2
-rw-r--r--activerecord/lib/active_record/connection_adapters/oracle_adapter.rb2
-rw-r--r--activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb2
-rw-r--r--activerecord/lib/active_record/connection_adapters/sybase_adapter.rb2
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