Module: ArJdbc::Util::SerializedAttributes

Defined in:
lib/arjdbc/util/serialized_attributes.rb

Overview

Gets included into ActiveRecord::Base to support sending LOB values in a separate update SQL statement for DB adapters that need this.

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#update_lob_columnsObject

protected



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/arjdbc/util/serialized_attributes.rb', line 11

def update_lob_columns
  klass = self.class
  return unless type = klass.lob_type # e.g. /blob/i
  connection = klass.connection
  if connection.respond_to?(:update_lob_values?)
    return false unless connection.update_lob_values?
  end
  klass.columns.each do |column|
    next if column.sql_type !~ type
    next if ( value = dump_column_value(column) ).nil?
    if connection.respond_to?(:update_lob_value?)
      next unless connection.update_lob_value?(value, column)
    end
    connection.update_lob_value(self, column, value)
  end
end