CDaoRelationInfo Structure

The CDaoRelationInfo structure has the following form:

struct CDaoRelationInfo
{
   CDaoRelationInfo( );             // Constructor

   CString m_strName;                      // Primary
   CString m_strTable;                     // Primary
   CString m_strForeignTable;              // Primary
   long m_lAttributes;                     // Secondary
   CDaoRelationFieldInfo* m_pFieldInfos;   // Secondary
   short m_nFields;                        // Secondary

   // Below the // Implementation comment:
   // Destructor, not otherwise documented
};

The CDaoRelationInfo structure contains information about a relation defined between fields of two tables in a CDaoDatabase object. The references to Primary and Secondary above indicate how the information is returned by the GetRelationInfo member function in class CDaoDatabase.

Relation objects are not represented by an MFC class. Instead, the DAO object underlying an MFC object of the CDaoDatabase class maintains a collection of relation objects: CDaoDatabase supplies member functions to access some individual items of relation information, or you can access them all at once with a CDaoRelationInfo object by calling the GetRelationInfo member function of the containing database object.

Members

m_strName

Uniquely names the relation object. For more information, see the topic "Name Property" in DAO Help.

m_strTable

Names the primary table in the relation.

m_strForeignTable

Names the foreign table in the relation. A foreign table is a table used to contain foreign keys. Generally, you use a foreign table to establish or enforce referential integrity. The foreign table is usually on the many side of a one-to-many relationship. Examples of foreign tables include tables containing codes for the American states or Canadian provinces or customer orders.

m_lAttributes

Contains information about the relation type. The value of this member can be any of the following:

m_pFieldInfos

A pointer to an array of CDaoRelationFieldInfo structures. The array contains one object for each field in the relation. The m_nFields data member gives a count of the array elements.

m_nFields

The number of CDaoRelationFieldInfo objects in the m_pFieldInfos data member.

Comments

Information retrieved by the CDaoDatabase::GetRelationInfo member function is stored in a CDaoRelationInfo structure. CDaoRelationInfo also defines a Dump member function in debug builds. You can use Dump to dump the contents of a CDaoRelationInfo object. For information on using this and other MFC DAO Info structures, see the article DAO Collections: Obtaining Information About DAO Objects in Visual C++ Programmer's Guide.

See Also   CDaoRelationFieldInfo