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 RaimaDB DB Engine Library. Linker option:

    -lrdmrdm

See cursor 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
sOKAY Normal, successful return.
eREADONLY Database is read-only and cannot be updated.
eNOSTARTUPDATE An update operation was attempted when no rdm_dbStartUpdate() is active.
eNOTLOCKED Attempt to access a table for reading or update without proper locks.
eDBNOTOPEN Database not open.
eNOCURRENTROW The cursor is not positioned to a valid row.
eOWNERDELETED The owner row for a set cursor has been deleted.
eSINGLETONDELETED The row for a singleton cursor has been deleted.
eISOWNED The member row is already owned.
eNOTMEMBER The cursor's rows are not members of the specified set.
eNOTRELATED Items are not related.
ePRECOMMITTED A precommitted transaction must be committed or rolled back before further operations on this database are allowed.
eINVCURSOROP Invalid 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] setCursor The cursor whose set the row will be added to
[in] memberCursor The 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
sOKAY Normal, successful return.
eREADONLY Database is read-only and cannot be updated.
eNOSTARTUPDATE An update operation was attempted when no rdm_dbStartUpdate() is active.
eNOTLOCKED Attempt to access a table for reading or update without proper locks.
eDBNOTOPEN Database not open.
eNOCURRENTROW The cursor is not positioned to a valid row.
eOWNERDELETED The owner row for a set cursor has been deleted.
eSINGLETONDELETED The row for a singleton cursor has been deleted.
eISOWNED The member row is already owned.
eNOTOWNER The cursor's rows are not owners of the specified set.
eNOTMEMBER The 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] cursor The row to link
[in] refId The set identifier for the connection
[in] cursorOwner The owner to link to
Examples
core03Example_main.c, core06Example_main.c, core07Example_main.c, core10Example_main.c, 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
sOKAY Normal, successful return.
eREADONLY Database is read-only and cannot be updated.
eNOSTARTUPDATE An update operation was attempted when no rdm_dbStartUpdate() is active.
eNOTLOCKED Attempt to access a table for reading or update without proper locks.
eDBNOTOPEN Database not open.
eNOCURRENTROW The cursor is not positioned to a valid row.
eOWNERDELETED The owner row for a set cursor has been deleted.
eSINGLETONDELETED The row for a singleton cursor has been deleted.
eNOTLINKED The cursor is positioned to a row that is not linked to the specified reference id.
eNOTOWNER The cursor's rows are not owners of the specified set.
eNOTMEMBER The 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] cursor The record to relink
[in] refId The set identifer for the link
[in] cursorOwner The 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
sOKAY Normal, successful return.
eREADONLY Database is read-only and cannot be updated.
eNOSTARTUPDATE An update operation was attempted when no rdm_dbStartUpdate() is active.
eNOTLOCKED Attempt to access a table for reading or update without proper locks.
eDBNOTOPEN Database not open.
eNOCURRENTROW The cursor is not positioned to a valid row.
eOWNERDELETED The owner row for a set cursor has been deleted.
eSINGLETONDELETED The row for a singleton cursor has been deleted.
eINVCURSOROP Invalid 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] setCursor The 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
sOKAY Normal, successful return.
eREADONLY Database is read-only and cannot be updated.
eNOSTARTUPDATE An update operation was attempted when no rdm_dbStartUpdate() is active.
eNOTLOCKED Attempt to access a table for reading or update without proper locks.
eDBNOTOPEN Database not open.
eNOCURRENTROW The cursor is not positioned to a valid row.
eOWNERDELETED The owner row for a set cursor has been deleted.
eSINGLETONDELETED The 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] cursor The 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
sOKAY Normal, successful return.
eREADONLY Database is read-only and cannot be updated.
eNOSTARTUPDATE An update operation was attempted when no rdm_dbStartUpdate() is active.
eNOTLOCKED Attempt to access a table for reading or update without proper locks.
eDBNOTOPEN Database not open.
eNOCURRENTROW The cursor is not positioned to a valid row.
eOWNERDELETED The owner row for a set cursor has been deleted.
eSINGLETONDELETED The row for a singleton cursor has been deleted.
eNOTLINKED The cursor is positioned to a row that is not linked to the specified reference id.
eNOTMEMBER The 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] cursor The row to unlink
[in] refId The set identifier for the connection
Examples
cursor/cancelClubMembership.c.