Class: Mkxms::Mssql::Statistics

Inherits:
Object
  • Object
show all
Extended by:
Utils::FlagsQueries
Includes:
ExtendedProperties
Defined in:
lib/mkxms/mssql/statistics_handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::FlagsQueries

flags_query

Methods included from ExtendedProperties

#extended_properties

Constructor Details

#initialize(attrs) ⇒ Statistics

Returns a new instance of Statistics.



11
12
13
14
15
16
17
18
19
# File 'lib/mkxms/mssql/statistics_handler.rb', line 11

def initialize(attrs)
  @schema = attrs['in-schema']
  @relation = attrs['on']
  @name = attrs['name']
  @columns = []
  @flags = []
  
  @flags << :manual_recompute if attrs['no-recompute']
end

Instance Attribute Details

#columnsObject (readonly)

Returns the value of attribute columns.



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

def columns
  @columns
end

#flagsObject (readonly)

Returns the value of attribute flags.



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

def flags
  @flags
end

#nameObject

Returns the value of attribute name.



21
22
23
# File 'lib/mkxms/mssql/statistics_handler.rb', line 21

def name
  @name
end

#relationObject

Returns the value of attribute relation.



21
22
23
# File 'lib/mkxms/mssql/statistics_handler.rb', line 21

def relation
  @relation
end

#schemaObject

Returns the value of attribute schema.



21
22
23
# File 'lib/mkxms/mssql/statistics_handler.rb', line 21

def schema
  @schema
end

Instance Method Details

#name_params_pairObject



31
32
33
# File 'lib/mkxms/mssql/statistics_handler.rb', line 31

def name_params_pair
  [name, xmigra_params]
end

#qualified_relationObject



35
36
37
# File 'lib/mkxms/mssql/statistics_handler.rb', line 35

def qualified_relation
  "#@schema.#@relation"
end

#xmigra_paramsObject



25
26
27
28
29
# File 'lib/mkxms/mssql/statistics_handler.rb', line 25

def xmigra_params
  [qualified_relation, @columns.join(', ')].tap do |result|
    result << {'with' => 'NORECOMPUTE'} if manual_recompute?
  end
end