Collaboration diagram for Set Functions:

Functions

RDM_RETCODE rdm_cursorAddMember (RDM_CURSOR setCursor, RDM_CURSOR memberCursor)
 Add a row to a set cursor (link) More...
 
RDM_RETCODE rdm_cursorLinkRow (RDM_CURSOR cursor, RDM_REF_ID refId, RDM_CURSOR cursorOwner)
 Link a row to an owner. More...
 
RDM_RETCODE rdm_cursorRelinkRow (RDM_CURSOR cursor, RDM_REF_ID refId, RDM_CURSOR cursorOwner)
 Unlink a row from one owner and link to another. More...
 
RDM_RETCODE rdm_cursorRemoveMember (RDM_CURSOR setCursor)
 Remove a row from a set cursor (unlink) More...
 
RDM_RETCODE rdm_cursorUnlinkAndDeleteRow (RDM_CURSOR cursor)
 Unlink a row from all sets and delete it. More...
 
RDM_RETCODE rdm_cursorUnlinkRow (RDM_CURSOR cursor, RDM_REF_ID refId)
 Unlink a row from its owner. More...
 

Detailed Description

API for modifying set relationships for core cursors. All the functions here are located in RDM DB Engine Library. Linker option:

    -lrdmrdm

See RDM Cursor APIs for a more detailed description of a cursor.

Function Documentation

◆ rdm_cursorAddMember()

RDM_RETCODE rdm_cursorAddMember ( RDM_CURSOR  setCursor,
RDM_CURSOR  memberCursor 
)

#include <rdmcursorapi.h>

Add a row to a set cursor (link)

This function links the current row of cursor to the set associated with setCursor.

setCursor must be a set cursor and the current row of cursor must be a valid member for the set.

Locking Requirements
Write lock on member table and read lock on owner table associated with the set cursor (setCursor). Write lock on member table of the set the cursor is based on
Return values
sOKAYNormal, successful return.
eREADONLYDatabase is read-only and cannot be updated.
eNOSTARTUPDATEAn update operation was attempted when no rdm_dbStartUpdate() is active.
eNOTLOCKEDAttempt to access a table for reading or update without proper locks.
eDBNOTOPENDatabase not open.
eNOCURRENTROWThe cursor is not positioned to a valid row.
eOWNERDELETEDThe owner row for a set cursor has been deleted.
eSINGLETONDELETEDThe row for a singleton cursor has been deleted.
eISOWNEDThe member row is already owned.
eNOTMEMBERThe cursor's rows are not members of the specified set.
eNOTRELATEDItems are not related.
ePRECOMMITTEDA precommitted transaction must be committed or rolled back before further operations on this database are allowed.
eINVCURSOROPInvalid operation for this cursor.
See also
rdm_dbStartUpdate
rdm_dbGetRows
rdm_cursorMoveToNext
rdm_cursorUpdateRow
rdm_cursorLinkRow
rdm_cursorRelinkRow
rdm_cursorRemoveMember
rdm_cursorUnlinkAndDeleteRow
rdm_cursorUnlinkRow
rdm_dbEnd
rdm-compile
Parameters
[in]setCursorThe cursor whose set the row will be added to
[in]memberCursorThe cursor whose current row will be add to the set
Examples
cursor/insertChildrenWithSiblings.c, and cursor/registerVoters.c.

◆ rdm_cursorLinkRow()

RDM_RETCODE rdm_cursorLinkRow ( RDM_CURSOR  cursor,
RDM_REF_ID  refId,
RDM_CURSOR  cursorOwner 
)

#include <rdmcursorapi.h>

Link a row to an owner.

This function links the current row of cursor to the current row of cursorOwner for the set identified by refId.

cursor does not need to be a set cursor, but must be a cursor whose current row is a valid member of refId

cursorOwner does not need to be a set cursor, but must be a cursor whose current row is a valid owner of refId

Locking Requirements
Write lock on member table (cursor) and read lock on owner table (cursorOwner) associated with refId.
Return values
sOKAYNormal, successful return.
eREADONLYDatabase is read-only and cannot be updated.
eNOSTARTUPDATEAn update operation was attempted when no rdm_dbStartUpdate() is active.
eNOTLOCKEDAttempt to access a table for reading or update without proper locks.
eDBNOTOPENDatabase not open.
eNOCURRENTROWThe cursor is not positioned to a valid row.
eOWNERDELETEDThe owner row for a set cursor has been deleted.
eSINGLETONDELETEDThe row for a singleton cursor has been deleted.
eISOWNEDThe member row is already owned.
eNOTOWNERThe cursor's rows are not owners of the specified set.
eNOTMEMBERThe cursor's rows are not members of the specified set.
See also
rdm_dbStartUpdate
rdm_dbGetRows
rdm_cursorMoveToNext
rdm_cursorUpdateRow
rdm_cursorAddMember
rdm_cursorRelinkRow
rdm_cursorRemoveMember
rdm_cursorUnlinkAndDeleteRow
rdm_cursorUnlinkRow
rdm_dbEnd
rdm-compile
Parameters
[in]cursorThe row to link
[in]refIdThe set identifier for the connection
[in]cursorOwnerThe owner to link to
Examples
c-core/03_core/core03Example_main.c, c-core/06_core/core06Example_main.c, c-core/07_core/core07Example_main.c, c-core/10_core/core10Example_main.c, c-core/31_core/core31Example_main.c, cursor/insertChildren.c, and cursor/registerMembers.c.

◆ rdm_cursorRelinkRow()

RDM_RETCODE rdm_cursorRelinkRow ( RDM_CURSOR  cursor,
RDM_REF_ID  refId,
RDM_CURSOR  cursorOwner 
)

#include <rdmcursorapi.h>

Unlink a row from one owner and link to another.

This function links the current row of cursor to the current row of cursorOwner for the set identified by refId. If the row is already linked to a different owner it will be unlinked from that owner before being linked to the new owner.

cursor does not need to be a set cursor, but it must be a cursor whose current row is a valid member of refId

cursorOwner does not need to be a set cursor, but must be a cursor whose current row is a valid owner of refId

If cursor is a set cursor based on refId the position of the cursor will remain at the same location even though the row is no longer in the set chain. This is considered the virtual position CURSOR_UNLINKED. It is not possible to read or write to a record when we are in this virtual position, but navigation is possible and will act as if we are navigating from the original cursor position.

Locking Requirements
Write lock on member table (cursor) and read lock on owner table (cursorOwner) associated with refId.
Return values
sOKAYNormal, successful return.
eREADONLYDatabase is read-only and cannot be updated.
eNOSTARTUPDATEAn update operation was attempted when no rdm_dbStartUpdate() is active.
eNOTLOCKEDAttempt to access a table for reading or update without proper locks.
eDBNOTOPENDatabase not open.
eNOCURRENTROWThe cursor is not positioned to a valid row.
eOWNERDELETEDThe owner row for a set cursor has been deleted.
eSINGLETONDELETEDThe row for a singleton cursor has been deleted.
eNOTLINKEDThe cursor is positioned to a row that is not linked to the specified reference id.
eNOTOWNERThe cursor's rows are not owners of the specified set.
eNOTMEMBERThe cursor's rows are not members of the specified set.
See also
rdm_dbStartUpdate
rdm_dbGetRows
rdm_cursorMoveToNext
rdm_cursorUpdateRow
rdm_cursorAddMember
rdm_cursorLinkRow
rdm_cursorRemoveMember
rdm_cursorUnlinkAndDeleteRow
rdm_cursorUnlinkRow
rdm_dbEnd
rdm-compile
Parameters
[in]cursorThe record to relink
[in]refIdThe set identifer for the link
[in]cursorOwnerThe new owner to link to
Examples
cursor/adoptChild.c.

◆ rdm_cursorRemoveMember()

RDM_RETCODE rdm_cursorRemoveMember ( RDM_CURSOR  setCursor)

#include <rdmcursorapi.h>

Remove a row from a set cursor (unlink)

This function unlinks the current row of setCursor from the set associated with setCursor.

setCursor must be a set cursor

The setCursor will maintain the origin current row and position even though the current row is no longer in the set. Calling rdm_cursorMoveToNext() or rdm_cursorMoveToPrevious() will position the cursor relative to the original position.

Locking Requirements
Write lock on member table and read lock on owner table associated with the setCursor.
Return values
sOKAYNormal, successful return.
eREADONLYDatabase is read-only and cannot be updated.
eNOSTARTUPDATEAn update operation was attempted when no rdm_dbStartUpdate() is active.
eNOTLOCKEDAttempt to access a table for reading or update without proper locks.
eDBNOTOPENDatabase not open.
eNOCURRENTROWThe cursor is not positioned to a valid row.
eOWNERDELETEDThe owner row for a set cursor has been deleted.
eSINGLETONDELETEDThe row for a singleton cursor has been deleted.
eINVCURSOROPInvalid operation for this cursor.
See also
rdm_dbStartUpdate
rdm_dbGetRows
rdm_cursorMoveToNext
rdm_cursorUpdateRow
rdm_cursorAddMember
rdm_cursorLinkRow
rdm_cursorRelinkRow
rdm_cursorUnlinkAndDeleteRow
rdm_cursorUnlinkRow
rdm_dbEnd
rdm-compile
Parameters
[in]setCursorThe record we want to remove
Examples
cursor/registerVoters.c.

◆ rdm_cursorUnlinkAndDeleteRow()

RDM_RETCODE rdm_cursorUnlinkAndDeleteRow ( RDM_CURSOR  cursor)

#include <rdmcursorapi.h>

Unlink a row from all sets and delete it.

This function unlinks the current row of cursor from all sets and deletes it.

If cursor is a set cursor based on the specified refId then the cursor will maintain the original current row and position even though the row is no longer in the set. Calling rdm_cursorMoveToNext() or rdm_cursorMoveToPrevious() will position the cursor relative to the original position.

Locking Requirements
Write lock on the table associated with the cursor and any other table needed for unlinking the row from those sets.
Return values
sOKAYNormal, successful return.
eREADONLYDatabase is read-only and cannot be updated.
eNOSTARTUPDATEAn update operation was attempted when no rdm_dbStartUpdate() is active.
eNOTLOCKEDAttempt to access a table for reading or update without proper locks.
eDBNOTOPENDatabase not open.
eNOCURRENTROWThe cursor is not positioned to a valid row.
eOWNERDELETEDThe owner row for a set cursor has been deleted.
eSINGLETONDELETEDThe row for a singleton cursor has been deleted.
See also
rdm_dbStartUpdate
rdm_dbGetRows
rdm_cursorMoveToNext
rdm_cursorUpdateRow
rdm_cursorAddMember
rdm_cursorLinkRow
rdm_cursorRelinkRow
rdm_cursorRemoveMember
rdm_cursorUnlinkAndDeleteRow
rdm_cursorUnlinkRow
rdm_dbEnd
rdm-compile
Parameters
[in]cursorThe row to unlink and delete
Examples
cursor/adultDie.c.

◆ rdm_cursorUnlinkRow()

RDM_RETCODE rdm_cursorUnlinkRow ( RDM_CURSOR  cursor,
RDM_REF_ID  refId 
)

#include <rdmcursorapi.h>

Unlink a row from its owner.

This function unlinks the current row of cursor from the owner for set identified by refId.

If cursor is a set cursor based on the specified refId then the cursor will maintain the original current row and position even though the row is no longer in the set. Calling rdm_cursorMoveToNext() or rdm_cursorMoveToPrevious() will position the cursor relative to the original position.

Locking Requirements
Write lock on member table (cursor) and read lock on owner table associated with refId.
Return values
sOKAYNormal, successful return.
eREADONLYDatabase is read-only and cannot be updated.
eNOSTARTUPDATEAn update operation was attempted when no rdm_dbStartUpdate() is active.
eNOTLOCKEDAttempt to access a table for reading or update without proper locks.
eDBNOTOPENDatabase not open.
eNOCURRENTROWThe cursor is not positioned to a valid row.
eOWNERDELETEDThe owner row for a set cursor has been deleted.
eSINGLETONDELETEDThe row for a singleton cursor has been deleted.
eNOTLINKEDThe cursor is positioned to a row that is not linked to the specified reference id.
eNOTMEMBERThe cursor's rows are not members of the specified set.
See also
rdm_dbStartUpdate
rdm_dbGetRows
rdm_cursorMoveToNext
rdm_cursorUpdateRow
rdm_cursorAddMember
rdm_cursorLinkRow
rdm_cursorRelinkRow
rdm_cursorRemoveMember
rdm_cursorUnlinkAndDeleteRow
rdm_cursorUnlinkRow
rdm_dbEnd
rdm-compile
Parameters
[in]cursorThe row to unlink
[in]refIdThe set identifier for the connection
Examples
cursor/cancelClubMembership.c.