|
<< Click to Display Table of Contents >> DbiLinkDetail |
![]() ![]()
|
C syntax
DBIResult DBIFN DbiLinkDetail (hMstrCursor, hDetlCursor, iLnkFields, piMstrFields, piDetlFields);
Delphi syntax
function DbiLinkDetail (hMstrCursor: hDBICur; hDetlCursor: hDBICur; iLnkFields: Word; piMstrFields: PWord; piDetlFields: PWord): DBIResult stdcall;
Description
DbiLinkDetail establishes a link between two cursors such that the detail cursor has its record set limited to the set of records matching the linking key values of the master cursor.
Parameters
hMstrCursor Type: hDBICur (Input)
Specifies the cursor handle associated with the master table. The cursor does not have to be opened on an index.
hDetlCursor Type: hDBICur (Input)
Specifies the cursor handle associated with the detail table. The cursor must be opened on an index corresponding to all the link fields.
iLnkFields Type: UINT16 (Input)
Specifies the number of link fields.
piMstrFields Type: pUINT16 (Input)
Pointer to the array of field numbers of link fields in the master table.
piDetlFields Type: pUINT16 (Input)
Pointer to the array of field numbers of link fields in the detail table.
Usage
This function is useful for establishing one-to-one or one-to-many relationships between tables. A master cursor can have more than one detail cursor; a detail cursor can have only one master cursor. A detail cursor can also be a master cursor. Links apply to all available driver types; they can be established between cursors of the same or different driver types. The effect is equivalent to setting a range using DbiSetRange on the detail table and using the linking fields of the master table.
Prerequisites
For the cursors to be linked, both cursors must be enabled with DbiBeginLinkMode. The data types of linked fields in master and detail records must be compatible. The detail cursor must be opened on an index corresponding to all of the linking fields. For expression links, see DbiLinkDetailToExp.
Completion state
The linked cursors are modified so that the detail cursor allows access only to the records that match the linking value of the master record. If the position of the master cursor changes so that a different linking value is obtained for the linking fields, the detail cursor is set to a new range of records and is positioned to the beginning of this range.
DbiResult |
Meaning |
DBIERR_NONE |
The link between the detail cursor (hDetlCursor) and the master cursor (hMstrCursor) was successfully established. |
DBIERR_INVALIDHNDL |
One or more of the specified cursor handles is invalid or NULL. |
See also