13.20 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. |
13.20.1 MetaData()
MetaData
class constructor.
Syntax
MetaData( const MetaData &omd);
Parameter | Description |
---|---|
cmd |
The source that the |
13.20.2 getAttributeCount()
This method returns the number of attributes related to the metadata object.
Syntax
unsigned int getAttributeCount() const;
13.20.3 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. |
13.20.4 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. |
13.20.5 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 |
13.20.6 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 |
13.20.7 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 |
13.20.8 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 |
13.20.9 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 |
13.20.10 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 |
13.20.11 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 |
13.20.12 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 |
13.20.13 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 |
13.20.14 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 |