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 (ParamType of PTYPE_TABLE and PTYPE_VIEW) have the following type-specific attributes:
|
|
Parameters for a tables only (ParamType of PTYPE_TABLE):
|
|
Parameters for functions and procedures (ParamType of PTYPE_FUNC and PTYPE_PROC, respectively):
|
|
Parameters for packages (ParamType of PTYPE_PKG):
|
|
Parameter is for types (ParamType of PTYPE_TYPE):
|
|
Parameter is for attributes of types (ParamType of PTYPE_TYPE_ATTR):
|
|
Parameter is for methods of types (ParamType of PTYPE_TYPE_METHOD):
|
|
Parameter is for collections (ParamType of PTYPE_TYPE_COLL):
|
|
Parameter is for synonyms (ParamType of PTYPE_SYN):
|
|
Parameter is for sequences (ParamType of PTYPE_SEQ):
|
|
Parameter is for columns of tables or views (ParamType of PTYPE_COL):
|
|
Parameter for arguments of a procedure or function (PTYPE_ARG), a method (PTYPE_TYPE_ARG), or a result (PTYPE_TYPE_RESULT)
|
|
Parameter is for schemas (ParamType of PTYPE_SCHEMA):
|
|
Parameter is for list of columns, arguments or subprograms:
|
|
Parameter is for list of columns, arguments or subprograms (ParamType of PTYPE_DATABASE):
|
AttrValues |
Attribute values are returned on executing a
|
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
class constructor.
MetaData( const MetaData &omd);
Parameter | Description |
---|---|
cmd |
The source that the MetaData object is copied from. |
This method returns the number of attributes related to the metadata object.
unsigned int getAttributeCount() const;
This method returns the attribute ID, such as ATTR_NUM_COLS
, of the attribute represented by the attribute number specified.
AttrId getAttributeId( unsigned int attributeNum) const;
Parameter | Description |
---|---|
attributeNum |
The number of the attribute for which the attribute ID is to be returned. |
This method returns the attribute type, such as NUMBER
or INT
, of the attribute represented by attribute number specified.
Type getAttributeType( unsigned int attributeNum) const;
Parameter | Description |
---|---|
attributeNum |
The number of the attribute for which the attribute type is to be returned. |
This method returns the value of the attribute as a C++ boolean
. If the value is a SQL NULL
, the result is FALSE
.
bool getBoolean( MetaData::AttrId attributeId) const;
Parameter | Description |
---|---|
attributeId |
The attribute ID |
This method returns the value of the attribute as a C++ int
. If the value is SQL NULL
, the result is 0
.
int getInt( MetaData::AttrId attributeId) const;
Parameter | Description |
---|---|
attributeId |
The attribute ID |
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.
MetaData getMetaData( MetaData::AttrId attributeId) const;
Parameter | Description |
---|---|
attributeId |
The attribute ID |
This method returns the value of the attribute as a Number
object. If the value is a SQL NULL
, the result is NULL
.
Number getNumber( MetaData::AttrId attributeId) const;
Parameter | Description |
---|---|
attributeId |
The attribute ID |
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
.
RefAny getRef( MetaData::AttrId attributeId) const;
Parameter | Description |
---|---|
attributeId |
The attribute ID |
This method returns the value of the attribute as a string. If the value is SQL NULL
, the result is NULL
.
string getString( MetaData::AttrId attributeId) const;
Parameter | Description |
---|---|
attributeId |
The attribute ID |
This method returns the value of the attribute as a Timestamp
object. If the value is a SQL NULL
, the result is NULL
.
Timestamp getTimestamp( MetaData::AttrId attributeId) const;
Parameter | Description |
---|---|
attributeId |
The attribute ID |
This method returns the value of the attribute as a C++ unsigned int
. If the value is a SQL NULL
, the result is 0
.
unsigned int getUInt( MetaData::AttrId attributeId) const;
Parameter | Description |
---|---|
attributeId |
The attribute ID |
Returns the value of an attribute as a UString
in the character set associated with the metadata.
UString getUString( MetaData::AttrId attributeId) const;
Parameter | Description |
---|---|
attributeId |
The attribute ID |
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.
vector<MetaData> getVector( MetaData::AttrId attributeId) const;
Parameter | Description |
---|---|
attributeId |
The attribute ID |
This method assigns one MetaData
object to another. This increments the reference count of the MetaData
object that is assigned.
void operator=( const MetaData &omd);
Parameter | Description |
---|---|
cmd |
MetaData object to be assigned |