mco_uda_new

Allocate a new object.

Prototype

    MCO_RET mco_uda_new(	/*IN*/ mco_trans_h t,
                /*IN*/ unsigned short struct_no,
                /*IN*/ const void * oid,
                /*IN*/ const mco_uda_value_t * initializers,
                /*IN*/ unsigned short initializers_no,
                /*OUT*/ mco_uda_object_handle_t * obj );

Arguments

t
The mco_trans_h transaction handle returned by mco_trans_start().
struct_no
The class number for the object being created (must be between 0 and mco_dict_struct_count() - 1). It can be obtained through the class DDL name (see mco_dict_struct_name()).
oid
The object's OID; ignored if OID is not declared for the class.
initializers
Not used.
initializers_no
Not used.
obj
The object handle.

Description

Allocates a new object. Note that the mco_uda_object_handle_t parameter obj is not a real descriptor and can’t be used in certain object related functions (for instance mco_uda_delete() or mco_uda_checkpoint()).

Return Codes

MCO_S_OK
The object was successfully created.
MCO_E_UDA_STRUCT_NOTFOUND
Invalid struct_no.
MCO_E_UDA_STRUCT_NOT_CLASS
This struct_no is not a class.

Example

    Application snippet:

    int main(int argc, char* argv[])
    {
        MCO_RET rc;
        mco_db_h db;
        mco_trans_h t;
        unsigned int record_no = 0;
        ...

        rc = mco_trans_start(db, MCO_READ_WRITE, MCO_TRANS_FOREGROUND, &t);
        if ( MCO_S_OK == rc )
        {
            mco_uda_new(t, record_no, 0, 0, 0, &obj);

            ...
            rc = mco_trans_commit(t);
        }
    }

Files

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