Skip Headers
Oracle® C++ Call Interface Programmer's Guide,
11g Release 1 (11.1)

B28390-07
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

MetaData Class

A MetaData object can be used to describe the types and properties of the columns in a ResultSet or the existing schema objects in the database. It also provides information about the database as a whole. The enumerated values of MetaData are in Table 13-26, and the summary of its methods is in Table 13-27.

Table 13-26 Enumerated Values Used by MetaData Class

Attribute Options

ParamType

The parameter types for objects are:

  • PTYPE_ARG is the argument of a function or procedure.

  • PTYPE_COL is the column of a table or view.

  • PTYPE_DATABASE is the database.

  • PTYPE_FUNC is the function.

  • PTYPE_PKG is the package.

  • PTYPE_PROC is the procedure.

  • PTYPE_SCHEMA is the schema.

  • PTYPE_SEQ is the sequence.

  • PTYPE_SYN is the synonym.

  • PTYPE_TABLE is the table.

  • PTYPE_TYPE is the type.

  • PTYPE_TYPE_ARG is the argument of a type method.

  • PTYPE_TYPE_ATTR is the attribute of a type.

  • PTYPE_TYPE_COLL is the collection type information.

  • PTYPE_TYPE_METHOD is the method of a type.

  • PTYPE_TYPE_RESULT is the results of a method.

  • PTYPE_UNK is the object of an unknown type.

  • PTYPE_VIEW is the view.

AttrId common to all parameters

Attributes of all parameters:

  • ATTR_OBJ_ID is the object or schema id.

  • ATTR_OBJ_NAME is either the database name, or the object name in a schema.

  • ATTR_OBJ_SCHEMA is the name of the schema describing the object.

  • ATTR_PTYPE is the type of information described by a parameter, ParamType

  • ATTR_TIMESTAMP is the timestamp of an object.

AttrId for Tables and Views

Parameters for a table or view (ParamType of PTYPE_TABLE and PTYPE_VIEW) have the following type-specific attributes:

  • ATTR_OBJID is the object id

  • ATTR_NUM_COLS is the number of columns

  • ATTR_LIST_COLUMNS is the column list

  • ATTR_REF_TDO is the REF to the TDO of the base type in case of extent tables

  • ATTR_IS_TEMPORARY indicates the table is temporary

  • ATTR_IS_TYPED indicates the table is typed

  • ATTR_DURATION is the duration of a temporary table. Values can be DURATION_SESSION, DURATION_TRANS, and DURATION_NULL, as defined for attribute AttrValues

AttrId for Tables only

Parameters for a tables only (ParamType of PTYPE_TABLE):

  • ATTR_RDBA indicates the data block address of the segment header

  • ATTR_TABLESPACE indicates the tablespace the table resides in

  • ATTR_CLUSTERED indicates the table is clustered

  • ATTR_PARTITIONED indicates the table is partitioned

  • ATTR_INDEX_ONLY indicates the table is index-only

AttrId for Functions and Procedures

Parameters for functions and procedures (ParamType of PTYPE_FUNC and PTYPE_PROC, respectively):

  • ATTR_LIST_ARGUMENTS indicates the argument list

  • ATTR_IS_INVOKER_RIGHTS indicates the procedure or function has invoker's rights

  • ATTR_NAME indicates the name of the procedure or function

  • ATTR_OVERLOAD_ID indicates the overloading ID number, relevant when the procedure or function is part of a class and it is overloaded; values returned may be different from direct query of a PL/SQL function or procedure

AttrId for Packages

Parameters for packages (ParamType of PTYPE_PKG):

  • ATTR_LIST_SUBPROGRAMS indicates the subprogram list

  • ATTR_IS_INVOKER_RIGHTS indicates the procedure or function has invoker's rights

AttrId for Types

Parameter is for types (ParamType of PTYPE_TYPE):

  • ATTR_REF_TDO indicates the in-memory REF of the type descriptor for the type, if the column type is an object type. If space has not been reserved, then it is allocated implicitly in the cache. The caller can then pin the object.

  • ATTR_TYPECODE indicates the data type code

  • ATTR_COLLECTION_TYPECODE indicates the typecode of collection, if type is collection

  • ATTR_IS_INCOMPLETE_TYPE indicates that this is an incomplete type

  • ATTR_IS_SYSTEM_TYPE indicates that this is a system generated type

  • ATTR_IS_PREDEFINED_TYPE indicates that this is a predefined type

  • ATTR_IS_TRANSIENT_TYPE indicates that this is a transient type

  • ATTR_IS_SYSTEM_GENERATED_TYPE indicates that this is a system generated type

  • ATTR_HAS_NESTED_TABLE indicates that this type contains a nested table attribute

  • ATTR_HAS_LOB indicates that this type contains a LOB attribute

  • ATTR_HAS_FILE indicates that this type contains a BFILE attribute

  • ATTR_COLLECTION_ELEMENT indicates a reference to a collection element

  • ATTR_NUM_TYPE_ATTRS indicates the number of type attributes

  • ATTR_LIST_TYPE_ATTRS indicates the list of type attributes

  • ATTR_NUM_TYPE_METHODS indicates the number of type methods

  • ATTR_LIST_TYPE_METHODS indicates the list of type methods

  • ATTR_MAP_METHOD indicates the map method of the type

  • ATTR_ORDER_METHOD indicates the order method of the type

  • ATTR_IS_INVOKER_RIGHTS indicates the type has invoker's rights

  • ATTR_NAME indicates the type attribute name

  • ATTR_SCHEMA_NAME indicates the schema where the type is created

  • ATTR_IS_FINAL_TYPE indicates this is a final type

  • ATTR_IS_INSTANTIABLE_TYPE indicates this is an instantiable type

  • ATTR_IS_SUBTYPE indicates this is a subtype

  • ATTR_SUPERTYPE_SCHEMA_NAME indicates the name of the schema that contains the supertype

  • ATTR_SUPERTYPE_NAME indicates the name of the supertype

AttrId for Type Attributes

Parameter is for attributes of types (ParamType of PTYPE_TYPE_ATTR):

  • ATTR_DATA_SIZE indicates the maximum size of the type attribute

  • ATTR_TYPECODE indicates the data type code

  • ATTR_DATA_TYPE indicates the data type of the type attribute

  • ATTR_NAME indicates the name of the procedure or function

  • ATTR_PRECISION indicates the precision of numeric type attributes.

  • ATTR_SCALE indicates the scale of the numeric type attributes

  • ATTR_TYPE_NAME indicates a type name

  • ATTR_SCHEMA_NAME indicates the name of the schema where the type has been created

  • ATTR_REF_TDO indicates the in-memory REF of the type, if the column type is an object type. If the space has not been reserved, it is allocated implicitly in the cache. The caller can then pin the object.

  • ATTR_CHARSET_ID indicates the characterset ID

  • ATTR_CHARSET_FORM indicates the characterset form

  • ATTR_FSPRECISION indicates the fractional seconds precision of a Timestamp, IntervalDS or IntervalYM

  • ATTR_LFPRECISION indicates the leading field precision of an IntervalDS or IntervalYM

AttrId for Type Methods

Parameter is for methods of types (ParamType of PTYPE_TYPE_METHOD):

  • ATTR_NAME indicates the name of the procedure or function

  • ATTR_ENCAPSULATION indicates the method's level of encapsulation

  • ATTR_LIST_ARGUMENTS indicates the argument list

  • ATTR_IS_CONSTRUCTOR indicates the method is a constructor

  • ATTR_IS_DESTRUCTOR indicates the method is a destructor

  • ATTR_IS_OPERATOR indicates the method is an operator

  • ATTR_IS_SELFISH indicates the method is selfish

  • ATTR_IS_MAP indicates the method is a map method

  • ATTR_IS_ORDER indicates the method is an order method

  • ATTR_IS_RNDS indicates that the method is in "read no data" state

  • ATTR_IS_RNPS indicates that the method is in a "read no process" state

  • ATTR_IS_WNDS indicates that the method is in "write no data" state

  • ATTR_IS_WNPS indicates that the method is in "write no process" state

  • ATTR_IS_FINAL_METHOD indicates that this is a final method

  • ATTR_IS_INSTANTIABLE_METHOD indicates that this is an instantiable method

  • ATTR_IS_OVERRIDING_METHOD indicates that this is an overriding method

AttrId for Collections

Parameter is for collections (ParamType of PTYPE_TYPE_COLL):

  • ATTR_DATA_SIZE indicates

  • ATTR_TYPECODE indicates

  • ATTR_DATA_TYPE indicates the data type of the type attribute

  • ATTR_NUM_ELEMS indicates the number of elements in a collection

  • ATTR_NAME indicates the name of the type attribute

  • ATTR_PRECISION indicates the precision of a numeric attribute

  • ATTR_SCALE indicates the scale of a numeric attribute

  • ATTR_TYPE_NAME indicates the type name

  • ATTR_SCHEMA_NAME indicates the schema where the type has been created

  • ATTR_REF_TDO indicates the in-memory REF of the type, if the column type is an object type. If the space has not been reserved, it is allocated implicitly in the cache. The caller can then pin the object.

  • ATTR_CHARSET_ID indicates the characterset id

  • ATTR_CHARSET_FORM indicates the characterset form

AttrId for Synonyms

Parameter is for synonyms (ParamType of PTYPE_SYN):

  • ATTR_OBJID indicates the object id

  • ATTR_SCHEMA_NAME indicates the schema name of the synonym translation

  • ATTR_NAME indicates indicates a NULL-terminated object name of the synonym translation

  • ATTR_LINK indicates a NULL-terminated database link name of the synonym installation

AttrId for Sequences

Parameter is for sequences (ParamType of PTYPE_SEQ):

  • ATTR_OBJID indicates the object id

  • ATTR_MIN indicates the minimum value

  • ATTR_MAX indicates the maximum value

  • ATTR_INCR indicates the increment

  • ATTR_CACHE indicates the number of sequence numbers cached; 0 if the sequence is not cached

  • ATTR_ORDER indicates whether the sequence is ordered

  • ATTR_HW_MARK indicates the "high-water mark"

AttrId for Columns

Parameter is for columns of tables or views (ParamType of PTYPE_COL):

  • ATTR_CHAR_USED indicates the type of length semantics of the column. 0 means byte-length semantics and 1 means character-length semantics.

  • ATTR_CHAR_SIZE indicates the column character length, or number of characters allowed in a column

  • ATTR_DATA_SIZE indicates the maximum size of a column, or number of bytes allowed in a column

  • ATTR_DATA_TYPE indicates the data type of the column

  • ATTR_NAME indicates the column name

  • ATTR_PRECISION indicates the precision of numeric columns

  • ATTR_SCALE indicates the scale of numeric columns

  • ATTR_IS_NULL indicates 0 if NULL values are not permitted for the column

  • ATTR_TYPE_NAME indicates a type name

  • ATTR_SCHEMA_NAME indicates the schema where the type was created

  • ATTR_REF_TDO indicates the REF for the type, if the column is of object type

  • ATTR_CHARSET_ID indicates the characterset ID

  • ATTR_CHARSET_FORM indicates the characterset form

AttrId for Arguments and Results

Parameter for arguments of a procedure or function (PTYPE_ARG), a method (PTYPE_TYPE_ARG), or a result (PTYPE_TYPE_RESULT)

  • ATTR_NAME indicates the argument name

  • ATTR_POSITION indicates the position of the argument in the list

  • ATTR_TYPECODE indicates the typecode

  • ATTR_DATA_TYPE indicates the data type

  • ATTR_DATA_SIZE indicates the size of the data type

  • ATTR_PRECISION indicates the precision of a numeric argument

  • ATTR_SCALE indicates the scale of a numeric argument

  • ATTR_LEVEL indicates the data type level

  • ATTR_HAS_DEFAULT indicates whether an argument has a default

  • ATTR_LIST_ARGUMENTS indicates the list of arguments at the next level, for records or table types

  • ATTR_IOMODE indicates the argument mode: 0 for IN, 1 for OUT, 2 for IN/OUT

  • ATTR_RADIX indicates the radix of a number type

  • ATTR_IS_NULL indicates 0 if NULL values are not permitted

  • ATTR_TYPE_NAME indicates the type name

  • ATTR_SCHEMA_NAME indicates the schema name where the type was created

  • ATTR_SUB_NAME indicates the type name for package local types

  • ATTR_LINK indicates a NULL-terminated database link name where the type is defined, for package local types when the package is remote

  • ATTR_REF_TDO is the REF to the TDO of the type if the argument is an object

  • ATTR_CHARSET_ID indicates the characterset ID

  • ATTR_CHARSET_FORM indicates the characterset form

AttrId for Schemas

Parameter is for schemas (ParamType of PTYPE_SCHEMA):

  • ATTR_LIST_OBJECTS indicates the list of objects in the schema

AttrId for Lists

Parameter is for list of columns, arguments or subprograms:

  • ATTR_LIST_COLUMNS indicates a column list

  • ATTR_LIST_ARGUMENTS indicates a procedure or function argument list

  • ATTR_LIST_SUBPROGRAMS indicates a subprogram list

  • ATTR_LIST_TYPE_ATTRIBS indicates a type attribute list

  • ATTR_TYPE_METHODS indicates a type method list

  • ATTR_TYPE_OBJECTS indicates a list of objects in a schema

  • ATTR_LIST_SCHEMAS indicates a list of schemas in a database

AttrId for Databases

Parameter is for list of columns, arguments or subprograms (ParamType of PTYPE_DATABASE):

  • ATTR_VERSION indicates the database version

  • ATTR_CHARSET_ID indicates the characterset ID of the database

  • ATTR_NCHARSET_ID indicates the national characterset of the database

  • ATTR_LIST_SCHEMAS indicates the list of schemas, PTYPE_SCHEMA

  • ATTR_MAX_PROC_LEN indicates the maximum length of a procedure name

  • ATTR_MAX_COLUMN_LEN indicates the maximum length of a column name

  • ATTR_CURSOR_COMMIT_BEHAVIOR indicates how a commit affects cursors and prepared statements. Values can be CURSOR_OPEN and CURSER_CLOSED, as defined for attribute AttrValues

  • ATTR_MAX_CATALOG_NAMELEN indicates the maximum length of a database (catalog) name

  • ATTR_CATALOG_LOCATION indicates the position of the catalog in a qualified table. Values can be CL_START and CL_END, as defined for attribute AttrValues

  • ATTR_SAVEPOINT_SUPPORT indicates whether the database supports savepoints. Values can be SP_SUPPORTED and SP_UNSUPPORTED, as defined for attribute AttrValues

  • ATTR_NOWAIT_SUPPORT indicates whether the database supports the "no wait" condition. Values can be NW_SUPPORTED and NW_UNSUPPORTED, as defined for attribute AttrValues

  • ATTR_AUTOCOMMIT_DDL indicates if an autocommit mode is required for DDL statements. Values can be AC_DDL and NO_AC_DDL, as defined for attribute AttrValues

  • ATTR_LOCKING_MODE indicates the locking mode for the database. Values can be LOCK_IMMEDIATE and LOCK_DELAYED, as defined for attribute AttrValues


AttrValues

Attribute values are returned on executing a getxxx() method and passing in an attribute, for which these are the results:

  • DURATION_SESSION is the duration of a temporary table: session.

  • DURATION_TRANS is the duration of a temporary table: transaction.

  • DURATION_NULL is the duration of a temporary table: table not temporary.

  • TYPEENCAP_PRIVATE is the encapsulation level of the method: private.

  • TYPEENCAP_PUBLIC is the encapsulation level of the method: public.

  • TYPEPARAM_IN is the argument mode: IN.

  • TYPEPARAM_OUT is the argument mode: OUT.

  • TYPEPARAM_INOUT is the argument mode: IN/OUT.

  • CURSOR_OPEN is the effect of COMMIT operation on cursors and prepared statements in the database: preserve cursor state as before the COMMIT operation.

  • CURSER_CLOSED is the effect of COMMIT operation on cursors and prepared statements in the database: cursors are closed on COMMIT, but the application can still rerun the statement without preparing it again.

  • CL_START is the position of the catalog in a qualified table: start.

  • CL_END is the position of the catalog in a qualified table: end.

  • SP_SUPPORTED is the database supports savepoints.

  • SP_UNSUPPORTED is the database does not support savepoints.

  • NW_SUPPORTED is the database supports nowait clause.

  • NW_UNSUPPORTED is the database does not supports nowait clause.

  • AC_DDL is the autocommit mode required for DDL statements.

  • NO_AC_DDL is the autocommit mode not required for DDL statements.

  • LOCK_IMMEDIATE is the locking mode for the database: immediate.

  • LOCK_DELAYED is the locking mode for the database: delayed.


Table 13-27 Summary of MetaData Methods

Method Description

MetaData()

MetaData class constructor.

getAttributeCount()

Gets the count of the attribute as a MetaData object

getAttributeId()

Gets the ID of the specified attribute

getAttributeType()

Gets the type of the specified attribute.

getBoolean()

Gets the value of the attribute as a C++ boolean.

getInt()

Gets the value of the attribute as a C++ int.

getMetaData()

Gets the value of the attribute as a MetaData object

getNumber()

Returns the specified attribute as a Number object.

getRef()

Gets the value of the attribute as a Ref<T>.

getString()

Gets the value of the attribute as a string.

getTimeStamp()

Gets the value of the attribute as a Timestamp object

getUInt()

Gets the value of the attribute as a C++ unsigned int.

getUString()

Returns the value of the attribute as a UString in the character set associated with the metadata.

getVector()

Gets the value of the attribute as an C++ vector.

operator=()

Assigns one metadata object to another.



MetaData()

MetaData class constructor.

Syntax

MetaData(
   const MetaData &omd);
Parameter Description
cmd
The source that the MetaData object will be copied from.


getAttributeCount()

This method returns the number of attributes related to the metadata object.

Syntax

unsigned int getAttributeCount() const;

getAttributeId()

This method returns the attribute ID (ATTR_NUM_COLS, . . . ) of the attribute represented by the attribute number specified.

Syntax

AttrId getAttributeId(
   unsigned int attributeNum) const;
Parameter Description
attributeNum
The number of the attribute for which the attribute ID is to be returned.


getAttributeType()

This method returns the attribute type (NUMBER, INT, . . . ) of the attribute represented by attribute number specified.

Syntax

Type getAttributeType(
   unsigned int attributeNum) const;
Parameter Description
attributeNum
The number of the attribute for which the attribute type is to be returned.


getBoolean()

This method returns the value of the attribute as a C++ boolean. If the value is a SQL NULL, the result is FALSE.

Syntax

bool getBoolean(
   MetaData::AttrId attributeId) const;
Parameter Description
attributeId
The attribute ID


getInt()

This method returns the value of the attribute as a C++ int. If the value is SQL NULL, the result is 0.

Syntax

int getInt(
   MetaData::AttrId attributeId) const;
Parameter Description
attributeId
The attribute ID


getMetaData()

This method returns a MetaData instance holding the attribute value. A metadata attribute value can be retrieved as a MetaData instance. This method can only be called on attributes of the metadata type.

Syntax

MetaData getMetaData(
   MetaData::AttrId attributeId) const;
Parameter Description
attributeId
The attribute ID


getNumber()

This method returns the value of the attribute as a Number object. If the value is a SQL NULL, the result is NULL.

Syntax

Number getNumber(
   MetaData::AttrId attributeId) const;
Parameter Description
attributeId
The attribute ID


getRef()

This method returns the value of the attribute as a RefAny, or Ref to a TDO. If the value is SQL NULL, the result is NULL.

Syntax

RefAny getRef(
   MetaData::AttrId attributeId) const;
Parameter Description
attributeId
The attribute ID


getString()

This method returns the value of the attribute as a string. If the value is SQL NULL, the result is NULL.

Syntax

string getString(
   MetaData::AttrId attributeId) const;
Parameter Description
attributeId
The attribute ID


getTimeStamp()

This method returns the value of the attribute as a Timestamp object. If the value is a SQL NULL, the result is NULL.

Syntax

Timestamp getTimestamp(
   MetaData::AttrId attributeId) const;
Parameter Description
attributeId
The attribute ID


getUInt()

This method returns the value of the attribute as a C++ unsigned int. If the value is a SQL NULL, the result is 0.

Syntax

unsigned int getUInt(
   MetaData::AttrId attributeId) const;
Parameter Description
attributeId
The attribute ID


getUString()

Returns the value of an attribute as a UString in the character set associated with the metadata.

Syntax

UString getUString(
   MetaData::AttrId attributeId) const;
Parameter Description
attributeId
The attribute ID


getVector()

This method returns a C++ vector containing the attribute value. A collection attribute value can be retrieved as a C++ vector instance. This method can only be called on attributes of a list type.

Syntax

vector<MetaData> getVector(
   MetaData::AttrId attributeId) const;
Parameter Description
attributeId
The attribute ID


operator=()

This method assigns one MetaData object to another. This increments the reference count of the MetaData object that is assigned.

Syntax

void operator=(
   const MetaData &omd);
Parameter Description
cmd
MetaData object to be assigned