Class: ActiveRecord::ConnectionAdapters::IBM_DBColumn

Inherits:
Column
  • Object
show all
Defined in:
lib/active_record/connection_adapters/ibm_db_adapter.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.binary_to_string(value) ⇒ Object

Used to convert from BLOBs to Strings



221
222
223
224
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 221

def self.binary_to_string(value)
  # Returns a string removing the eventual BLOB scalar function
  value.to_s.gsub(/"SYSIBM"."BLOB"\('(.*)'\)/i,'\1')
end

Instance Method Details

#type_cast(value) ⇒ Object

Casts value (which is a String) to an appropriate instance



213
214
215
216
217
218
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 213

def type_cast(value)
  # Casts the database NULL value to nil
  return nil if value == 'NULL'
  # Invokes parent's method for default casts
  super
end