Class: Mkxms::Mssql::Synonym

Inherits:
Object
  • Object
show all
Includes:
ExtendedProperties, Property::Hosting, Property::SchemaScoped, Utils::SchemaQualifiedName
Defined in:
lib/mkxms/mssql/synonym_handler.rb

Constant Summary collapse

SQL_OBJECT_TYPE =
'SYNONYM'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::SchemaQualifiedName

#qualified_name

Methods included from ExtendedProperties

#extended_properties

Methods included from Property::Hosting

#extended_properties_sql

Methods included from Property::SchemaScoped

#property_subject_identifiers, #subitem_extended_properties_sql

Constructor Details

#initialize(schema, name, referent) ⇒ Synonym

Returns a new instance of Synonym.



13
14
15
16
17
# File 'lib/mkxms/mssql/synonym_handler.rb', line 13

def initialize(schema, name, referent)
  @schema = schema
  @name = name
  @referent = referent
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



19
20
21
# File 'lib/mkxms/mssql/synonym_handler.rb', line 19

def name
  @name
end

#referentObject

Returns the value of attribute referent.



19
20
21
# File 'lib/mkxms/mssql/synonym_handler.rb', line 19

def referent
  @referent
end

#schemaObject

Returns the value of attribute schema.



19
20
21
# File 'lib/mkxms/mssql/synonym_handler.rb', line 19

def schema
  @schema
end

Instance Method Details

#to_sqlObject



21
22
23
24
25
26
# File 'lib/mkxms/mssql/synonym_handler.rb', line 21

def to_sql
  [].tap do |lines|
    lines << "CREATE SYNONYM #{qualified_name} FOR #{referent};"
    lines.concat extended_properties_sql
  end.join("\n")
end