cursor/printMembers.c
{
RDM_RETCODE rc;
RDM_CURSOR membersIter = NULL;
/* Clone members so we can leave its position as is */
rc = rdm_cursorGetClone (members, &membersIter);
{
rc = rdm_cursorMoveToFirst (membersIter);
}
while (rc == sOKAY)
{
RDM_TABLE_ID tableId;
rc = rdm_cursorGetTableId (membersIter, &tableId);
if (rc == sOKAY && tableId == TABLE_ADULT)
{
ADULT adult;
if (rc == sOKAY)
{
printf (
"Adult with id: %d and name: %s\n", adult.adult_id,
adult.adult_name);
rc = rdm_cursorMoveToNext (membersIter);
}
}
{
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);
}
}
{
printf ("Unknow member type, must be a secret member\n");
rc = rdm_cursorMoveToNext (membersIter);
}
}
if (rc == sENDOFCURSOR)
rc = sOKAY;
rdm_cursorFree (membersIter);
return rc;
}
RDM_RETCODE rdm_cursorGetTableId(RDM_CURSOR cursor, RDM_TABLE_ID *tableId)
Get the table id for the current row of the cursor.
RDM_RETCODE rdm_cursorReadRow(RDM_CURSOR cursor, void *colValues, size_t bytesIn, size_t *bytesOut)
Read all columns from a row.
RDM_RETCODE rdm_cursorGetClone(RDM_CURSOR sourceCursor, RDM_CURSOR *pCursor)
Associate an RDM_CURSOR as a clone of an existing RDM_CURSOR.