cursor/initialize_get_find_TheKing.c
static
RDM_ROWID_T
kingRowId;
static
RDM_ROWID_T
kingsClubRowId;
static
RDM_RETCODE
initializeDBAForTheKingAndHisClub (
RDM_DB
db)
{
RDM_RETCODE
rc;
RDM_CURSOR
theKing = NULL;
rc =
rdm_dbGetRowsByKeyAtKey
(
db, KEY_ADULT_ADULT_NAME,
"The King"
, 0, &theKing);
if
(rc ==
sOKAY
)
{
rc =
rdm_cursorGetRowId
(theKing, &kingRowId);
rc =
rdm_cursorGetOwnerRowId
(theKing, REF_MEMBERS, &kingsClubRowId);
}
rdm_cursorFree
(theKing);
return
rc;
}
static
RDM_RETCODE
getTheKing (
RDM_CURSOR
*theKing,
RDM_DB
db)
{
RDM_RETCODE
rc;
rc =
rdm_dbGetRowsAtRowId
(db, TABLE_ADULT, kingRowId, theKing);
/* Create a singleton for it */
if
(rc ==
sOKAY
)
{
rc =
rdm_cursorGetSelf
(*theKing, theKing);
}
return
rc;
}
static
RDM_RETCODE
findTheKing (
RDM_CURSOR
adults)
{
RDM_RETCODE
rc;
rc =
rdm_cursorMoveToRowId
(adults, kingRowId);
return
rc;
}