cursor/printSiblingNamesOnMothersSide.c
static RDM_RETCODE printSiblingNamesOnMothersSide (RDM_CURSOR child)
{
char name[32];
RDM_CURSOR children = NULL;
RDM_CURSOR cursor = NULL;
rc = rdm_cursorGetSiblingRows (child, REF_MOTHERS_CHILDREN, &children);
if (rc == sOKAY)
{
rc = rdm_cursorMoveToFirst (children);
}
/* Iterate over all mothers children */
while (rc == sOKAY)
{
const char *relationship = "Sibling";
RDM_CURSOR_COMPARE comparison;
children, REF_FATHERS_CHILDREN, &cursor);
if (rc == eNOTLINKED)
{
relationship = "Half brother or sister";
rc = sOKAY;
}
if (rc == sOKAY)
{
children, COL_CHILD_CHILD_NAME, name, sizeof (name), NULL);
}
if (rc == sOKAY)
{
rdm_cursorComparePosition (children, child, &comparison);
}
/* Do not print out ourself */
if (rc == sOKAY && comparison != CURSOR_EQUAL)
{
printf ("%s: %s\n", relationship, name);
}
if (rc == sOKAY)
{
rc = rdm_cursorMoveToNext (children);
}
}
if (rc == eNOTOWNER || rc == sENDOFCURSOR)
rc = sOKAY;
rdm_cursorFree (children);
rdm_cursorFree (cursor);
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.
RDM_RETCODE rdm_cursorGetSiblingRows(RDM_CURSOR memberCursor, RDM_REF_ID refId, RDM_CURSOR *pCursor)
Associate an RDM_CURSOR with siblings.
@ eNOTOWNER
Definition: rdmretcodetypes.h:244
struct RDM_CURSOR_S * RDM_CURSOR
Definition: rdmtypes.h:306
RDM_CURSOR_COMPARE
Enumeration for RDM cursor comparisons.
Definition: rdmtypes.h:228
RDM_RETCODE rdm_cursorComparePosition(RDM_CURSOR cursorPrimary, RDM_CURSOR cursorSecondary, RDM_CURSOR_COMPARE *comparison)
compare the position of a cursor relative to another cursor
@ eNOTLINKED
Definition: rdmretcodetypes.h:250
@ CURSOR_EQUAL
Definition: rdmtypes.h:231
@ sOKAY
Definition: rdmretcodetypes.h:96
RDM_RETCODE rdm_cursorFree(RDM_CURSOR cursor)
Free an RDM_CURSOR.
RDM_RETCODE rdm_cursorGetSiblingRowsAtPosition(RDM_CURSOR memberCursor, RDM_REF_ID refId, RDM_CURSOR *pCursor)
Associate an RDM_CURSOR with siblings.
RDM_RETCODE rdm_cursorReadColumn(RDM_CURSOR cursor, RDM_COLUMN_ID columnId, void *columnValue, size_t bytesIn, size_t *bytesOut)
Read a single column from a table row.
@ sENDOFCURSOR
Definition: rdmretcodetypes.h:59
RDM_RETCODE
RDM status and error return codes.
Definition: rdmretcodetypes.h:44