cursor/printAdults.c
static RDM_RETCODE printAdults (RDM_CURSOR adults)
{
ADULT fAdult;
RDM_CURSOR adultsIter = NULL;
/* Clone adults so we can leave its position as is */
rc = rdm_cursorGetClone (adults, &adultsIter);
if (rc == sOKAY || rc == sENDOFCURSOR)
{
rc = rdm_cursorMoveToFirst (adultsIter);
}
while (rc == sOKAY)
{
rc = rdm_cursorReadRow (adultsIter, &fAdult, sizeof (fAdult), NULL);
if (rc == sOKAY)
{
printf (
"Adult with id: %d and name: %s\n", fAdult.adult_id,
fAdult.adult_name);
rc = rdm_cursorMoveToNext (adultsIter);
}
}
if (rc == sENDOFCURSOR)
rc = sOKAY;
rdm_cursorFree (adultsIter);
return rc;
}
RDM_RETCODE rdm_cursorMoveToFirst(RDM_CURSOR cursor)
Position a cursor to the first row in the collection.
RDM_RETCODE rdm_cursorMoveToNext(RDM_CURSOR cursor)
Position a cursor to the next row in the collection.
struct RDM_CURSOR_S * RDM_CURSOR
Definition: rdmtypes.h:306
RDM_RETCODE rdm_cursorReadRow(RDM_CURSOR cursor, void *colValues, size_t bytesIn, size_t *bytesOut)
Read all columns from a row.
@ sOKAY
Definition: rdmretcodetypes.h:96
RDM_RETCODE rdm_cursorFree(RDM_CURSOR cursor)
Free an RDM_CURSOR.
RDM_RETCODE rdm_cursorGetClone(RDM_CURSOR sourceCursor, RDM_CURSOR *pCursor)
Associate an RDM_CURSOR as a clone of an existing RDM_CURSOR.
@ sENDOFCURSOR
Definition: rdmretcodetypes.h:59
RDM_RETCODE
RDM status and error return codes.
Definition: rdmretcodetypes.h:44