Collaboration diagram for Delete Functions:

Functions

RDM_RETCODE rdm_cursorDeleteRow (RDM_CURSOR cursor)
 Delete a row from a table. More...
 

Detailed Description

API for deleting a row identified by a core cursor. 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_cursorDeleteRow()

RDM_RETCODE rdm_cursorDeleteRow ( RDM_CURSOR  cursor)

#include <rdmcursorapi.h>

Delete a row from a table.

This function deletes the current row of cursor from the database.

After the row has been deleted the cursor will no longer have a current row. However it will maintain a virtual position which be the position between the rows neighboring the deleted row. The neighboring rows are dependent upon on the type of cursor.

The ability to delete a row will be based on the triggered action specified in the table definition. A row that only references other rows will be deleted and the references automatically removed. The behavior of a row that is referenced by other rows will be dependent the ON DELETE triggered action.

If the the triggered action is:

  • restrict – an error code will be returned and no rows will be deleted
  • set null – all rows that reference the row to be deleted will have their referencing foreign key columns set to NULL.
  • cascade – all of the rows that reference the row to be deleted will also be deleted. If there are any referential integrity issues with the referencing rows an error code will be returned.
Locking Requirements
Write lock on the table the cursor is based on and potentially a write lock (on delete cascade) or a read lock (on delete restrict) on any tables that have rows that reference the row to be deleted.
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.
ePRECOMMITTEDA precommitted transaction must be committed or rolled back before further operations on this database are allowed.
eREFINTEGRITYIntegrity constraint violation.
See also
rdm_dbStartUpdate
rdm_dbGetRows
rdm_cursorMoveToNext
rdm_dbDeleteAllRowsFromDatabase
rdm_dbDeleteAllRowsFromTable
rdm_dbInsertRow
rdm_cursorUpdateRow
rdm_dbEnd
Parameters
[in]cursorThe cursor whose current row will be deleted
Examples
c-core/20_core/core20Example_main.c, c-core/21_core/core21Example_main.c, c-core/22_core/core22Example_main.c, c-core/23_core/core23Example_main.c, cursor/shutdownClub.c, and rtree/deleteZipcode.c.