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 RaimaDB DB Engine Library. Linker option:
-l
rdmrdm
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
-
sOKAY Normal, successful return. eDBNOTOPEN Database not open. 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. ePRECOMMITTED A precommitted transaction must be committed or rolled back before further operations on this database are allowed. eREADONLY Database is read-only and cannot be updated.
- See also
- rdm_dbStartUpdate
- rdm_cursorDeleteRow
- rdm_dbDeleteAllRowsFromTable
- rdm_dbEnd
rdm-initialize
- Parameters
-
[in] db A valid RaimaDB 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
-
sOKAY Normal, successful return. eDBNOTOPEN Database not open. eDBOPEN Database already opened in this task. eHASMEMBERS Referential Integrity error - row is referenced by other rows. 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. eREADONLY Database is read-only and cannot be updated.
- Parameters
-
[in] db A valid RaimaDB database handle [in] tableId The table identifier for the table to be initialized
- Examples
- core24Example_main.c, and core25Example_main.c.