This function deletes all database objects of this class.
MCO_RET classname_delete_all( /*IN*/ mco_trans_h t );
t | A MCO_READ_WRITE transaction handle returned by mco_trans_start() |
This function will remove all objects (and their index entries) of a given class.
MCO_S_OK | The objects were deleted successfully |
MCO_E_ACCESS | The transaction handle is MCO_READ_ONLY |
MCO_E_DELETED |
This object has been deleted |
MCO_E_NOMEM |
Database memory allocation error |
MCO_ERR_TRN |
Error in the enclosing transaction |
The following code snippets demonstrate how
classname_delete_all()
is used to delete all database objects of a specific class.
Snippet from schema file: class Record { uint4 key; hash <key> hkey; }; Application snippet: int delete_records(mco_db_h db) { MCO_RET rc; mco_trans_h t; rc = mco_trans_start(db, MCO_READ_WRITE, MCO_TRANS_FOREGROUND, &t); if ( MCO_S_OK == rc ) { rc = Record_delete_all(t); if ( MCO_S_OK == rc ) { rc = mco_trans_commit(t); } else { printf("\n\t error(%d) from delete_all", rc); rc = mco_trans_rollback(t); } } ... }