mco_uda_put

Assign the field value.

Prototype

 
    MCO_RET mco_uda_put(	/*IN*/ const mco_uda_object_handle_p obj, 
                /*IN*/ unsigned short field_no, 
                /*IN*/ unsigned short index,
                /*IN*/ const mco_uda_value_t * val);
 

Arguments

obj The object handle

field_no

The field number (must be between 0 and struct_info.field_count - 1)

index

The element index for vector or array fields

val

The address of a mco_uda_value_t variable to receive the data

Description

Assigns the field value for the object or structure. (See description of mco_uda_value_t for details on how to prepare parameter val for setting database fields of different types.)

Return Codes

MCO_S_OK Field data successfully updated
MCO_E_UDA_FIELD_NOT_FOUND

Invalid fieldno - field not found in this class or struct

MCO_E_UDA_SCALAR

The field is not a vector or array

Example

For examples demonstrating how to set database field values of various types see the description of mco_uda_value_t.

 
    Application snippet:
        
     
    int main(int argc, char* argv[])
    {
        MCO_RET rc;
        mco_uda_object_handle_t rec;
        mco_uda_value_t val;
        unsigned short field_1 = 1;
         
        /* Get simple scalar values */
        val.type = MCO_DD_UINT4; /* Set field's type */
        val.type = MCO_DD_UINT4; /* Set field's type */
        val.v.u4   = 999;      /* Set appropriate union field */
        mco_uda_put(&rec, field_1, 0, &val);
        
        ...
    }
 

Files

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