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.
@ sENDOFCURSOR
Definition: rdmretcodetypes.h:58
struct RDM_CURSOR_S * RDM_CURSOR
Definition: rdmtypes.h:347
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:100
RDM_RETCODE rdm_cursorFree(RDM_CURSOR cursor)
Free an RDM_CURSOR.
enum RDM_RETCODE_E RDM_RETCODE
RaimaDB status and error return codes.
RDM_RETCODE rdm_cursorGetClone(RDM_CURSOR sourceCursor, RDM_CURSOR *pCursor)
Associate an RDM_CURSOR as a clone of an existing RDM_CURSOR.