diff -r 51a74ef9ed63 -r ae94777fff8f Symbian3/SDK/Source/GUID-B756AB28-A0EA-5AA3-86E3-CCFFCD642F08.dita --- a/Symbian3/SDK/Source/GUID-B756AB28-A0EA-5AA3-86E3-CCFFCD642F08.dita Wed Mar 31 11:11:55 2010 +0100 +++ b/Symbian3/SDK/Source/GUID-B756AB28-A0EA-5AA3-86E3-CCFFCD642F08.dita Fri Jun 11 12:39:03 2010 +0100 @@ -1,69 +1,69 @@ - - - - - -What -are linksThis topic describes the structure of links. A link is a container -and an element. A link is an item that can be stored in the Comms Database. -

A link is a container. A link refers to another record. A link can be included -in a record.

-

A link is represented by the templated class CMDBRecordLink<T>. -The template parameter defines the type of record to which the link refers.

- - - -

A link is a public data member of a class. The class defines the structure -of record. This record is the 'parent' record of the linked record. For example, -Symbian platform defines the class CCDIAPRecord that -represents an Internet Access Point (IAP) record. A set of IAP records form -an IAP table. The public data members of this class are the fields and links -that make the record. The following code shows part of the class definition. -Some parts are omitted - this is not the complete class definition.

-class CCDIAPRecord : public CCDRecordBase - { - public: - CMDBField<TDesC> iServiceType; - CMDBRecordLink<CCDServiceRecordBase> iService; - CMDBField<TDesC> iBearerType; - CMDBRecordLink<CCDBearerRecordBase> iBearer; - CMDBRecordLink<CCDNetworkRecord> iNetwork; - CMDBField<TUint32> iNetworkWeighting; - CMDBRecordLink<CCDLocationRecord> iLocation; - ... - } - -

A CMDBRecordLink<T> object contains -an integer. The integer is the element -Id of the linked record in the database.

-

If you have a parent record in memory, you call the LoadL() function -on the link object CMDBRecordLink<T> to -get the linked record into memory. You can access the linked record through -the iLinkedRecord pointer. This pointer is a member of the CMDBRecordLinkBase class, -but you can access this data member through the CMDBRecordLink<T> object.

-

There are two cases:

- -
-Following - a link to another table and finding a field by Id and by name: -Tutorial + + + + + +What +are linksThis topic describes the structure of links. A link is a container +and an element. A link is an item that can be stored in the Comms Database. +

A link is a container. A link refers to another record. A link can be included +in a record.

+

A link is represented by the templated class CMDBRecordLink<T>. +The template parameter defines the type of record to which the link refers.

+ + + +

A link is a public data member of a class. The class defines the structure +of record. This record is the 'parent' record of the linked record. For example, +Symbian platform defines the class CCDIAPRecord that +represents an Internet Access Point (IAP) record. A set of IAP records form +an IAP table. The public data members of this class are the fields and links +that make the record. The following code shows part of the class definition. +Some parts are omitted - this is not the complete class definition.

+class CCDIAPRecord : public CCDRecordBase + { + public: + CMDBField<TDesC> iServiceType; + CMDBRecordLink<CCDServiceRecordBase> iService; + CMDBField<TDesC> iBearerType; + CMDBRecordLink<CCDBearerRecordBase> iBearer; + CMDBRecordLink<CCDNetworkRecord> iNetwork; + CMDBField<TUint32> iNetworkWeighting; + CMDBRecordLink<CCDLocationRecord> iLocation; + ... + } + +

A CMDBRecordLink<T> object contains +an integer. The integer is the element +Id of the linked record in the database.

+

If you have a parent record in memory, you call the LoadL() function +on the link object CMDBRecordLink<T> to +get the linked record into memory. You can access the linked record through +the iLinkedRecord pointer. This pointer is a member of the CMDBRecordLinkBase class, +but you can access this data member through the CMDBRecordLink<T> object.

+

There are two cases:

+
    +
  • If you know what type +of record the link refers to you cast the pointer to the correct type. For +example:

    CCDDialOutISPRecord* ptrIspRecord = static_cast<CCDDialOutISPRecord*>(ptrSingleIAPRecord->iService.iLinkedRecord);

    where ptrSingleIAPRecord is of type CCDIAPRecord.

  • +
  • If you do not know what +type of record the link refers to you cast the pointer to the base class for +records. You use GetFieldByNameL() or GetFieldByIdLaccess() to +access the data in the linked record. For example:

    CCDServiceRecordBase* ptrServiceRecord = static_cast<CCDServiceRecordBase*>(ptrSingleIAPRecord->iService.iLinkedRecord); +CMDBField<TUint32>* field; + +// Find a field by its Id. In this code fragment, the field we are looking for +// is the bearer speed field. +field = (CMDBField<TUint32>*)ptrServiceRecord->GetFieldByIdL(KCDTIdBearerSpeed);
  • +
+
+Following + a link to another table and finding a field by Id and by name: +Tutorial
\ No newline at end of file