Class: ActiveRecord::ConnectionAdapters::JdbcColumn

Inherits:
Column
  • Object
show all
Defined in:
lib/arjdbc/jdbc/column.rb

Direct Known Subclasses

MysqlColumn, PostgreSQLColumn, SQLite3Column

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, name, default, *args) ⇒ JdbcColumn

Returns a new instance of JdbcColumn.



6
7
8
9
10
# File 'lib/arjdbc/jdbc/column.rb', line 6

def initialize(config, name, default, *args)
  call_discovered_column_callbacks(config)
  super(name,default_value(default),*args)
  init_column(name, default, *args)
end

Instance Attribute Details

#limit=(value) ⇒ Object (writeonly)

Sets the attribute limit

Parameters:

  • value

    the value to set the attribute limit to.



4
5
6
# File 'lib/arjdbc/jdbc/column.rb', line 4

def limit=(value)
  @limit = value
end

#precision=(value) ⇒ Object (writeonly)

Sets the attribute precision

Parameters:

  • value

    the value to set the attribute precision to.



4
5
6
# File 'lib/arjdbc/jdbc/column.rb', line 4

def precision=(value)
  @precision = value
end

Class Method Details

.column_typesObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/arjdbc/jdbc/column.rb', line 19

def self.column_types
  # GH #25: reset the column types if the # of constants changed
  # since last call
  if ::ArJdbc.constants.size != driver_constants.size
    @driver_constants = nil
    @column_types = nil
  end
  @column_types ||= driver_constants.select {|c|
    c.respond_to? :column_selector }.map {|c|
    c.column_selector }.inject({}) {|h,val|
    h[val[0]] = val[1]; h }
end

.driver_constantsObject



32
33
34
# File 'lib/arjdbc/jdbc/column.rb', line 32

def self.driver_constants
  @driver_constants ||= ::ArJdbc.constants.map {|c| ::ArJdbc.const_get c }
end

Instance Method Details

#default_value(val) ⇒ Object



15
16
17
# File 'lib/arjdbc/jdbc/column.rb', line 15

def default_value(val)
  val
end

#init_column(*args) ⇒ Object



12
13
# File 'lib/arjdbc/jdbc/column.rb', line 12

def init_column(*args)
end