class ActiveFacts::RMap::Index
Public Instance Methods
abbreviated_column_names(separator = "")
click to toggle source
An array of the names of the columns this index covers, with some lexical truncations.
# File lib/activefacts/rmap/index.rb, line 62 def abbreviated_column_names(separator = "") columns.map{|column| column.name(separator).sub(/^#{over.name}/,'')} end
column_names(separator = "")
click to toggle source
An array of the names of the columns this index covers
# File lib/activefacts/rmap/index.rb, line 57 def column_names(separator = "") columns.map{|column| column.name(separator)} end
columns()
click to toggle source
Return the array of columns in this index
# File lib/activefacts/rmap/index.rb, line 23 def columns; @columns; end
is_primary()
click to toggle source
Is this index the primary key for this table?
# File lib/activefacts/rmap/index.rb, line 26 def is_primary; @is_primary; end
is_unique()
click to toggle source
Is this index unique?
# File lib/activefacts/rmap/index.rb, line 29 def is_unique; @is_unique; end
name()
click to toggle source
This name is either the name explicitly assigned (if any) or is constructed to form a unique index name.
# File lib/activefacts/rmap/index.rb, line 47 def name uc = @uniqueness_constraint r = real_name return r if r && r !~ /^(Ex|In)ternalUniquenessConstraint[0-9]+$/ (uc.is_preferred_identifier ? "PK_" : "IX_") + view_name + (uc.is_preferred_identifier ? "" : "By"+column_names*"") end
on()
click to toggle source
The table that the index is on
# File lib/activefacts/rmap/index.rb, line 16 def on; @on; end
over()
click to toggle source
If a non-mandatory reference was absorbed, only the non-nil instances are unique. Return the ObjectType that was absorbed, which might differ from this Index’s table.
# File lib/activefacts/rmap/index.rb, line 20 def over; @over; end
real_name()
click to toggle source
The name that was assigned (perhaps implicitly by NORMA)
# File lib/activefacts/rmap/index.rb, line 42 def real_name @uniqueness_constraint.name && @uniqueness_constraint.name != '' ? @uniqueness_constraint.name.gsub(' ','') : nil end
uniqueness_constraint()
click to toggle source
The UniquenessConstraint that created this index
# File lib/activefacts/rmap/index.rb, line 13 def uniqueness_constraint; @uniqueness_constraint; end
view_name()
click to toggle source
The name of a view that can be created to enforce uniqueness over non-null key values
# File lib/activefacts/rmap/index.rb, line 67 def view_name "#{over.name.gsub(' ','')}#{on == over ? "" : "In"+on.name.gsub(' ','')}" end