mco_uda_delete

Remove an object.

Prototype

 
    MCO_RET mco_uda_delete(	/*IN*/ mco_uda_object_handle_t * obj );
 

Arguments

obj A handle to the object being deleted

Description

Removes an object from the database.

Return Codes

MCO_S_OK Object successfully deleted
MCO_E_UDA_STRUCT_NOT_CLASS The handle is not a valid object handle

Example

 
    Application snippet:
        
     
    int main(int argc, char* argv[])
    {
        MCO_RET rc;
        mco_db_h db;
        mco_trans_h t;
        unsigned int struct_no = 0;
        unsigned int index_no = 4;
        mco_uda_value_t keys[1];
        unsigned long val = 1001;
        mco_cursor_t csr;
        mco_uda_object_handle_t rec;
        ...
         
        rc = mco_trans_start(db, MCO_READ_WRITE, MCO_TRANS_FOREGROUND, &t);
        if ( MCO_S_OK == rc )
        { 
            /* Open cursor */
            rc = mco_uda_cursor(t, rec_struct_no, hu4_index_no, &csr);
            if ( MCO_S_OK == rc ) {
                /* Set keys type and value */
                keys[0].type = MCO_DD_UINT4;
                keys[0].v.u4 = val;
                 
                rc = mco_uda_lookup(t, struct_no, index_no, MCO_EQ, keys, 1, &csr);
                if ( MCO_S_OK == rc ) 
                {
                    /* Get object from cursor */
                    mco_uda_from_cursor(t, &csr, &rec);
                     
                    /* Delete object */
                    mco_uda_delete(&rec);
        
                    rc = mco_trans_commit(t);
                }
                ...
            }
        }
    }
     
 

Files

Header file:
mcouda.h
Source file:
mcouda.c
Library:
libmcouda.a