# mco_register_eventname_handler(update events)

> This function registers a call-back function that the runtime will invoke whenever the update event `eventname` occurs.

### Prototype

>         MCO_RET	mco_register_eventname_handler(	/*IN*/ mco_trans_h trans,
>                                 /*IN*/ mco_eventname_handler,
>                                 /*IN*/ void *param,
>                                 /*IN*/ MCO_HANDLING_ORDER when);

### Arguments

trans | A transaction handle returned by `mco_trans_start()`
mco_eventname_handler | A pointer to the handler function
param | A pointer to user-defined storage
when | `MCO_BEFORE_UPDATE` or `MCO_AFTER_UPDATE`.

### Description

> This function registers a call-back function that the runtime will invoke whenever the event eventname occurs. Update events are defined in the database schema by specifying the event type (`update`) with a field specification and the name of the handler function to be called. Multiple handlers for a given eventname can be registered. The void `param` can be used to pass any user-defined data structure between the application and the event handler.

> The `when` argument is one of the values `MCO_BEFORE_UPDATE` or `MCO_AFTER_UPDATE` and determine whether the handler is called before the object contents are updated, or after.

### Return Codes

MCO_S_OK | The instance was deleted successfully
MCO_E_ACCESS | The transaction handle is `MCO_READ_ONLY`
MCO_E_TRANSACT | A transaction error occurred

Related Topics