Class: Mkxms::Mssql::StoredProcedure

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

Constant Summary collapse

SQL_OBJECT_TYPE =
'PROCEDURE'

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(attrs) ⇒ StoredProcedure

Returns a new instance of StoredProcedure.



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

def initialize(attrs)
  @schema = attrs['schema']
  @name = attrs['name']
  @definition = ''
  @param_properties = Hash.new {|h, k| h[k] = ''}
end

Instance Attribute Details

#definitionObject (readonly)

Returns the value of attribute definition.



20
21
22
# File 'lib/mkxms/mssql/stored_procedure_handler.rb', line 20

def definition
  @definition
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#param_propertiesObject (readonly)

Returns the value of attribute param_properties.



20
21
22
# File 'lib/mkxms/mssql/stored_procedure_handler.rb', line 20

def param_properties
  @param_properties
end

#schemaObject

Returns the value of attribute schema.



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

def schema
  @schema
end

Instance Method Details

#param_properties_sqlObject



27
28
29
30
31
# File 'lib/mkxms/mssql/stored_procedure_handler.rb', line 27

def param_properties_sql
  @param_properties.each_pair.map do |k, v|
    Property.addition_sql(k[1], v, property_subject_identifiers + ['PARAMETER', Utils.unquoted_name(k[0])])
  end
end

#to_sqlObject



22
23
24
25
# File 'lib/mkxms/mssql/stored_procedure_handler.rb', line 22

def to_sql
  mvdef = AccessObjectDefinition.replace_object_name(definition, "[{filename}]")
  ([mvdef] + extended_properties_sql + param_properties_sql).join("\n")
end