Class: Mkxms::Mssql::Function
- Inherits:
-
Object
- Object
- Mkxms::Mssql::Function
- Defined in:
- lib/mkxms/mssql/function_handler.rb
Constant Summary collapse
- SQL_OBJECT_TYPE =
'FUNCTION'
Instance Attribute Summary collapse
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
-
#name ⇒ Object
Returns the value of attribute name.
-
#param_properties ⇒ Object
readonly
Returns the value of attribute param_properties.
-
#references ⇒ Object
readonly
Returns the value of attribute references.
-
#schema ⇒ Object
Returns the value of attribute schema.
Instance Method Summary collapse
-
#initialize(attrs) ⇒ Function
constructor
A new instance of Function.
- #param_properties_sql ⇒ Object
- #qualified_name ⇒ Object
- #to_sql ⇒ Object
Methods included from ExtendedProperties
Methods included from Property::Hosting
Methods included from Property::SchemaScoped
#property_subject_identifiers, #subitem_extended_properties_sql
Constructor Details
#initialize(attrs) ⇒ Function
Returns a new instance of Function.
14 15 16 17 18 19 20 |
# File 'lib/mkxms/mssql/function_handler.rb', line 14 def initialize(attrs) @schema = attrs['schema'] @name = attrs['name'] @definition = '' @references = [] @param_properties = Hash.new {|h, k| h[k] = ''} end |
Instance Attribute Details
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
23 24 25 |
# File 'lib/mkxms/mssql/function_handler.rb', line 23 def definition @definition end |
#name ⇒ Object
Returns the value of attribute name.
22 23 24 |
# File 'lib/mkxms/mssql/function_handler.rb', line 22 def name @name end |
#param_properties ⇒ Object (readonly)
Returns the value of attribute param_properties.
23 24 25 |
# File 'lib/mkxms/mssql/function_handler.rb', line 23 def param_properties @param_properties end |
#references ⇒ Object (readonly)
Returns the value of attribute references.
23 24 25 |
# File 'lib/mkxms/mssql/function_handler.rb', line 23 def references @references end |
#schema ⇒ Object
Returns the value of attribute schema.
22 23 24 |
# File 'lib/mkxms/mssql/function_handler.rb', line 22 def schema @schema end |
Instance Method Details
#param_properties_sql ⇒ Object
30 31 32 33 34 |
# File 'lib/mkxms/mssql/function_handler.rb', line 30 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 |
#qualified_name ⇒ Object
36 37 38 |
# File 'lib/mkxms/mssql/function_handler.rb', line 36 def qualified_name "#@schema.#@name" end |
#to_sql ⇒ Object
25 26 27 28 |
# File 'lib/mkxms/mssql/function_handler.rb', line 25 def to_sql mvdef = AccessObjectDefinition.replace_object_name(definition, "[{filename}]") ([mvdef] + extended_properties_sql + param_properties_sql).join("\n") end |