cursor/insertChildren.c
static RDM_RETCODE insertChildren (
RDM_CURSOR mother,
RDM_CURSOR father,
const CHILD *children,
uint32_t nChildren,
RDM_DB db)
{
RDM_CURSOR inserted = NULL;
uint32_t ii;
for (ii = 0; rc == sOKAY && ii < nChildren; ii++)
{
printf (
"Insert children with id: %d, name: %s, and nickname: %s\n",
children[ii].child_id, children[ii].child_name,
children[ii].child_nickname);
db, TABLE_CHILD, &children[ii], sizeof (CHILD), &inserted);
printf ("Connect the newly created child to its parents\n");
if (rc == sOKAY && mother)
{
rc = rdm_cursorLinkRow (inserted, REF_MOTHERS_CHILDREN, mother);
}
if (rc == sOKAY && father)
{
rc = rdm_cursorLinkRow (inserted, REF_FATHERS_CHILDREN, father);
}
}
rdm_cursorFree (inserted);
return rc;
}