Class: ActiveRecord::ConnectionAdapters::InterBaseColumn

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

Overview

:nodoc:

Constant Summary collapse

VARCHAR_MAX_LENGTH =
32_765
BLOB_MAX_LENGTH =

because activerecord has no parameterized inserts/updates!!!!!

32_767
DEFAULT_STRING_LENGTH =

to allow :string fields to be indexes

252

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(interBaseColumn) ⇒ InterBaseColumn

Returns a new instance of InterBaseColumn.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/active_record/connection_adapters/interbase_adapter.rb', line 100

def initialize(interBaseColumn)
  @interBaseColumn = interBaseColumn
  
  @name = InterBaseAdapter.ib_to_ar_case(interBaseColumn.name.downcase)
  @sql_type = interBaseColumn.to_s
  @null = !interBaseColumn.not_null
  @limit = !interBaseColumn.type == IBRuby::InterBaseColumn::BLOB ? BLOB_MAX_LENGTH : interBaseColumn.length
  @precision = interBaseColumn.precision
  @scale = interBaseColumn.scale
  @type = simplified_type(@sql_type)
  
  @default = typecast_default
  
  @primary = nil
end

Instance Attribute Details

#interBaseColumnObject (readonly)

Returns the value of attribute interBaseColumn.



98
99
100
# File 'lib/active_record/connection_adapters/interbase_adapter.rb', line 98

def interBaseColumn
  @interBaseColumn
end

Instance Method Details

#defaultObject

def initialize



116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/active_record/connection_adapters/interbase_adapter.rb', line 116

def default
  if !@interBaseColumn.default.nil?
    if ( [:timestamp, :time, :date].detect() {|val| @type == val } ) && 
     ( @interBaseColumn.default.to_s =~ /^current_/i )
      request_db_value( @interBaseColumn.default )
    else
      @default
    end
  else
    nil
  end
end

#type_cast(value) ⇒ Object

def default



129
130
131
132
133
# File 'lib/active_record/connection_adapters/interbase_adapter.rb', line 129

def type_cast(value)
  retVal = super
  #puts "type_cast #{@name}:#{@interbase_type} = #{value} ==> #{retVal}"
  retVal
end