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;
}
struct RDM_CURSOR_S * RDM_CURSOR
Definition: rdmtypes.h:306
RDM_RETCODE rdm_cursorAddMember(RDM_CURSOR setCursor, RDM_CURSOR memberCursor)
Add a row to a set cursor (link)
@ sOKAY
Definition: rdmretcodetypes.h:96
RDM_RETCODE rdm_cursorFree(RDM_CURSOR cursor)
Free an RDM_CURSOR.
RDM_RETCODE rdm_dbInsertRow(RDM_DB db, RDM_TABLE_ID tableId, const void *colValues, size_t bytesIn, RDM_CURSOR *pCursor)
Insert a new row into a table at the specified rowId.
struct RDM_DB_S * RDM_DB
Definition: rdmtypes.h:305
RDM_RETCODE
RDM status and error return codes.
Definition: rdmretcodetypes.h:44