Class: OCI8::Metadata::Table

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

Overview

Information about tables

An instance of this class is returned by:

  • OCI8#describe_any(name)

  • OCI8#describe_table(name)

  • OCI8::Metadata::Schema#all_objects

  • OCI8::Metadata::Schema#objects

See also:

  • OCI8::Metadata::Base#obj_name

  • OCI8::Metadata::Base#obj_schema

Instance Method Summary collapse

Methods inherited from Base

#inspect, #obj_id, #obj_name, #obj_schema

Instance Method Details

#clustered?Boolean

call-seq:

clustered? -> true or false

Returns true if the table is part of a cluster. Otherwise, false.

Returns:

  • (Boolean)


455
456
457
# File 'lib/oci8/metadata.rb', line 455

def clustered?
  attr_get_ub1(OCI_ATTR_CLUSTERED) != 0
end

#columnsObject

call-seq:

columns -> list of column information

Returns an array of OCI8::Metadata::Column of the table.



483
484
485
# File 'lib/oci8/metadata.rb', line 483

def columns
  @columns ||= list_columns.to_a
end

#dbaObject

call-seq:

dba -> integer

Returns a Data Block Address(DBA) of the segment header.

The dba is converted to the file number and the block number by DBMS_UTILITY.DATA_BLOCK_ADDRESS_FILE and DBMS_UTILITY.DATA_BLOCK_ADDRESS_BLOCK respectively.



437
438
439
# File 'lib/oci8/metadata.rb', line 437

def dba
  attr_get_ub4(OCI_ATTR_RDBA)
end

#durationObject

call-seq:

duration -> :transaction, :session or nil

Retruns :transaction if the table is a transaction-specific temporary table. :session if it is a session-specific temporary table. Otherwise, nil.



423
424
425
# File 'lib/oci8/metadata.rb', line 423

def duration
  __duration
end

#index_only?Boolean

call-seq:

index_only? -> true or false

Returns true if the table is an index-organized table Otherwise, false.

Returns:

  • (Boolean)


475
476
477
# File 'lib/oci8/metadata.rb', line 475

def index_only?
  attr_get_ub1(OCI_ATTR_INDEX_ONLY) != 0
end

#is_temporary?Boolean

call-seq:

is_temporary? -> true or false

Returns true if the table is a temporary table. Otherwise, false.

Returns:

  • (Boolean)


403
404
405
# File 'lib/oci8/metadata.rb', line 403

def is_temporary?
  attr_get_ub1(OCI_ATTR_IS_TEMPORARY) != 0
end

#is_typed?Boolean

call-seq:

is_typed? -> true or false

Returns true if the table is a object table. Otherwise, false.

Returns:

  • (Boolean)


411
412
413
# File 'lib/oci8/metadata.rb', line 411

def is_typed?
  attr_get_ub1(OCI_ATTR_IS_TYPED) != 0
end

#num_colsObject

call-seq:

num_cols -> integer

Returns number of columns



377
378
379
# File 'lib/oci8/metadata.rb', line 377

def num_cols
  attr_get_ub2(OCI_ATTR_NUM_COLS)
end

#partitioned?Boolean

call-seq:

partitioned? -> true or false

Returns true if the table is a partitioned table. Otherwise, false.

Returns:

  • (Boolean)


465
466
467
# File 'lib/oci8/metadata.rb', line 465

def partitioned?
  attr_get_ub1(OCI_ATTR_PARTITIONED) != 0
end

#tablespaceObject

call-seq:

tablespace -> integer

Returns a tablespace number the table resides in.



445
446
447
# File 'lib/oci8/metadata.rb', line 445

def tablespace
  __word(OCI_ATTR_TABLESPACE)
end

#type_metadataObject

call-seq:

type_metadata -> an OCI8::Metadata::Type or nil

Retruns an instance of OCI8::Metadata::Type if the table is an object table. Otherwise, nil.



393
394
395
# File 'lib/oci8/metadata.rb', line 393

def 
  (OCI8::Metadata::Type) if is_typed?
end