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_elementObject

call-seq:

collection_element -> element information of the collection type

Returns an OCI8::Metadata::Collection if the type is a nested table or a varray. Otherwise, nil.



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

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

#collection_typecodeObject

call-seq:

collection_typecode -> :table, :varray or nil

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



729
730
731
# File 'lib/oci8/metadata.rb', line 729

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

#has_file?Boolean

call-seq:

has_file? -> boolean

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

Returns:

  • (Boolean)


810
811
812
# File 'lib/oci8/metadata.rb', line 810

def has_file?
  attr_get_ub1(OCI_ATTR_HAS_FILE) != 0
end

#has_lob?Boolean

call-seq:

has_lob? -> boolean

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

Returns:

  • (Boolean)


801
802
803
# File 'lib/oci8/metadata.rb', line 801

def has_lob?
  attr_get_ub1(OCI_ATTR_HAS_LOB) != 0
end

#has_nested_table?Boolean

call-seq:

has_nested_table? -> boolean

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

Returns:

  • (Boolean)


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

def has_nested_table?
  attr_get_ub1(OCI_ATTR_HAS_NESTED_TABLE) != 0
end

#inspectObject

:nodoc:



963
964
965
# File 'lib/oci8/metadata.rb', line 963

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

#is_final_type?Boolean

call-seq:

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)


905
906
907
# File 'lib/oci8/metadata.rb', line 905

def is_final_type?
  attr_get_ub1(OCI_ATTR_IS_FINAL_TYPE) != 0
end

#is_incomplete_type?Boolean

call-seq:

is_incomplete_type? -> boolean

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

Returns:

  • (Boolean)


740
741
742
# File 'lib/oci8/metadata.rb', line 740

def is_incomplete_type?
  attr_get_ub1(OCI_ATTR_IS_INCOMPLETE_TYPE) != 0
end

#is_instantiable_type?Boolean

call-seq:

is_instantiable_type? -> boolean

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

Returns:

  • (Boolean)


915
916
917
# File 'lib/oci8/metadata.rb', line 915

def is_instantiable_type?
  attr_get_ub1(OCI_ATTR_IS_INSTANTIABLE_TYPE) != 0
end

#is_invoker_rights?Boolean

call-seq:

is_invoker_rights? -> boolean

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

Returns:

  • (Boolean)


878
879
880
# File 'lib/oci8/metadata.rb', line 878

def is_invoker_rights?
  attr_get_ub1(OCI_ATTR_IS_INVOKER_RIGHTS) != 0
end

#is_predefined_type?Boolean

call-seq:

is_predefined_type? -> boolean

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

Returns:

  • (Boolean)


760
761
762
# File 'lib/oci8/metadata.rb', line 760

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

#is_subtype?Boolean

call-seq:

is_subtype? -> boolean

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

Returns:

  • (Boolean)


925
926
927
# File 'lib/oci8/metadata.rb', line 925

def is_subtype?
  attr_get_ub1(OCI_ATTR_IS_SUBTYPE) != 0
end

#is_system_generated_type?Boolean

call-seq:

is_predefined_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)


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

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

#is_system_type?Boolean

call-seq:

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)


750
751
752
# File 'lib/oci8/metadata.rb', line 750

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

#is_transient_type?Boolean

call-seq:

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)


770
771
772
# File 'lib/oci8/metadata.rb', line 770

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

#map_methodObject

call-seq:

map_method -> map method information

Returns an instance of OCI8::Metadata::TypeMethod of a map method if it is defined in the type. Otherwise, nil.



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

def map_method
  __param(OCI_ATTR_MAP_METHOD)
end

#nameObject

call-seq:

name -> string

Returns the type name.



886
887
888
# File 'lib/oci8/metadata.rb', line 886

def name
  attr_get_string(OCI_ATTR_NAME)
end

#num_type_attrsObject

call-seq:

num_type_attrs -> integer

Returns number of type attributes.



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

def num_type_attrs
  attr_get_ub2(OCI_ATTR_NUM_TYPE_ATTRS)
end

#num_type_methodsObject

call-seq:

num_type_methods -> integer

Returns number of type methods.



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

def num_type_methods
  attr_get_ub2(OCI_ATTR_NUM_TYPE_METHODS)
end

#order_methodObject

call-seq:

order_method -> order method information

Returns an instance of OCI8::Metadata::TypeMethod of a order method if it is defined in the type. Otherwise, nil.



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

def order_method
  __param(OCI_ATTR_ORDER_METHOD)
end

#schema_nameObject

call-seq:

schema_name -> string

Returns the schema name where the type has been created.



894
895
896
# File 'lib/oci8/metadata.rb', line 894

def schema_name
  attr_get_string(OCI_ATTR_SCHEMA_NAME)
end

#supertype_nameObject

call-seq:

supertype_name -> string or nil

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



943
944
945
# File 'lib/oci8/metadata.rb', line 943

def supertype_name
  attr_get_string(OCI_ATTR_SUPERTYPE_NAME) if is_subtype?
end

#supertype_schema_nameObject

call-seq:

supertype_schema_name -> string or nil

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



934
935
936
# File 'lib/oci8/metadata.rb', line 934

def supertype_schema_name
  attr_get_string(OCI_ATTR_SUPERTYPE_SCHEMA_NAME) if is_subtype?
end

#type_attrsObject

call-seq:

type_attrs -> list of attribute information

Returns an array of OCI8::Metadata::TypeAttr which the type has.



951
952
953
# File 'lib/oci8/metadata.rb', line 951

def type_attrs
  @type_attrs ||= list_type_attrs.to_a
end

#type_metadataObject

to type metadata if possible



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

def 
  self
end

#type_methodsObject

call-seq:

type_methods -> list of method information

Returns an array of OCI8::Metadata::TypeMethod which the type has.



959
960
961
# File 'lib/oci8/metadata.rb', line 959

def type_methods
  @type_methods ||= list_type_methods.to_a
end

#typecodeObject

call-seq:

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.



720
721
722
# File 'lib/oci8/metadata.rb', line 720

def typecode
  __typecode(OCI_ATTR_TYPECODE)
end