Class: ActiveRecord::ConnectionAdapters::Table

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

Overview

class IBM_DBColumn

Instance Method Summary collapse

Instance Method Details

#char(*args) ⇒ Object Also known as: character

Method to support the new syntax of rails 2.0 migrations (short-hand definitions) for columns of type char [character]



289
290
291
292
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 289

def char(*args)
  ibm_parse_column_attributes_args('char',*args)
  return self
end

#decfloat(*args) ⇒ Object

Method to support the new syntax of rails 2.0 migrations (short-hand definitions) for columns of type decfloat



283
284
285
286
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 283

def decfloat(*args)
  ibm_parse_column_attributes_args('decfloat',*args)
  return self
end

#double(*args) ⇒ Object

Method to support the new syntax of rails 2.0 migrations (short-hand definitions) for columns of type double



277
278
279
280
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 277

def double(*args)
  ibm_parse_column_attributes_args('double',*args)
  return self
end

#xml(*args) ⇒ Object

Method to support the new syntax of rails 2.0 migrations (short-hand definitions) for columns of type xml This method is different as compared to def char (sql is being issued explicitly as compared to def char where method column(which will generate the sql is being called) in order to handle the DEFAULT and NULL option for the native XML datatype



263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 263

def xml(*args ) 
  options = {}
  if args.last.is_a?(Hash) 
    options = args.delete_at(args.length-1)
  end
  sql = "ALTER TABLE #{@base.quote_table_name(@table_name)} ADD COLUMN "
  args.each do | name | 
    sql << "#{@base.quote_column_name(name)} xml"
    @base.execute(sql,"add_xml_column")
  end  
  return self
end