Products Support Documentation Download
Collaboration diagram for Delete Functions:

Functions

RDM_RETCODE rdm_dbDeleteAllRowsFromDatabase (RDM_DB db)
 Remove all rows from a database. More...
 
RDM_RETCODE rdm_dbDeleteAllRowsFromTable (RDM_DB db, RDM_TABLE_ID tableId)
 Remove all rows from a table. More...
 

Detailed Description

API for deleting all rows from a table or a database. All the functions here are located in RDM DB Engine Library. Linker option:

    -lrdmrdm

Function Documentation

◆ rdm_dbDeleteAllRowsFromDatabase()

RDM_RETCODE rdm_dbDeleteAllRowsFromDatabase ( RDM_DB  db)

#include <rdmdbapi.h>

Remove all rows from a database.

This function removes all rows from all tables in the database.

No triggers or other checks will be performed when a database has all of it's rows delete in this manner. Once this is called the database will be completely empty with no rows in any of the database tables.

This function must be performed within a transaction (optional in exclusive mode or when used with the standalone transactional file server). If the transaction is aborted, the database will remain unchanged.

Please note that any row IDs that was used prior to this call will be reused after a successful call to this function.

Locking Requirements
Write lock on all database tables (RDM_LOCK_ALL).
Return values
sOKAYNormal, successful return.
eDBNOTOPENDatabase not open.
eNOSTARTUPDATEAn update operation was attempted when no rdm_dbStartUpdate() is active.
eNOTLOCKEDAttempt to access a table for reading or update without proper locks.
ePRECOMMITTEDA precommitted transaction must be committed or rolled back before further operations on this database are allowed.
eREADONLYDatabase is read-only and cannot be updated.
See also
rdm_dbStartUpdate
rdm_cursorDeleteRow
rdm_dbDeleteAllRowsFromTable
rdm_dbEnd
Parameters
[in]dbA valid RDM database handle

◆ rdm_dbDeleteAllRowsFromTable()

RDM_RETCODE rdm_dbDeleteAllRowsFromTable ( RDM_DB  db,
RDM_TABLE_ID  tableId 
)

#include <rdmdbapi.h>

Remove all rows from a table.

This function deletes all of the rows in the specified table.

The ability to delete rows will be based on the triggered action specified in the table definition. Rows 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 on the on delete triggered action.

If the triggered action is:

  • restrict – an error code will be returned and no rows will be deleted
  • set null – all of rows that reference the table to be initialized will have their referencing foreign key columns set to NULL.
  • cascade – all of the rows that reference the table to be initialized 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 associated with tableId and read locks on tables with foreign keys referencing this table.
Return values
sOKAYNormal, successful return.
eDBNOTOPENDatabase not open.
eDBOPENDatabase already opened in this task.
eHASMEMBERSReferential Integrity error - row is referenced by other rows.
eNOSTARTUPDATEAn update operation was attempted when no rdm_dbStartUpdate() is active.
eNOTLOCKEDAttempt to access a table for reading or update without proper locks.
eREADONLYDatabase is read-only and cannot be updated.
See also
rdm_dbStartUpdate
rdm_cursorDeleteRow
rdm_dbDeleteAllRowsFromDatabase
rdm_dbEnd
Parameters
[in]dbA valid RDM database handle
[in]tableIdThe table identifier for the table to be initialized