Class: OCI8::Metadata::Type

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

Overview

Information about types

An instance of this class is returned by:

  • OCI8#describe_any(name)

  • OCI8#describe_type(name)

  • OCI8::Metadata::Schema#all_objects

  • OCI8::Metadata::Schema#objects

Instance Method Summary collapse

Methods inherited from Base

#obj_id, #obj_name, #obj_schema

Instance Method Details

#collection_elementOCI8::Metadata::Collection or nil

Returns element information of the collection type if the type is a nested table or a varray. Otherwise, nil.

Returns:



747
748
749
# File 'lib/oci8/metadata.rb', line 747

def collection_element
  __param(OCI_ATTR_COLLECTION_ELEMENT) if typecode == :named_collection
end

#collection_typecode:table, :varray or nil

Returns :table if the type is a nested table, :varray if it is a varray. Otherwise, nil.

Returns:

  • (:table, :varray or nil)


681
682
683
# File 'lib/oci8/metadata.rb', line 681

def collection_typecode
  __typecode(OCI_ATTR_COLLECTION_TYPECODE) if typecode == :named_collection
end

#has_file?Boolean

Returns true if the type has a BFILE attribute. Otherwise, false.

Returns:

  • (Boolean)


738
739
740
# File 'lib/oci8/metadata.rb', line 738

def has_file?
  attr_get_ub1(OCI_ATTR_HAS_FILE) != 0
end

#has_lob?Boolean

Returns true if the type has a CLOB, NCLOB or BLOB attribute. Otherwise, false.

Returns:

  • (Boolean)


732
733
734
# File 'lib/oci8/metadata.rb', line 732

def has_lob?
  attr_get_ub1(OCI_ATTR_HAS_LOB) != 0
end

#has_nested_table?Boolean

Returns true if the type is a nested table or has a nested table attribute. Otherwise, false.

Returns:

  • (Boolean)


725
726
727
# File 'lib/oci8/metadata.rb', line 725

def has_nested_table?
  attr_get_ub1(OCI_ATTR_HAS_NESTED_TABLE) != 0
end

#inspectObject

:nodoc:



868
869
870
# File 'lib/oci8/metadata.rb', line 868

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

#is_final_type?Boolean

Returns true if the type is a final type; in other words, subtypes cannot be derived from the type. Otherwise, false.

Returns:

  • (Boolean)


820
821
822
# File 'lib/oci8/metadata.rb', line 820

def is_final_type?
  attr_get_ub1(OCI_ATTR_IS_FINAL_TYPE) != 0
end

#is_incomplete_type?Boolean

Returns true if the type is an incomplete type, which is used for forward declaration. Otherwise, false.

Returns:

  • (Boolean)


689
690
691
# File 'lib/oci8/metadata.rb', line 689

def is_incomplete_type?
  attr_get_ub1(OCI_ATTR_IS_INCOMPLETE_TYPE) != 0
end

#is_instantiable_type?Boolean

Returns true if the type is not declared without INSTANTIABLE. Otherwise, false.

Returns:

  • (Boolean)


827
828
829
# File 'lib/oci8/metadata.rb', line 827

def is_instantiable_type?
  attr_get_ub1(OCI_ATTR_IS_INSTANTIABLE_TYPE) != 0
end

#is_invoker_rights?Boolean

Returns true if the type has invoker’s rights. Otherwise, false.

Returns:

  • (Boolean)


798
799
800
# File 'lib/oci8/metadata.rb', line 798

def is_invoker_rights?
  attr_get_ub1(OCI_ATTR_IS_INVOKER_RIGHTS) != 0
end

#is_predefined_type?Boolean

Always returns false. – I don’t know the definition of predefined type…

Returns:

  • (Boolean)


703
704
705
# File 'lib/oci8/metadata.rb', line 703

def is_predefined_type? # :nodoc:
  attr_get_ub1(OCI_ATTR_IS_PREDEFINED_TYPE) != 0
end

#is_subtype?Boolean

Returns true if the type is a subtype. Otherwise, false.

Returns:

  • (Boolean)


834
835
836
# File 'lib/oci8/metadata.rb', line 834

def is_subtype?
  attr_get_ub1(OCI_ATTR_IS_SUBTYPE) != 0
end

#is_system_generated_type?Boolean

Always returns false. – I don’t know the definition of system generated type. What is different with system type and predefined type.

Returns:

  • (Boolean)


718
719
720
# File 'lib/oci8/metadata.rb', line 718

def is_system_generated_type? # :nodoc:
  attr_get_ub1(OCI_ATTR_IS_SYSTEM_GENERATED_TYPE) != 0
end

#is_system_type?Boolean

Always returns false because there is no way to create a type metadata object for a system type such as NUMBER, CHAR and VARCHAR.

Returns:

  • (Boolean)


696
697
698
# File 'lib/oci8/metadata.rb', line 696

def is_system_type? # :nodoc:
  attr_get_ub1(OCI_ATTR_IS_SYSTEM_TYPE) != 0
end

#is_transient_type?Boolean

Always returns false because there is no way to create a type metadata object for a transient type, which is a type dynamically created by C API.

Returns:

  • (Boolean)


710
711
712
# File 'lib/oci8/metadata.rb', line 710

def is_transient_type? # :nodoc:
  attr_get_ub1(OCI_ATTR_IS_TRANSIENT_TYPE) != 0
end

#map_methodOCI8::Metadata::TypeMethod or nil

Returns information of the map method if it is defined in the type. Otherwise, nil.

Returns:



782
783
784
# File 'lib/oci8/metadata.rb', line 782

def map_method
  __param(OCI_ATTR_MAP_METHOD)
end

#nameString

Returns the type name.

Returns:



805
806
807
# File 'lib/oci8/metadata.rb', line 805

def name
  attr_get_string(OCI_ATTR_NAME)
end

#num_type_attrsInteger

Returns number of type attributes.

Returns:

  • (Integer)


754
755
756
# File 'lib/oci8/metadata.rb', line 754

def num_type_attrs
  attr_get_ub2(OCI_ATTR_NUM_TYPE_ATTRS)
end

#num_type_methodsInteger

Returns number of type methods.

Returns:

  • (Integer)


767
768
769
# File 'lib/oci8/metadata.rb', line 767

def num_type_methods
  attr_get_ub2(OCI_ATTR_NUM_TYPE_METHODS)
end

#order_methodOCI8::Metadata::TypeMethod or nil

Returns information of the order method if it is defined in the type. Otherwise, nil.

Returns:



791
792
793
# File 'lib/oci8/metadata.rb', line 791

def order_method
  __param(OCI_ATTR_ORDER_METHOD)
end

#schema_nameString

Returns the schema name where the type has been created.

Returns:



812
813
814
# File 'lib/oci8/metadata.rb', line 812

def schema_name
  attr_get_string(OCI_ATTR_SCHEMA_NAME)
end

#supertype_nameString or nil

Returns the supertype’s name if the type is a subtype. Otherwise, nil.

Returns:



850
851
852
# File 'lib/oci8/metadata.rb', line 850

def supertype_name
  attr_get_string(OCI_ATTR_SUPERTYPE_NAME) if is_subtype?
end

#supertype_schema_nameString or nil

Returns the supertype’s schema name if the type is a subtype. Otherwise, nil.

Returns:



842
843
844
# File 'lib/oci8/metadata.rb', line 842

def supertype_schema_name
  attr_get_string(OCI_ATTR_SUPERTYPE_SCHEMA_NAME) if is_subtype?
end

#type_attrsarray of OCI8::Metadata::TypeAttr

Returns attribute information of the type.

Returns:



857
858
859
# File 'lib/oci8/metadata.rb', line 857

def type_attrs
  @type_attrs ||= list_type_attrs.to_a
end

#type_metadataObject

to type metadata if possible



665
666
667
# File 'lib/oci8/metadata.rb', line 665

def 
  self
end

#type_methodsarray of OCI8::Metadata::TypeMethod

Returns method information of the type.

Returns:



864
865
866
# File 'lib/oci8/metadata.rb', line 864

def type_methods
  @type_methods ||= list_type_methods.to_a
end

#typecode:named_type or :named_collection

Returns :named_type if the type is an object type, :named_collection if it is a nested table or a varray.

Returns:

  • (:named_type or :named_collection)


673
674
675
# File 'lib/oci8/metadata.rb', line 673

def typecode
  __typecode(OCI_ATTR_TYPECODE)
end