|
Purpose |
Transfer of key fields from a parent table to a child table | |
|
Old name |
#define ncopy2parent(child,parent,role) | |
|
Syntax (CCOWN) |
int rec_parent_copy(short * parent,const short * child,int role); | |
|
Syntax (DP4DBAPI) |
int dp4_rec_parent_copy(DCONN * dconn,short * parent,const short * child,int role); | |
|
Parameters |
DCONN * dconn |
Handle to database connection |
|
short* parent |
Pointer to the L field of parent record | |
|
|
short* child |
Pointer to the L field of child record |
|
|
int role |
Role of index |
|
Description |
The rec_parent_copy() function is copies the primary key fields of the given parent table to the parent record from the corresponding foreign key fields in the child record. This involves a call to the database manager to perform the field transcriptions. This is inefficient, particularly in networking applications. It is better to do the transfer explicitly in the program. The function has the advantage that it will still be valid if the database parent's child index details are changed. | |
|
Return values |
Returns TRUE if the fields being copied initially had different values in the parent and child records or FALSE if they were the same. An application might use this to decide whether or not to join the parent record - on the basis that if the key haas not changed the coorrect record is already in memory. | |
|
See also |
||