class Mkxms::Mssql::Column

Constants

SQL_OBJECT_TYPE

Attributes

collation[RW]
computed_expression[RW]
flags[R]
name[RW]
type[RW]
type_info[R]

Public Class Methods

new(name) click to toggle source
# File lib/mkxms/mssql/table_handler.rb, line 53
def initialize(name)
  @name = name
  @flags = []
  @type_info = {}
end

Public Instance Methods

each_type_part() { |type| ... } click to toggle source
# File lib/mkxms/mssql/table_handler.rb, line 76
def each_type_part
  yield type
  yield("COLLATE " + collation) if collation
  yield(nullable? ? 'NULL' : 'NOT NULL')
  if identity?
    yield "IDENTITY"
    yield("NOT FOR REPLICATION") unless replicated?
  end
  yield("ROWGUID") if rowguid?
end
to_sql() click to toggle source
# File lib/mkxms/mssql/table_handler.rb, line 64
def to_sql
  parts = [name]
  if computed_expression
    parts << "AS " + computed_expression
    parts << "PERSISTED" if persisted?
  else
    each_type_part {|part| parts << part}
  end
  
  return parts.join(' ')
end