Module: Rubeus::Jdbc::FullyQualifiedNamed

Included in:
Column, Index, PrimaryKey, Table
Defined in:
lib/rubeus/jdbc/meta_element.rb

Constant Summary collapse

FQN_ATTRS =
[:table_cat, :table_schem, :table_name]
FQN_ATTR_STRS =
FQN_ATTRS.map{|attr| attr.to_s.upcase}

Instance Method Summary collapse

Instance Method Details

#fully_qualified_nameObject Also known as: fqn



26
27
28
# File 'lib/rubeus/jdbc/meta_element.rb', line 26

def fully_qualified_name
  [table_cat, table_schem, table_name]
end

#same_fqn?(element) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/rubeus/jdbc/meta_element.rb', line 31

def same_fqn?(element)
  if element.is_a?(Hash)
    FQN_ATTR_STRS.all?{|attr|
      jdbc_info[attr] == element[attr]
    }
  elsif element.is_a?(Array)
    fully_qualified_name == element
  elsif element.respond_to?(:fully_qualified_name)
    fully_qualified_name == element.fully_qualified_name
  else
    raise ArgumentError, "Unsupported Object #{element.inspect}. Must be a Hash or a object which have 'fully_qualified_name' method."
  end
end