Column
The base class for all of {JdbcAdapter}‘s returned columns. Instances of {JdbcColumn} will get extended with “column-spec” modules (similar to how {JdbcAdapter} gets spec modules in) if the adapter spec module provided a `column_selector` (matcher) method for it’s database specific type. @see JdbcAdapter#jdbc_column_class
Returns the available column types @return [Hash] of (matcher, block) pairs
# File lib/arjdbc/jdbc/column.rb, line 51 def self.column_types types = {} for mod in ::ArJdbc.modules if mod.respond_to?(:column_selector) sel = mod.column_selector # [ matcher, block ] types[ sel[0] ] = sel[1] end end types end
# File lib/arjdbc/jdbc/column.rb, line 12 def initialize(config, name, *args) if self.class == JdbcColumn # NOTE: extending classes do not want this if they do they shall call call_discovered_column_callbacks(config) if config default = args.shift else # for extending classes allow ignoring first argument : if ! config.nil? && ! config.is_a?(Hash) default = name; name = config # initialize(name, default, *args) else default = args.shift end end # super <= 4.1: (name, default, sql_type = nil, null = true) # super master: (name, default, cast_type, sql_type = nil, null = true) super(name, default_value(default), *args) init_column(name, default, *args) end
@private
# File lib/arjdbc/jdbc/column.rb, line 40 def call_discovered_column_callbacks(config) dialect = (config[:dialect] || config[:driver]).to_s for matcher, block in self.class.column_types block.call(config, self) if matcher === dialect end end
Generated with the Darkfish Rdoc Generator 2.