rec_child_copy()

Purpose

Transfer of key fields from a parent table to a child table

Old name

#define ncopy2child(parent,child,role)
rec_child_copy(child,parent,role)

Syntax (CCOWN)

int rec_child_copy(short * child_rec, short *parent_rec, int role)

Syntax (DP4DBAPI)

int dp4_rec_child_copy(DCONN * dconn,short * child, short *parent_rec, int role)

Parameters

DCONN * dconn

Handle to database connection

 

short* child_rec

Pointer to the L field of child record

 

short* parent_rec

Pointer to the L field of parent record

 

int role

Role of index

Description

The rec_child_copy() function copies the key fields of the given parent's primary index from the parent record to the child.

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.

However, the function has the advantage that it is still valid if the database parent's child index details are changed, and may be conveneient to use in an application that is designed to work with any DP4 database.

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.

See also

rec_parent_copy()