cursor/printMembers.c
static RDM_RETCODE printMembers (RDM_CURSOR members)
{
RDM_CURSOR membersIter = NULL;
/* Clone members so we can leave its position as is */
rc = rdm_cursorGetClone (members, &membersIter);
if (rc == sOKAY || rc == sENDOFCURSOR)
{
rc = rdm_cursorMoveToFirst (membersIter);
}
while (rc == sOKAY)
{
RDM_TABLE_ID tableId;
rc = rdm_cursorGetTableId (membersIter, &tableId);
if (rc == sOKAY && tableId == TABLE_ADULT)
{
ADULT adult;
rc = rdm_cursorReadRow (membersIter, &adult, sizeof (ADULT), NULL);
if (rc == sOKAY)
{
printf (
"Adult with id: %d and name: %s\n", adult.adult_id,
adult.adult_name);
rc = rdm_cursorMoveToNext (membersIter);
}
}
else if (rc == sOKAY && tableId == TABLE_CHILD)
{
CHILD child;
rc = rdm_cursorReadRow (membersIter, &child, sizeof (CHILD), NULL);
if (rc == sOKAY)
{
printf (
"Child with id: %d and name: %s\n", child.child_id,
child.child_name);
rc = rdm_cursorMoveToNext (membersIter);
}
}
else if (rc == sOKAY)
{
printf ("Unknow member type, must be a secret member\n");
rc = rdm_cursorMoveToNext (membersIter);
}
}
if (rc == sENDOFCURSOR)
rc = sOKAY;
rdm_cursorFree (membersIter);
return rc;
}