cursor/initialize_get_find_TheKing.c
static RDM_ROWID_T kingRowId;
static RDM_ROWID_T kingsClubRowId;
static RDM_RETCODE initializeDBAForTheKingAndHisClub (RDM_DB db)
{
RDM_CURSOR theKing = NULL;
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)
{
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)
{
rc = rdm_cursorMoveToRowId (adults, kingRowId);
return rc;
}
RDM_RETCODE rdm_cursorGetSelf(RDM_CURSOR sourceCursor, RDM_CURSOR *pCursor)
Associate an RDM_CURSOR with the current row of the sourceCursor.
struct RDM_CURSOR_S * RDM_CURSOR
Definition: rdmtypes.h:306
RDM_RETCODE rdm_dbGetRowsAtRowId(RDM_DB db, RDM_TABLE_ID tableId, RDM_ROWID_T rowId, RDM_CURSOR *pCursor)
Associate an RDM_CURSOR with rows based on a tableId and and rowId.
@ sOKAY
Definition: rdmretcodetypes.h:97
RDM_RETCODE rdm_dbGetRowsByKeyAtKey(RDM_DB db, RDM_KEY_ID keyId, const void *keyValue, size_t len, RDM_CURSOR *pCursor)
Associate an RDM_CURSOR with a row set that is ordered by key value and is initially positioned at th...
RDM_RETCODE rdm_cursorFree(RDM_CURSOR cursor)
Free an RDM_CURSOR.
RDM_RETCODE rdm_cursorGetOwnerRowId(RDM_CURSOR cursor, RDM_REF_ID refId, RDM_ROWID_T *rowid)
Get the rowid of a set owner.
uint64_t RDM_ROWID_T
Definition: rdmrowidtypes.h:21
struct RDM_DB_S * RDM_DB
Definition: rdmtypes.h:305
RDM_RETCODE rdm_cursorMoveToRowId(RDM_CURSOR cursor, RDM_ROWID_T rowid)
Position a cursor based on a rowid.
RDM_RETCODE
RDM status and error return codes.
Definition: rdmretcodetypes.h:43
RDM_RETCODE rdm_cursorGetRowId(RDM_CURSOR cursor, RDM_ROWID_T *rowid)
Get the rowid for the current row of the cursor.