MetaPropertyInfo Class
This class is used to create, read, modify or delete a CMetaPropetyDesc object. However, after the object has been created and its properties set to whatever values are appropriate, it is added to the MDS repository through the IMetaClassInfo::AddProperty routine with this object as that routine's parameter. This means that all the “put” properties below are only setting in-memory values and as far as the MDS repository goes, they are useful only before the call to IMetaClassInfo::AddProperty when creating the property, or Update when modifying the property.
See “CMetaPropertyDesc Class” on page 278 for more detailed information.
Property |
Type |
Description |
Common Properties |
|
|
NumDigit |
Short |
The number of decimal digits. |
PropertyLength |
Long |
The length of the property. |
SQL_Type |
Enum |
enum { sqlChar = 1, |
|
|
sqlNumeric = 2, |
|
|
sqlDecimal = 3, |
|
|
sqlInteger = 4, |
|
|
sqlSmallInt = 5, |
|
|
sqlFloat = 6, |
|
|
sqlReal = 7, |
|
|
sqlDouble = 8, |
|
|
sqlDate = 9, |
|
|
sqlVarChar = 12, |
|
|
sqlBinary = -2, |
|
|
sqlVarBinary = -3, |
|
|
sqlTinyInt = -6, |
|
|
sqlTime = 10, |
|
|
sqlTimeStamp = 11 |
|
|
} ColumnType; |
Identifier |
Long |
The property identifier. Must be greater than 500. |
VARIANT_Type |
Enum |
enum { vtEmpty = VT_EMPTY, |
|
|
vtInteger = VT_I2, |
|
|
vtLong = VT_I4, |
|
|
vtDouble = VT_R8, |
|
|
vtDate = VT_DATE, |
|
|
vtString = VT_BSTR, |
|
|
vtBool = VT_BOOL, |
|
|
vbByte = VT_I1, |
|
|
vtChar = VT_UI1, |
|
|
vtBinary = VT_ARRAY |
|
|
} VariantType; |
CharacterSet |
BSTR |
The character set of the column. |
ValueRequired |
BOOL |
When set to True (VARIANT_TRUE=-1), indicates that this property value must be non-NULL. |
DefaultValue |
String |
Required if the ValueRequired is true, otherwise, ignored. When the property is created and the ValueRequired is set to true, this is the value used for the property for any objects currently in the class (and in any sub-classes). The value must be able to be converted to the type specified for the property. |
BasePropertyName |
BSTR |
Used for derived properties only. This is the name of the Property from the derived class. |
DerivedRelationshipList |
IMetaInfoKeyList |
Used for derived properties only. This is the list of Relationship object IDs, which lead back to the BasePropertyName's class. |
Common Properties
See “Common Properties” on page 349
get_Identifier
Purpose:
Gets the relative property ID for the property.
Syntax:
HRESULT get_Identifier(
[out, retval] long *pVal);
put_Identifier
Purpose:
Sets the relative property ID for the property.
Requirements:
This must be a number greater than 500 for user-defined properties.
Syntax:
HRESULT put_Identifier([in] long newVal);
get_CharacterSet
Purpose:
Gets the property CharacterSet name.
Syntax:
HRESULT get_CharacterSet(
[out, retval] BSTR *pVal);
put_CharacterSet
Purpose:
Sets the property CharacterSet
Syntax:
HRESULT put_CharacterSet(
[in] BSTR newVal);
get_VARIANT_Type
Purpose:
Gets the property’s Variant Type.
Syntax:
HRESULT get_VARIANT_Type(
[out, retval] VariantType *pVal);
put_VARIANT_Type
Purpose:
Sets the property’s Variant Type.
Syntax:
HRESULT put_VARIANT_Type(
[in] VariantType newVal);
get_SQL_Type
Purpose:
Gets the property’s SQL Type.
Syntax:
HRESULT get_SQL_Type(
[out, retval] ColumnType *pVal);
put_SQL_Type
Purpose:
Sets the property’s SQL Type.
Syntax:
HRESULT put_SQL_Type(
[in] ColumnType newVal);
get_PropertyLength
Purpose:
Gets the property’s size.
Syntax:
HRESULT get_PropertyLength(
[out, retval] long*pVal);
put_PropertyLength
Purpose:
Sets the property’s size
Syntax:
HRESULT put_PropertyLength(
[in] long newVal);
get_NumDigit
Purpose:
Gets the property’s number of decimal digits.
Syntax:
HRESULT get_NumDigit(
[out, retval] short *pVal);
put_NumDigit
Purpose:
Sets the property’s number of decimal digits.
Syntax:
HRESULT put_NumDigit(
[in] short newVal);
get_ValueRequired
Purpose:
Gets the ValueRequired property value.
The Property attribute can only be set when the Property is created through an IMetaClassInfo.AddProperty() call. When set to True, any object containing this property must have a non-NULL value for it. The default when not set is False, meaning the property value can be NULL.
This MetaPropertyInfo attribute can only be "set" at the creation of the property, it cannot be updated. Classes that inherit this property through a super class, will also inherit the ValueRequired setting.
Syntax:
HRESULT get_ValueRequired([out, retval] VARIANT_BOOL *pVal);
put_ValueRequired
Purpose:
Sets the ValueRequired property value.
The Property attribute can only be set when the Property is created through an IMetaClassInfo.AddProperty() call. When set to True, any object containing this property must have a non-NULL value for it. The default when not set is False, meaning the property value can be NULL.
This MetaPropertyInfo attribute can only be "set" at the creation of the property, it cannot be updated. Classes that inherit this property through a super class, will also inherit the ValueRequired setting.
Syntax:
HRESULT put_ValueRequired([in] VARIANT_BOOL newVal);
get_DefaultValue
Purpose:
Gets the Defaultvalue for the property when it is required.
This is required when creating the property (using IMetaClassInfo::AddProperty), and theValueRequired setting is “true”; all existing objects in the class (and in any sub-classes) will get this as the value for the property. The string must be able to be converted to the type of the property
This MetaPropertyInfo attribute can only be "set" at the creation of the property, it cannot be updated.
Syntax:
HRESULT get_DefaultValue([out, retval] BSTR *pVal);
put_DefaultValue
Purpose:
Sets the Defaultvalue for the property when it is required.
This is required when creating the property (using IMetaClassInfo::AddProperty), and theValueRequired setting is "true"; all existing objects in the class (and in any sub-classes) will get this as the value for the property. The string must be able to be converted to the type of the property.
This MetaPropertyInfo attribute can only be "set" at the creation of the property, it cannot be updated.
Syntax:
HRESULT put_Defaultvalue([in] BSTR newVal);
get_BasePropertyName
Purpose:
Used only when retrieving properties for derived classes.
Derived classes get all their properties from the classes from which they derive. These classes are known as their "base" classes, and these properties, as their derived or "base" properties. A derived class can have up to five base classes from which it can acquire its (base) properties.
The get_BasePropertyName is the name of a property in one of those classes, and the get_DerivedRelationshipList (below), is used to identify which base class the property belongs to. It is the list of relationships in the chain leading to the base class.
Syntax:
HRESULT get_BasePropertyName([out, retval] BSTR *pVal);
put_BasePropertyName
Purpose:
Used only when creating properties for derived classes.
Derived classes get all their properties from the classes from which they derive. These classes are known as their "base" classes, and these properties, as their derived or "base" properties. A derived class can have up to five base classes from which it can acquire its (base) properties.
The put_BasePropertyName is used to identify the name of a property in one of those classes, and the put_DerivedRelationshipList (below), is used to define the way to identify that class by setting the list of relationships used to get to that (base) class, that is, it is the list of relationships in the chain leading to the base class.
The user would use these two functions to set up this derived property, before making the call to add the property to the (derived) class, using the MetaClassInfo AddProperty function.
Syntax:
HRESULT put_BasePropertyName ([in] BSTR newVal);
get_DerivedRelationshipList
Purpose:
Gets the list of object IDs that lead to the derived-property class for this property. The get_BasePropertyName function (above) will contain the actual name of the property in that class. Used for derived properties only.
Syntax:
HRESULT get_DerivedRelationshipList([out, retval] IMetaInfoKeyList *pVal);
put_ DerivedRelationshipList
Purpose:
Sets the list of object IDs that lead to the derived-property class for this property. The put_BasePropertyName function (above) is used to identify the name of the property in the base class. Used for derived properties only.
Syntax:
HRESULT put_ DerivedRelationshipList ([in] IMetaInfoKeyList newVal);
Delete
Purpose:
Use this method to delete the property description object from the MDS repository.
Requirements:
The object identifier must be set before calling the Delete method.
Syntax:
HRESULT Delete();
Read
Purpose:
Use this method to read the property description object from the MDS repository.
Requirements:
The object identifier must be set before calling the Read method.
Syntax:
HRESULT Read();
Update
Purpose:
Use this method to modify certain attributes of the MetaPropertyInfo object after it has been created. See the Microsoft Visual C++ Programmer’s Guide for attributes that can be changed.
Syntax
HRESULT Update();