class Mkxms::Mssql::TableHandler::ColumnHandler
Attributes
column[R]
Public Class Methods
new(columns, node)
click to toggle source
# File lib/mkxms/mssql/table_handler.rb, line 92 def initialize(columns, node) a = node.attributes col_attrs = {} use_attr = proc {|k| col_attrs[k.gsub('-', '_').to_sym] = node.attributes[k]} col_type = %w[type-schema type].map {|k| use_attr[k]}.compact.join('.') if a.has_key?('capacity') col_type << "(%s)" % [use_attr['capacity']] end prec_scale = [] if a.has_key?('precision') || a.has_key?('scale') prec_scale << use_attr['precision'] end if a.has_key?('scale') prec_scale << use_attr['scale'] end unless prec_scale.empty? col_type << "(%s)" % (prec_scale.join(', ')) end if a.has_key?('xml_collection_id') col_type << "(%s %s)" % [ xml_structure = (a['full-xml-document'] ? 'DOCUMENT' : 'CONTENT'), a['xml_collection_id'] ] col_attrs[:xml_validation] = {xml_structure.downcase => a['xml_collection_id']} end raise UnsupportedFeatureError.new("Column #{name} declared 'not-ansi-padded'") if a['not-ansi-padded'] @column = Column.new(a['name']).tap do |c| c.type = col_type c.collation = a['collation'] c.flags << :nullable if a['nullable'] c.flags << :replicated if a['replicated'] c.flags << :filestream if a['filestream'] c.type_info.update(col_attrs) store_properties_on c columns << c end end
Public Instance Methods
handle_computed_expression_element(parse)
click to toggle source
# File lib/mkxms/mssql/table_handler.rb, line 138 def handle_computed_expression_element(parse) column.flags << :persisted if parse.node.attributes['persisted'] # Handle expression in #handle_text end
handle_text(text, parent_element)
click to toggle source
# File lib/mkxms/mssql/table_handler.rb, line 143 def handle_text(text, parent_element) case %i[namespace name].map {|m| parent_element.send(m)} when ['', 'computed-expression'] (column.computed_expression ||= '') << text end end