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-27, and the summary of its methods is in Table 13-28.
                  
Table 13-27 Enumerated Values Used by MetaData Class
| Attribute | Options | 
|---|---|
ParamType   | 
                           
                               The parameter types for objects are: 
  | 
                        
| 
                               
  | 
                           
                               Attributes of all parameters: 
  | 
                        
| 
                               
  | 
                           
                               Parameters for a table or view ( 
  | 
                        
| 
                               
  | 
                           
                               Parameters for a tables only ( 
  | 
                        
| 
                               
  | 
                           
                               Parameters for functions and procedures ( 
  | 
                        
| 
                               
  | 
                           
                               Parameters for packages ( 
  | 
                        
| 
                               
  | 
                           
                               Parameter is for types ( 
  | 
                        
| 
                               
  | 
                           
                               Parameter is for attributes of types ( 
  | 
                        
| 
                               
  | 
                           
                               Parameter is for methods of types ( 
  | 
                        
| 
                               
  | 
                           
                               Parameter is for collections ( 
  | 
                        
| 
                               
  | 
                           
                               Parameter is for synonyms ( 
  | 
                        
| 
                               
  | 
                           
                               Parameter is for sequences ( 
  | 
                        
| 
                               
  | 
                           
                               Parameter is for columns of tables or views ( 
 
 
 
  | 
                        
| 
                               
  | 
                           
                               Parameter for arguments of a procedure or function ( 
  | 
                        
| 
                               
  | 
                           
                               Parameter is for schemas ( 
  | 
                        
| 
                               
  | 
                           
                               Parameter is for list of columns, arguments or subprograms: 
  | 
                        
| 
                               
  | 
                           
                               Parameter is for list of columns, arguments or subprograms ( 
  | 
                        
AttrValues  | 
                           
                               Attribute values are returned on executing a  
  | 
                        
| 
                               
  | 
                           
                               Attributes for column identity enable automatic increment support. Possible values are: 
  | 
                        
Table 13-28 Summary of MetaData Methods
| Method | Description | 
|---|---|
| 
                               
  | 
                        |
| 
                               Gets the count of the attribute as a   | 
                        |
| 
                               Gets the ID of the specified attribute  | 
                        |
| 
                               Gets the type of the specified attribute.  | 
                        |
| 
                               Gets the value of the attribute as a C++   | 
                        |
| 
                               Gets the value of the attribute as a C++   | 
                        |
| 
                               Gets the value of the attribute as a   | 
                        |
| 
                               Returns the specified attribute as a   | 
                        |
| 
                               Gets the value of the attribute as a   | 
                        |
| 
                               Gets the value of the attribute as a string.  | 
                        |
| 
                               Gets the value of the attribute as a   | 
                        |
| 
                               Gets the value of the attribute as a C++   | 
                        |
| 
                               Returns the value of the attribute as a   | 
                        |
| 
                               Gets the value of the attribute as an C++ vector.  | 
                        |
| 
                               Assigns one metadata object to another.  | 
                        
MetaData()
MetaData class constructor.
                     
Syntax
MetaData( const MetaData &omd);
| Parameter | Description | 
|---|---|
cmd  | 
                              
                                  The source that the   | 
                           
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, such as 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, such as NUMBER or 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. The overloaded version returns the value of the column attribute.
                     
| Syntax | Description | 
|---|---|
bool getBoolean( MetaData::AttrId attributeId) const;  | 
                              
                                  Returns the value of the attribute.  | 
                           
bool getBoolean( MetaData::ColumnAttrId colAttributeId) const;  | 
                              
                                  Returns the value of the column attribute  | 
                           
| Parameter | Description | 
|---|---|
attributeId  | 
                              
                                  The attribute ID  | 
                           
colAttributeId  | 
                              
                                  The column 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  |