This function deletes a database object (referenced by its class handle).
MCO_RET classname_delete( /*IN*/ classname * handle );
handle | The address of a variable of type
|
This function will remove the object referenced by handle, and all of the object’s versions, from the database. Hash and tree index entries, if any, will also be removed.
MCO_S_OK | The instance was deleted successfully |
MCO_E_ACCESS | The transaction handle is MCO_READ_ONLY |
MCO_E_TRANSACT | Transaction is in error state |
MCO_E_DELETED |
This object has been deleted |
MCO_E_NOMEM |
Database memory allocation error |
MCO_ERR_OBJECT_HANDLE |
Invalid object handle |
MCO_ERR_TRN |
Error in the enclosing transaction |
The following code snippets demonstrate how
classname_delete()
is used to delete a database object.
Snippet from schema file: class Record { uint4 key; hash <key> hkey; }; Application snippet: int find_delete(mco_db_h db, int hkey_val) { MCO_RET rc; mco_trans_h t; Record obj; rc = mco_trans_start(db, MCO_READ_WRITE, MCO_TRANS_FOREGROUND, &t); if ( MCO_S_OK == rc ) { rc = Record_hkey_find(t, hkey_val, &obj); if ( MCO_S_OK == rc ) { rc = Record_delete(&obj); } rc = mco_trans_commit(t); } }