Class: OCI8::Metadata::Schema

Inherits:
Base
  • Object
show all
Defined in:
lib/oci8/metadata.rb

Overview

Metadata for a schema.

This is returned by:

  • OCI8#describe_schema(schema_name)

  • OCI8::Metadata::Database#schemas

Instance Method Summary collapse

Methods inherited from Base

#obj_id, #obj_name, #obj_schema

Instance Method Details

#all_objectsObject

array of objects in the schema. This includes unusable objects.



1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
# File 'lib/oci8/metadata.rb', line 1762

def all_objects
  @all_objects ||=
    begin
      begin
        objs = list_objects
      rescue OCIError => exc
        if exc.code != -1
          raise
        end
        # describe again.
        objs = __con.describe_schema(obj_schema).list_objects
      end
      objs.to_a.collect! do |elem|
        case elem
        when OCI8::Metadata::Type
          # to avoid a segmentation fault
          begin
            __con.describe_type(elem.obj_schema + '.' + elem.obj_name)
          rescue OCIError
            # ignore ORA-24372: invalid object for describe
            raise if $!.code != 24372
          end
        else
          elem
        end
      end.compact
    end
end

#inspectObject

:nodoc:



1810
1811
1812
# File 'lib/oci8/metadata.rb', line 1810

def inspect # :nodoc:
  "#<#{self.class.name}:(#{obj_id}) #{obj_schema}>"
end

#objectsObject

array of objects in the schema.



1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
# File 'lib/oci8/metadata.rb', line 1792

def objects
  @objects ||= all_objects.reject do |obj|
    case obj
    when Unknown
      true
    when Synonym
      begin
        obj.objid
        false
      rescue OCIError
        true
      end
    else
      false
    end
  end
end