Class: Mkxms::Mssql::DefaultConstraint
- Inherits:
-
Object
- Object
- Mkxms::Mssql::DefaultConstraint
- Defined in:
- lib/mkxms/mssql/default_constraint_handler.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
Returns the value of attribute column.
-
#expression ⇒ Object
Returns the value of attribute expression.
-
#name ⇒ Object
Returns the value of attribute name.
-
#schema ⇒ Object
Returns the value of attribute schema.
-
#table ⇒ Object
Returns the value of attribute table.
Instance Method Summary collapse
-
#initialize(schema, table, column, name) ⇒ DefaultConstraint
constructor
A new instance of DefaultConstraint.
- #qualified_column ⇒ Object
- #qualified_name ⇒ Object
- #qualified_table ⇒ Object
- #to_sql ⇒ Object
Constructor Details
#initialize(schema, table, column, name) ⇒ DefaultConstraint
Returns a new instance of DefaultConstraint.
5 6 7 8 |
# File 'lib/mkxms/mssql/default_constraint_handler.rb', line 5 def initialize(schema, table, column, name) @schema, @table, @column, @name = schema, table, column, name @expression = '' end |
Instance Attribute Details
#column ⇒ Object
Returns the value of attribute column.
10 11 12 |
# File 'lib/mkxms/mssql/default_constraint_handler.rb', line 10 def column @column end |
#expression ⇒ Object
Returns the value of attribute expression.
10 11 12 |
# File 'lib/mkxms/mssql/default_constraint_handler.rb', line 10 def expression @expression end |
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'lib/mkxms/mssql/default_constraint_handler.rb', line 10 def name @name end |
#schema ⇒ Object
Returns the value of attribute schema.
10 11 12 |
# File 'lib/mkxms/mssql/default_constraint_handler.rb', line 10 def schema @schema end |
#table ⇒ Object
Returns the value of attribute table.
10 11 12 |
# File 'lib/mkxms/mssql/default_constraint_handler.rb', line 10 def table @table end |
Instance Method Details
#qualified_column ⇒ Object
20 21 22 |
# File 'lib/mkxms/mssql/default_constraint_handler.rb', line 20 def qualified_column "#@schema.#@table.#@column" end |
#qualified_name ⇒ Object
24 25 26 |
# File 'lib/mkxms/mssql/default_constraint_handler.rb', line 24 def qualified_name "#@schema.#@name" if @name end |
#qualified_table ⇒ Object
16 17 18 |
# File 'lib/mkxms/mssql/default_constraint_handler.rb', line 16 def qualified_table "#@schema.#@table" end |
#to_sql ⇒ Object
12 13 14 |
# File 'lib/mkxms/mssql/default_constraint_handler.rb', line 12 def to_sql "ALTER TABLE #@schema.#@table ADD #{"CONSTRAINT #@name" if @name} DEFAULT #@expression FOR #@column;" end |