cursor/registerVoters.c
{
RDM_RETCODE rc;
RDM_CURSOR voters = NULL;
RDM_CURSOR system = NULL;
uint64_t count;
rc = rdm_dbGetRows (db, TABLE_SYSTEM_TBL, &system);
{
rc = rdm_cursorMoveToFirst (system);
}
if (rc == sOKAY)
{
rc = rdm_cursorGetMemberCount (system, REF_VOTERS, &count);
}
if (rc == sOKAY)
{
printf ("Registering " RDM_INT64_FMT_A " voters", count);
rc = rdm_cursorGetMemberRows (system, REF_VOTERS, &voters);
}
if (rc == sOKAY)
{
rc = rdm_cursorMoveToFirst (adults);
}
while (rc == sOKAY)
{
rc = rdm_cursorAddMember (voters, adults);
if (rc == sOKAY)
{
rc = rdm_cursorMoveToNext (adults);
}
}
rc = sOKAY;
/* The King can not vote, lets unlink him */
if (rc == sOKAY)
{
}
if (rc == sOKAY)
{
rc = rdm_cursorRemoveMember (voters);
}
rdm_cursorFree (voters);
rdm_cursorFree (system);
return rc;
}
RDM_RETCODE rdm_cursorGetMemberCount(RDM_CURSOR cursor, RDM_REF_ID refId, uint64_t *memberCount)
Get the member count for a set owner row.
RDM_RETCODE rdm_cursorRemoveMember(RDM_CURSOR setCursor)
Remove a row from a set cursor (unlink)
RDM_RETCODE rdm_cursorAddMember(RDM_CURSOR setCursor, RDM_CURSOR memberCursor)
Add a row to a set cursor (link)
RDM_RETCODE rdm_dbGetRows(RDM_DB db, RDM_TABLE_ID tableId, RDM_CURSOR *pCursor)
Associate an RDM_CURSOR with rows based on a table id.
RDM_RETCODE rdm_cursorGetMemberRows(RDM_CURSOR ownerCursor, RDM_REF_ID refId, RDM_CURSOR *pCursor)
Associate an RDM_CURSOR with members.