2 module ConnectionAdapters
3 class JdbcColumn < Column
4 attr_writer :limit, :precision
6 def initialize(config, name, default, *args)
7 call_discovered_column_callbacks(config)
8 super(name,default_value(default),*args)
9 init_column(name, default, *args)
12 def init_column(*args)
15 def default_value(val)
20 # GH #25: reset the column types if the # of constants changed
22 if ::ArJdbc.constants.size != driver_constants.size
23 @driver_constants = nil
26 @column_types ||= driver_constants.select {|c|
27 c.respond_to? :column_selector }.map {|c|
28 c.column_selector }.inject({}) {|h,val|
29 h[val[0]] = val[1]; h }
32 def self.driver_constants
33 @driver_constants ||= ::ArJdbc.constants.map {|c| ::ArJdbc.const_get c }
37 def call_discovered_column_callbacks(config)
38 dialect = config[:dialect] || config[:driver]
39 for reg, func in JdbcColumn.column_types
40 if reg === dialect.to_s
41 func.call(config,self)