mco_uda_bitmap_get_fld

Returns the field number and position of the updated field.

Prototype

 
    MCO_RET mco_uda_bitmap_get_fld(	/*IN*/ mco_uda_object_handle_t * obj,
                      /*OUT*/ uint2 * index,
                      /*OUT*/ unsigned short * field_no);
 

Arguments

obj Handle of a UDA object

index

Address of an unsigned 2 byte integer to receive the position within the updated field

field_no

Address of an unsigned short to receive the updated field number

Description

This function searches the passed object for a field declared bool updated_bitmap[] and if found returns the field number and position of the updated field. (Note that if the schema definition of this class has a field declared bool updated_bitmap[] then the runtime will automatically set the corresponding bit in this field when the value of any other field in this database object is changed. It is the developer's responsibility to include field bool updated_bitmap[] in any class for which this functionality is desired.)

Return Codes

MCO_S_OK Updated bitmap field and position found

MCO_E_UDA_FIELD_NOTFOUND

No updated bitmap field found

MCO_S_NOTFOUND

Updated bitmap field found but position in field not found

Example

 
    Application snippet:
        
     
    int main(int argc, char* argv[])
    {
        MCO_RET rc;
        mco_db_h db;
        mco_metadict_header_t * metadict;
        mco_trans_h t;
        mco_cursor_t csr;
        mco_uda_object_handle_t rec;
        unsigned short index_no = 0;
        unsigned short field_no;
        ...
 
        rc = mco_trans_start(db, MCO_READ_WRITE, MCO_TRANS_FOREGROUND, &t);
        if ( MCO_S_OK == rc)
        {
            ...
            rc = mco_uda_cursor(t, rec_struct_no, index_no, &csr);
            rc = mco_cursor_first(t, &csr);
            rc = mco_uda_from_cursor(t, &csr, &rec); /* Get object handle from cursor */
            /* display all updated fields */
            while ((rc=mco_uda_updated_bitmap_get_fld(rec, &index, &field_no)) != MCO_S_NOTFOUND)
            {
                mco_dict_field_info_t field_info;
                mco_dict_field(metadict, 0, rec->struct_no, field_no, &field_info);
                printf("\nField %s (number %d) was updated\n", field_info.name, field_no);
                ...
            }
        }
        ...
    }