# mco_trans_end
RT

### Prototype

        MCO_RET mco_trans_end (mco_trans_h t, MCO_RET* rollback_status);

### Arguments

`t`
Transaction handle
`rollback_status`
Address of the variable to store the return code of rollback or 0.

### Description

> Ends the current transaction. First a commit is attempted, and if the commit fails for any reason, the function rolls back the transaction. The mco_trans_end returns the result of commit, and the return code of mco_trans_rollback() can be retrieved through the rollback_status OUT parameter. This function was introduced to mitigate the fact that fact that mco_trans_commit() does not any longer automatically rolls back the current transaction if the commit was unsuccessful.

> Note that in the context of the Adaptable Deadline policy, mco_trans_end() will return within the deadline (i.e., it respects the deadline). In the context of the Strict Deadline policy it will not return within the deadline because the automatically triggered mco_trans_rollback() is not time-limited.

### Return Codes

`MCO_S_OK`
Commit or rollback was successful.
`MCO_S_NOTFOUND`
Index not found when trying to remove object’s entries from index
`MCO_E_NOMEM`
Out of memory, possibly during an attempt to create an index
`MCO_S_DUPLICATE`
Duplicate value in a unique index (or duplicate OID)
`MCO_E_TRANSACT`
The transaction was in an error state
`MCO_ERR_TRN`
A database transaction error occurred

### Files

Header file:
mco.h
Source file:
mcotrans.c
Library:
libmcolib.a