Permalink
Browse files

Merge pull request #167 from lexrupy/master

Fix Support for Ar 3.2.1
  • Loading branch information...
2 parents 20ab7f2 + d2d68df commit 361ed154dc2737c00685eb1c719facdd51801ccc @nicksieger nicksieger committed Feb 7, 2012
Showing with 20 additions and 4 deletions.
  1. +5 −1 lib/arjdbc/db2/adapter.rb
  2. +5 −1 lib/arjdbc/firebird/adapter.rb
  3. +5 −1 lib/arjdbc/informix/adapter.rb
  4. +5 −1 lib/arjdbc/oracle/adapter.rb
@@ -8,7 +8,11 @@ def after_save_with_db2zos_blob
lobfields = self.class.columns.select { |c| c.sql_type =~ /blob|clob/i }
lobfields.each do |c|
value = self[c.name]
- value = value.to_yaml if unserializable_attribute?(c.name, c)
+ if respond_to?(:unserializable_attribute?)
+ value = value.to_yaml if unserializable_attribute?(c.name, c)
+ else
+ value = value.to_yaml if value.is_a?(Hash)
+ end
next if value.nil?
connection.write_large_object(c.type == :binary, c.name, self.class.table_name, self.class.primary_key, quote_value(id), value)
end
@@ -7,7 +7,11 @@ def self.extended(mod)
def after_save_with_firebird_blob
self.class.columns.select { |c| c.sql_type =~ /blob/i }.each do |c|
value = self[c.name]
- value = value.to_yaml if unserializable_attribute?(c.name, c)
+ if respond_to?(:unserializable_attribute?)
+ value = value.to_yaml if unserializable_attribute?(c.name, c)
+ else
+ value = value.to_yaml if value.is_a?(Hash)
+ end
next if value.nil?
connection.write_large_object(c.type == :binary, c.name, self.class.table_name, self.class.primary_key, quote_value(id), value)
end
@@ -8,7 +8,11 @@ def write_lobs
self.class.columns.each do |c|
if [:text, :binary].include? c.type
value = self[c.name]
- value = value.to_yaml if unserializable_attribute?(c.name, c)
+ if respond_to?(:unserializable_attribute?)
+ value = value.to_yaml if unserializable_attribute?(c.name, c)
+ else
+ value = value.to_yaml if value.is_a?(Hash)
+ end
unless value.nil? || (value == '')
connection.write_large_object(c.type == :binary,
@@ -10,7 +10,11 @@ def self.extended(mod)
def after_save_with_oracle_lob
self.class.columns.select { |c| c.sql_type =~ /LOB\(|LOB$/i }.each do |c|
value = self[c.name]
- value = value.to_yaml if unserializable_attribute?(c.name, c)
+ if respond_to?(:unserializable_attribute?)
+ value = value.to_yaml if unserializable_attribute?(c.name, c)
+ else
+ value = value.to_yaml if value.is_a?(Hash)
+ end
next if value.nil? || (value == '')
connection.write_large_object(c.type == :binary, c.name, self.class.table_name, self.class.primary_key, quote_value(id), value)

0 comments on commit 361ed15

Please sign in to comment.