Oracle C++ Call Interface Programmer's Guide
Release 9.0.1

Part Number A89860-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to next page

6
Metadata

This chapter describes how to retrieve metadata about result sets or the database as a whole.

It includes the following topics:

Overview of Metadata

Database objects have various attributes that describe them, and you obtain information about a particular schema object by performing a DESCRIBE operation for the object. The result can be accessed as an object of the Metadata class in that you can use class methods to get the actual values of an object. You accomplish this by passing object attributes as arguments to the various methods of the Metadata class.

You can perform an explicit DESCRIBE operation on the database as a whole, on the types and properties of the columns contained in a ResultSet class or on any of the following schema and subschema objects:

You must specify the type of the attribute you are looking for. By using the getAttributeCount, getAttributeId, and getAttributeType methods of the MetaData class, you can scan through each available attribute.

All DESCRIBE information is cached until the last reference to it is deleted. Users are in this way prevented from accidentally trying to access DESCRIBE information that is already freed.

You obtain metadata by calling the getMetaData method on the Connection class in case of an explicit describe, or by calling the getColumnListMetaData method on the ResultSet class to get the metadata of the result set columns. Both methods return a MetaData object with the described information. The MetaData class provides the getxxx methods to access this information.

Notes on Types and Attributes

When performing DESCRIBE operations, be aware of the following issues:

Describing Database Metadata

Describing database metadata is equivalent to an explicit DESCRIBE operation. The object to describe must be an object in the schema. In describing a type, you call the getMetaData method from the connection, passing the name of the object or a RefAny object. To do this, you must initialize the environment in the OBJECT mode. The getMetaData method returns an object of type MetaData. Each type of MetaData object has a list of attributes that are part of the describe tree. The describe tree can then be traversed recursively to point to subtrees containing more information. More information about an object can be obtained by calling the getxxx methods.

If you need to construct a browser that describes the database and its objects recursively, then you can access information regarding the number of attributes for each object in the database (including the database), the attribute ID listing, and the attribute types listing. By using this information, you can recursively traverse the describe tree from the top node (the database) to the columns in the tables, the attributes of a type, the parameters of a procedure or function, and so on.

For example, consider the typical case of describing a table and its contents. You call the getMetaData method from the connection, passing the name of the table to be described. The MetaData object returned contains the table information. Since you are aware of the type of the object that you want to describe (table, column, type, collection, function, procedure, and so on), you can obtain the attribute list as shown in Table 6-1. You can retrieve the value into a variable of the type specified in the table by calling the corresponding getxxx method.

Table 6-1 Attribute Groupings  
Attribute Type  Description 

Parameter Attributes 

Attributes belonging to all elements 

Table and View Attributes 

Attributes belonging to tables and views 

Procedure, Function, and Subprogram Attributes 

Attributes belonging to procedures, functions, and package subprograms 

Package Attributes 

Attributes belonging to packages 

Type Attributes 

Attributes belonging to types 

Type Attribute Attributes 

Attributes belonging to type attributes 

Type Method Attributes 

Attributes belonging to type methods 

Collection Attributes 

Attributes belonging to collection types 

Synonym Attributes 

Attributes belonging to synonyms 

Sequence Attributes 

Attributes belonging to sequences 

Column Attributes 

Attributes belonging to columns of tables or views 

Argument and Result Attributes 

Attributes belonging to arguments / results 

List Attributes 

Attributes that designate the list type 

Schema Attributes 

Attributes specific to schemas 

Database Attributes 

Attributes specific to databases 

Metatdata Code Examples

This section provides code examples for obtaining:

Connection Metadata Code Examples

The following code example demonstrates how to obtain metadata about attributes of a simple database table:

/* Create an environment and a connection to the HR database */
.
.
.
/* Call the getMetaData method on the Connection object obtained above */
MetaData emptab_metaData = connection->getMetaData("EMPLOYEES",
                                                    MetaData::PTYPE_TABLE);
/* Now that you have the metadata information on the EMPLOYEES table,
   call the getxxx methods using the appropriate attributes
*/
/* Call getString */
cout<<"Schema:"<<(emptab_metaData.getString(MetaData::ATTR_OBJ_SCHEMA))<<endl;

if(emptab_metaData.getInt(emptab_metaData::ATTR_PTYPE)==MetaData::PTYPE_TABLE)

cout<<"EMPLOYEES is a table"<<endl;
else
cout<<"EMPLOYEES is not a table"<<endl;
/* Call getInt to get the number of columns in the table */ int columnCount=emptab_metaData.getInt(MetaData::ATTR_NUM_COLS); cout<<"Number of Columns:"<<columnCount<<endl /* Call getTimestamp to get the timestamp of the table object */ Timestamp tstamp = emptab_metaData.getTimestamp(MetaData::ATTR_TIMESTAMP); /* Now that you have the value of the attribute as a Timestamp object, you can call methods to obtain the components of the timestamp */ int year; unsigned int month, day; tstamp.getData(year, month, day); /* Call getVector for attributes of list type, for example ATTR_LIST_COLUMNS */ vector<MetaData>listOfColumns; listOfColumns=emptab_metaData.getVector(MetaData::ATTR_LIST_COLUMNS); /* Each of the list elements represents a column metadata, so now you can access the column attributes */ for (int i=0;i<listOfColumns.size();i++ {
MetaData columnObj=listOfColumns[i];
cout<<"Column Name:"<<(columnObj.getString(MetaData::ATTR_NAME))<<endl;
cout<<"Data Type:"<<(columnObj.getInt(MetaData::ATTR_DATA_TYPE))<<endl;
.
.
.
/* and so on to obtain metadata on other column specific attributes */
}

The following code example demonstrates how to obtain metadata about a database table with a column containing a user-defined type:

/* Create an environment and a connection to the HR database */
.
.
.
/* Call the getMetaData method on the Connection object obtained above */
MetaData custtab_metaData = connection->getMetaData("CUSTOMERS",

MetaData::PTYPE_TABLE);
/* Now that you have the metadata information on the CUSTOMERS table, call the getxxx methods using the appropriate attributes */ /* Call getString */ cout<<"Schema:"<<(custtab_metaData.getString(MetaData::ATTR_OBJ_SCHEMA))<<endl; if(custtab_metaData.getInt(custtab_metaData::ATTR_PTYPE)==MetaData::PTYPE_TABLE)
cout<<"CUSTOMERS is a table"<<endl;
else
cout<<"CUSTOMERS is not a table"<<endl;
/* Call getVector to obtain a list of columns in the CUSTOMERS table */ vector<MetaData>listOfColumns; listOfColumns=custtab_metaData.getVector(MetaData::ATTR_LIST_COLUMNS); /* Assuming that the metadata for the column cust_address_typ is the fourth element in the list... */ MetaData customer_address=listOfColumns[3] /* Now you can obtain the metadata for the customer_address attribute */ int typcode = customer_address.getInt(MetaData::ATTR_TYPECODE): if(typcode==OCCI_TYPECODE_OBJECT)
cout<<"customer_address is an object type"<<endl;
else
cout<<"customer_address is not an object type"<<endl;

string objectName=customer_address.getString(MetaData::ATTR_OBJ_NAME); /* Now that you have the name of the address object, the metadata of the attributes of the type can be obtained by using getMetaData on the connection by passing the object name */ MetaData address = connection->getMetaData(objectName); /* Call getVector to obtain the list of the address object attributes */ vector<MetaData> attributeList = address.getVector(MetaData::ATT_LIST_TYPE_ATTRS); /* and so on to obtain metadata on other address object specific attributes */

The following code example demonstrates how to obtain metadata about an object when using a reference to it:

Assuming the following schema structure:

Type ADDRESS(street VARCHAR2(50), city VARCHAR2(20));
Table Person(id NUMBER, addr REF ADDRESS);

/* Create an environment and a connection to the HR database */
.
.
.
/* Call the getMetaData method on the Connection object obtained above */
MetaData perstab_metaData = connection->getMetaData("Person",

MetaData::PTYPE_TABLE);
/* Now that you have the metadata information on the Person table, call the getxxx methods using the appropriate attributes */ /* Call getString */ cout<<"Schema:"<<(perstab_metaData.getString(MetaData::ATTR_OBJ_SCHEMA))<<endl; if(perstab_metaData.getInt(perstab_metaData::ATTR_PTYPE)==MetaData::PTYPE_TABLE)
cout<<"Person is a table"<<endl;
else
cout<<"Person is not a table"<<endl;
/* Call getVector to obtain the list of columns in the Person table */ vector<MetaData>listOfColumns; listOfColumns=perstab_metaData.getVector(MetaData::ATTR_LIST_COLUMNS); /* Each of the list elements represents a column metadata, so now get the datatype of the column by passing ATTR_DATA_TYPE to getInt */ for(int i=0;i<numCols;i++) { int dataType=colList[i].getInt(MetaData::ATTR_DATA_TYPE); /* If the datatype is a reference, get the Ref and obtain the metadata about the object by passing the Ref to getMetaData */ if(dataType==SQLT_REF)
RefAny refTdo=colList[i].getRef(MetaData::ATTR_REF_TDO);
/* Now you can obtain the metadata about the object as shown below MetaData tdo_metaData=connection->getMetaData(refTdo); /* Now that you have the metadata about the TDO, you can obtain the metadata about the object */

Resultset Metadata Code Example

The following code example demonstrates how to obtain metadata about a select list from a ResultSet object:

/* Create an environment and a connection to the database */
.
.
.
/* Create a statement and associate it with a select clause */
string sqlStmt="SELECT * FROM EMPLOYEES";
Statement *stmt=conn->createStatement(sqlStmt);

/* Execute the statement to obtain a ResultSet */
ResultSet *rset=stmt->executeQuery();

/* Obtain the metadata about the select list */
vector<MetaData>cmd=rset->getColumnListMetaData();

/* The metadata is a column list and each element is a column metaData */
int dataType=cmd[i].getInt(MetaData::ATTR_DATA_TYPE);
.
.
.

The getMetaData method is called for the ATTR_COLLECTION_ELEMENT attribute only.

Attribute Reference

This section describes the attributes belonging to schema and subschema objects. The following attribute groupings are presented:

Parameter Attributes

All elements have some attributes specific to that element and some generic attributes. Table 6-2 describes the attributes that belong to all elements:

Table 6-2 Attributes Belonging to All Elements  
Attribute  Description    Attribute Datatype 

ATTR_OBJ_ID 

Object or schema ID 

 

unsigned int 

ATTR_OBJ_NAME 

Object, schema, or database name 

 

string 

ATTR_OBJ_SCHEMA 

Schema where object is located 

 

string 

ATTR_OBJ_PTYPE 

Type of information described by the parameter. Possible Values 

Description 

int 

 

PTYPE_TABLE 

Table 

 

 

PTYPE_VIEW 

View 

 

 

PTYPE_PROC 

Procedure 

 

 

PTYPE_FUNC 

Function 

 

 

PTYPE_PKG 

Package 

 

 

PTYPE_TYPE 

Type 

 

 

PTYPE_TYPE_ATTR 

Attribute of a type 

 

 

PTYPE_TYPE_COLL 

Collection type information 

 

 

PTYPE_TYPE_METHOD 

A method of a type 

 

 

PTYPE_SYN 

Synonym 

 

 

PTYPE_SEQ 

Sequence 

 

 

PTYPE_COL 

Column of a table or view 

 

 

PTYPE_ARG 

Argument of a function or procedure 

 

 

PTYPE_TYPE_ARG 

Argument of a type method 

 

 

PTYPE_TYPE_RESULT 

Results of a method 

 

 

PTYPE_SCHEMA 

Schema 

 

 

PTYPE_DATABASE 

Database 

 

ATTR_TIMESTAMP 

The TIMESTAMP of the object this description is based on (Oracle DATE format) 

Timestamp 

The sections that follow list attributes specific to different types of elements.

Table and View Attributes

A parameter for a table or view (type PTYPE_TABLE or PTYPE_VIEW) has the following type-specific attributes described in Table 6-3:

Table 6-3 Attributes Belonging to Tables or Views  
Attribute  Description  Attribute Datatype 

ATTR_OBJID 

Object ID 

unsigned int 

ATTR_NUM_COLS 

Number of columns 

int 

ATTR_LIST_COLUMNS 

Column list (type PTYPE_LIST

vector<MetaData> 

ATTR_REF_TDO 

REF to the TDO of the base type in case of extent tables 

RefAny 

ATTR_IS_TEMPORARY 

Identifies whether the table or view is temporary 

bool 

ATTR_IS_TYPED 

Identifies whether the table or view is typed 

bool 

ATTR_DURATION 

Duration of a temporary table. Values can be:

    OCCI_DURATION_SESSION (session)

    OCCI_DURATION_TRANS (transaction)

    OCCI_DURATION_NULL (table not temporary)

 

int 

The additional attributes belonging to tables are described in Table 6-4.

Table 6-4 Attributes Specific to Tables  
Attribute  Description  Attribute Datatype 

ATTR_DBA 

Data block address of the segment header 

unsigned int 

ATTR_TABLESPACE 

Tablespace the table resides on 

int 

ATTR_CLUSTERED 

Identifies whether the table is clustered 

bool 

ATTR_PARTITIONED 

Identifies whether the table is partitioned 

bool 

ATTR_INDEX_ONLY 

Identifies whether the table is index only 

bool 

Procedure, Function, and Subprogram Attributes

A parameter for a procedure or function (type PTYPE_PROC or PTYPE_FUNC) has the type-specific attributes described in Table 6-5.

Table 6-5 Attributes Belonging to Procedures or Functions  
Attribute  Description  Attribute Datatype 

ATTR_LIST_ARGUMENTS 

Argument list

Refer to List Attributes

vector<MetaData> 

ATTR_IS_INVOKER_RIGHTS 

Identifies whether the procedure or function has invoker-rights. 

int 

The additional attributes belonging to package subprograms are described in Table 6-6.

Table 6-6 Attributes Belonging to Package Subprograms  
Attribute  Description  Attribute Datatype 

ATTR_NAME 

Name of procedure or function 

string 

ATTR_OVERLOAD_ID 

Overloading ID number (relevant in case the procedure or function is part of a package and is overloaded). Values returned may be different from direct query of a PL/SQL function or procedure. 

int 

Package Attributes

A parameter for a package (type PTYPE_PKG) has the type-specific attributes described in Table 6-7.

Table 6-7 Attributes Belonging to Packages  
Attribute  Description  Attribute Datatype 

ATTR_LIST_SUBPROGRAMS 

Subprogram list

Refer to List Attributes

vector<MetaData> 

ATTR_IS_INVOKER_RIGHTS 

Identifies whether the package has invoker-rights 

bool 

Type Attributes

A parameter for a type (type PTYPE_TYPE) has attributes described in Table 6-8.

Table 6-8 Attributes Belonging to Types  
Attribute  Description  Attribute Datatype 

ATTR_REF_TDO 

Returns the in-memory ref of the type descriptor object for the type, if the column type is an object type.

ADD MORE 

RefAny 

ATTR_TYPECODE 

Typecode. Can be OCCI_TYPECODE_OBJECT or OCCI_TYPECODE_NAMEDCOLLECTION.

Refer to Notes on Types and Attributes

int 

ATTR_COLLECTION_TYPECODE 

Typecode of collection if type is collection; invalid otherwise. Can be OCCI_TYPECODE_VARRAY or OCCI_TYPECODE_TABLE.

Refer to Notes on Types and Attributes

int 

ATTR_VERSION 

A null terminated string containing the user-assigned version 

string 

ATTR_IS_FINAL_TYPE 

Identifies whether this is a final type 

bool 

ATTR_IS_INSTANTIABLE_TYPE 

Identifies whether this is an instantiable type 

bool 

ATTR_IS_SUBTYPE 

Identifies whether this is a subtype 

bool 

ATTR_SUPERTYPE_SCHEMA_NAME 

Name of the schema containing the supertype 

string 

ATTR_SUPERTYPE_NAME 

Name of the supertype 

string 

ATTR_IS_INVOKER_RIGHTS 

Identifies whether this type is invoker-rights 

bool 

ATTR_IS_INCOMPLETE_TYPE 

Identifies whether this type is incomplete 

bool 

ATTR_IS_SYSTEM_TYPE 

Identifies whether this is a system type 

bool 

ATTR_IS_PREDEFINED_TYPE 

Identifies whether this is a predefined type 

bool 

ATTR_IS_TRANSIENT_TYPE 

Identifies whether this is a transient type 

bool 

ATTR_IS_SYSTEM_GENERATED_TYPE 

Identifies whether this is a system-generated type 

bool 

ATTR_HAS_NESTED_TABLE 

Identifies whether this type contains a nested table attribute 

bool 

ATTR_HAS_LOB 

Identifies whether this type contains a LOB attribute 

bool 

ATTR_HAS_FILE 

Identifies whether this type contains a FILE attribute 

bool 

ATTR_COLLECTION_ELEMENT 

Handle to collection element

Refer to Collection Attributes 

MetaData 

ATTR_NUM_TYPE_ATTRS 

Number of type attributes 

unsigned int 

ATTR_LIST_TYPE_ATTRS 

List of type attributes

Refer to List Attributes 

vector<MetaData> 

ATTR_NUM_TYPE_METHODS 

Number of type methods 

unsigned int 

ATTR_LIST_TYPE_METHODS 

List of type methods

Refer to List Attributes 

vector<MetaData> 

ATTR_MAP_METHOD 

Map method of type

Refer to Type Method Attributes 

MetaData 

ATTR_ORDER_METHOD 

Order method of type

Refer to Type Method Attributes 

MetaData 

Type Attribute Attributes

A parameter for an attribute of a type (type PTYPE_TYPE_ATTR) has the attributes described in Table 6-9.

Table 6-9 Attributes Belonging to Type Attributes  
Attribute  Description  Attribute Datatype 

ATTR_DATA_SIZE 

Maximum size of the type attribute. This length is returned in bytes and not characters for strings and raws. Returns 22 for NUMBER

int 

ATTR_TYPECODE 

Typecode

Refer to Notes on Types and Attributes

int 

ATTR_DATA_TYPE 

Datatype of the type attribute

Refer to Notes on Types and Attributes

int 

ATTR_NAME 

A pointer to a string that is the type attribute name 

string 

ATTR_PRECISION 

Precision of numeric type attributes. If the precision is nonzero and scale is -127, then it is a FLOAT; otherwise a NUMBER(p, s). If precision is 0, then NUMBER(p, s) can be represented simply by NUMBER

int 

ATTR_SCALE 

Scale of numeric type attributes. If the precision is nonzero and scale is -127, then it is a FLOAT; otherwise a NUMBER(p, s). If precision is 0, then NUMBER(p, s) can be represented simply as NUMBER

int 

ATTR_TYPE_NAME 

A string that is the type name. The returned value will contain the type name if the datatype is SQLT_NTY or SQLT_REF. If the datatype is SQLT_NTY, then the name of the named datatype's type is returned. If the datatype is SQLT_REF, then the type name of the named datatype pointed to by the REF is returned. 

string 

ATTR_SCHEMA_NAME 

String with the schema name under which the type has been created 

string 

ATTR_REF_TDO 

Returns the in-memory REF of the TDO for the type, if the column type is an object type. 

RefAny 

ATTR_CHARSET_ID 

Character set ID, if the type attribute is of a string or character type 

int 

ATTR_CHARSET_FORM 

Character set form, if the type attribute is of a string or character type 

int 

ATTR_FSPRECISION 

The fractional seconds precision of a datetime or interval 

int 

ATTR_LFPRECISION 

The leading field precision of an interval 

int 

Type Method Attributes

A parameter for a method of a type (type PTYPE_TYPE_METHOD) has the attributes described in Table 6-10.

Table 6-10 Attributes Belonging to Type Methods  
Attribute  Description  Attribute Datatype 

ATTR_NAME 

Name of method (procedure or function) 

string 

ATTR_ENCAPSULATION 

Encapsulation level of the method (either OCCI_TYPEENCAP_PRIVATE or OCCI_TYPEENCAP_PUBLIC

int 

ATTR_LIST_ARGUMENTS 

Argument list 

vector<MetaData> 

ATTR_IS_CONSTRUCTOR 

Identifies whether the method is a constructor 

bool 

ATTR_IS_DESTRUCTOR 

Identifies whether the method is a destructor 

bool 

ATTR_IS_OPERATOR 

Identifies whether the method is an operator 

bool 

ATTR_IS_SELFISH 

Identifies whether the method is selfish 

bool 

ATTR_IS_MAP 

Identifies whether the method is a map method 

bool 

ATTR_IS_ORDER 

Identifies whether the method is an order method 

bool 

ATTR_IS_RNDS 

Identifies whether "Read No Data State" is set for the method 

bool 

ATTR_IS_RNPS 

Identifies whether "Read No Process State" is set for the method 

bool 

ATTR_IS_WNDS 

Identifies whether "Write No Data State" is set for the method 

bool 

ATTR_IS_WNPS 

Identifies whether "Write No Process State" is set for the method 

bool 

ATTR_IS_FINAL_METHOD 

Identifies whether this is a final method 

bool 

ATTR_IS_INSTANTIABLE_METHOD 

Identifies whether this is an instantiable method 

bool 

ATTR_IS_OVERRIDING_METHOD 

Identifies whether this is an overriding method 

bool 

Collection Attributes

A parameter for a collection type (type PTYPE_COLL) has the attributes described in Table 6-11.

Table 6-11 Attributes Belonging to Collection Types  
Attribute  Description  Attribute Datatype 

ATTR_DATA_SIZE 

Maximum size of the type attribute. This length is returned in bytes and not characters for strings and raws. Returns 22 for NUMBER

int 

ATTR_TYPECODE 

Typecode

Refer to Notes on Types and Attributes.  

int 

ATTR_DATA_TYPE 

The datatype of the type attribute

Refer to Notes on Types and Attributes

int 

ATTR_NUM_ELEMENTS 

Number of elements in an array. Only valid for collections that are arrays. 

unsigned int 

ATTR_NAME 

A pointer to a string that is the type attribute name 

string 

ATTR_PRECISION 

Precision of numeric type attributes. If the precision is nonzero and scale is -127, then it is a FLOAT; otherwise a NUMBER(p, s). If precision is 0, then NUMBER(p, s) can be represented simply as NUMBER

int 

ATTR_SCALE 

Scale of numeric type attributes. If the precision is nonzero and scale is -127, then it is a FLOAT; otherwise a NUMBER(p, s). If precision is 0, then NUMBER(p, s) can be represented simply as NUMBER

int 

ATTR_TYPE_NAME 

String that is the type name. The returned value will contain the type name if the datatype is SQLT_NTY or SQLT_REF. If the datatype is SQLT_NTY, then the name of the named datatype's type is returned. If the datatype is SQLT_REF, then the type name of the named datatype pointed to by the REF is returned 

string 

ATTR_SCHEMA_NAME 

String with the schema name under which the type has been created 

string 

ATTR_REF_TDO 

Maximum size of the type attribute. This length is returned in bytes and not characters for strings and raws. Returns 22 for NUMBER

RefAny 

ATTR_CHARSET_ID 

Typecode

Refer to Notes on Types and Attributes.  

int 

ATTR_CHARSET_FORM 

The datatype of the type attribute

Refer to Notes on Types and Attributes

int 

Synonym Attributes

A parameter for a synonym (type PTYPE_SYN) has the attributes described in Table 6-12.

Table 6-12 Attributes Belonging to Synonyms  
Attribute  Description  Attribute Datatype 

ATTR_OBJID 

Object ID 

unsigned int 

ATTR_SCHEMA_NAME 

Null-terminated string containing the schema name of the synonym translation 

string 

ATTR_NAME 

Null-terminated string containing the object name of the synonym translation 

string 

ATTR_LINK 

Null-terminated string containing the database link name of the synonym translation 

string 

Sequence Attributes

A parameter for a sequence (type PTYPE_SEQ) has the attributes described in Table 6-13.

Table 6-13 Attributes Belonging to Sequences  
Attribute  Description  Attribute Datatype 

ATTR_OBJID 

Object ID 

unsigned int 

ATTR_MIN 

Minimum value (in Oracle number format) 

Number 

ATTR_MAX 

Maximum value (in Oracle number format) 

Number 

ATTR_INCR 

Increment (in Oracle number format) 

Number 

ATTR_CACHE 

Number of sequence numbers cached; zero if the sequence is not a cached sequence (in Oracle number format) 

Number 

ATTR_ORDER 

Identifies whether the sequence is ordered? 

bool 

ATTR_HW_MARK 

High-water mark (in Oracle number format) 

Number 

Column Attributes

A parameter for a column of a table or view (type PTYPE_COL) has the attributes described in Table 6-14.

Table 6-14 Attributes Belonging to Columns of Tables or Views  
Attribute  Description  Attribute Datatype 

ATTR_DATA_SIZE 

Column length in codepoints. The number of codepoints allowed in the column. 

int 

ATTR_DATA_TYPE 

Type of length semantics of the column. Valid values are 0 for byte-length semantics and 1 for codepoint-length semantics. 

int 

ATTR_NAME 

Maximum size of the column. This length is returned in bytes and not characters for strings and raws. Returns 22 for NUMBER

string 

ATTR_PRECISION 

The datatype of the column

Refer to Notes on Types and Attributes

int 

ATTR_SCALE 

Pointer to a string that is the column name 

int 

ATTR_IS_NULL 

The precision of numeric columns. If the precision is nonzero and scale is -127, then it is a FLOAT; otherwise a NUMBER(p, s). If precision is 0, NUMBER(p, s) can be represented simply as NUMBER

bool 

ATTR_TYPE_NAME 

Scale of numeric columns. If the precision is nonzero and scale is -127, then it is a FLOAT; otherwise a NUMBER(p, s). If precision is 0, then NUMBER(p, s) can be represented simply as NUMBER. 

string 

ATTR_SCHEMA_NAME 

Returns 0 if null values are not permitted for the column 

string 

ATTR_REF_TDO 

Returns a string that is the type name. The returned value will contain the type name if the datatype is SQLT_NTY or SQLT_REF. If the datatype is SQLT_NTY, then the name of the named datatype's type is returned. If the datatype is SQLT_REF, then the type name of the named datatype pointed to by the REF is returned 

RefAny 

ATTR_CHARSET_ID 

Returns a string with the schema name under which the type has been created 

int 

ATTR_CHARSET_FORM 

The REF of the TDO for the type, if the column type is an object type 

int 

Argument and Result Attributes

A parameter for an argument or a procedure or function type (type PTYPE_ARG), for a type method argument (type PTYPE_TYPE_ARG), or for method results (type PTYPE_TYPE_RESULT) has the attributes described in Table 6-15.

Table 6-15 Attributes Belonging to Arguments / Results  
Attribute  Description  Attribute Datatype 

ATTR_NAME 

Returns a pointer to a string which is the argument name 

string 

ATTR_POSITION 

Position of the argument in the argument list. Always returns 0. 

int 

ATTR_TYPECODE 

Typecode

Refer to Notes on Types and Attributes.  

int 

ATTR_DATA_TYPE 

Datatype of the argument

Refer to Notes on Types and Attributes

int 

ATTR_DATA_SIZE 

Size of the datatype of the argument. This length is returned in bytes and not characters for strings and raws. Returns 22 for NUMBER. 

int 

ATTR_PRECISION 

Precision of numeric arguments. If the precision is nonzero and scale is -127, then it is a FLOAT; otherwise a NUMBER(p, s). If precision is 0, then NUMBER(p, s) can be represented simply as NUMBER. 

int 

ATTR_SCALE 

Scale of numeric arguments. If the precision is nonzero and scale is -127, then it is a FLOAT; otherwise a NUMBER(p, s). If precision is 0, then NUMBER(p, s) can be represented simply as NUMBER. 

int 

ATTR_LEVEL 

Datatype levels. This attribute always returns 0. 

int 

ATTR_HAS_DEFAULT 

Indicates whether an argument has a default 

int 

ATTR_LIST_ARGUMENTS 

The list of arguments at the next level (when the argument is of a record or table type) 

vector<MetaData> 

ATTR_IOMODE 

Indicates the argument mode. Valid values are 0 for IN (OCCI_TYPEPARAM_IN), 1 for OUT (OCCI_TYPEPARAM_OUT), and

2 for IN/OUT (OCCI_TYPEPARAM_INOUT) 

int 

ATTR_RADIX 

Returns a radix (if number type) 

int 

ATTR_IS_NULL 

Returns 0 if null values are not permitted for the column 

int 

ATTR_TYPE_NAME 

Returns a string that is the type name, or the package name in the case of package local types. The returned value contains the type name if the datatype is SQLT_NTY or SQLT_REF. If the datatype is SQLT_NTY, then the name of the named datatype's type is returned. If the datatype is SQLT_REF, then the type name of the named datatype pointed to by the REF is returned.  

string 

ATTR_SCHEMA_NAME 

For SQLT_NTY or SQLT_REF, returns a string with the schema name under which the type was created, or under which the package was created in the case of package local types 

string 

ATTR_SUB_NAME 

For SQLT_NTY or SQLT_REF, returns a string with the type name, in the case of package local types 

string 

ATTR_LINK 

For SQLT_NTY or SQLT_REF, returns a string with the database link name of the database on which the type exists. This can happen only in the case of package local types, when the package is remote. 

string 

ATTR_REF_TDO 

Returns the REF of the TDO for the type, if the argument type is an object 

RefAny 

ATTR_CHARSET_ID 

Returns the character set ID if the argument is of a string or character type 

int 

ATTR_CHARSET_FORM 

Returns the character set form if the argument is of a string or character type 

int 

List Attributes

A list type of attribute can be described for all the elements in the list. In case of a function argument list, position 0 has a parameter for return values (PTYPE_ARG).

The list is described iteratively for all the elements. The results are stored in a C++ vector<MetaData>. Call the getVector method to describe list type of attributes. Table 6-16 displays the list attributes.

Table 6-16 Values for ATTR_LIST_TYPE  
Possible Values  Description 

ATTR_LIST_COLUMNS 

Column list 

ATTR_LIST_ARGUMENTS 

Procedure or function arguments list 

ATTR_LIST_SUBPROGRAMS 

Subprogram list 

ATTR_LIST_TYPE_ATTRIBUTES 

Type attribute list 

ATTR_LIST_TYPE_METHODS 

Type method list 

ATTR_LIST_OBJECTS 

Object list within a schema 

ATTR_LIST_SCHEMAS 

Schema list within a database 

Schema Attributes

A parameter for a schema type (type PTYPE_SCHEMA) has the attributes described in Table 6-17.

Table 6-17 Attributes Specific to Schemas  
Attribute  Description  Attribute Datatype 

ATTR_LIST_OBJECTS 

List of objects in the schema 

string 

Database Attributes

A parameter for a database (type PTYPE_DATABASE) has the attributes described in Table 6-18.

Table 6-18 Attributes Specific to Databases  
Attribute  Description  Attribute Datatype 

ATTR_VERSION 

Database version 

string 

ATTR_CHARSET_ID 

Database character set ID from the server handle 

int 

ATTR_NCHARSET_ID 

Database native character set ID from the server handle 

int 

ATTR_LIST_SCHEMAS 

List of schemas (type PTYPE_SCHEMA) in the database 

vector<MetaData> 

ATTR_MAX_PROC_LEN 

Maximum length of a procedure name 

unsigned int 

ATTR_MAX_COLUMN_LEN 

Maximum length of a column name 

unsigned int 

ATTR_CURSOR_COMMIT_BEHAVIOR 

How a COMMIT operation affects cursors and prepared statements in the database. Values are: OCCI_CURSOR_OPEN for preserving cursor state as before the commit operation and OCCI_CURSOR_CLOSED for cursors that are closed on COMMIT, although the application can still reexecute the statement without preparing it again. 

int 

ATTR_MAX_CATALOG_NAMELEN 

Maximum length of a catalog (database) name 

int 

ATTR_CATALOG_LOCATION 

Position of the catalog in a qualified table. Valid values are OCCI_CL_START and OCCI_CL_END. 

int 

ATTR_SAVEPOINT_SUPPORT 

Identifies whether the database supports savepoints. Valid values are OCCI_SP_SUPPORTED and OCCI_SP_UNSUPPORTED. 

int 

ATTR_NOWAIT_SUPPORT 

Identifies whether the database supports the nowait clause. Valid values are OCCI_NW_SUPPORTED and OCCI_NW_UNSUPPORTED. 

int 

ATTR_AUTOCOMMIT_DDL 

Identifies whether the autocommit mode is required for DDL statements. Valid values are OCCI_AC_DDL and OCCI_NO_AC_DDL. 

int 

ATTR_LOCKING_MODE 

Locking mode for the database. Valid values are OCCI_LOCK_IMMEDIATE and OCCI_LOCK_DELAYED. 

int 

See Also:

 


Go to previous page Go to next page
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback