cursor/insertChildrenWithSiblings.c
static RDM_RETCODE insertChildrenWithSiblings (
RDM_CURSOR siblingsOnMothersSide,
RDM_CURSOR siblingsOnFathersSide,
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 and name: %s\n", children[ii].child_id,
children[ii].child_name);
db, TABLE_CHILD, &children[ii], sizeof (CHILD), &inserted);
printf ("Connect the newly created child to its parents\n");
if (rc == sOKAY && siblingsOnMothersSide)
{
rc = rdm_cursorAddMember (siblingsOnMothersSide, inserted);
}
if (rc == sOKAY && siblingsOnFathersSide)
{
rc = rdm_cursorAddMember (siblingsOnFathersSide, inserted);
}
}
rdm_cursorFree (inserted);
return rc;
}