# mco_trans_set_options
RT

> Set transaction-specific options that apply only for the duration of the current transaction.

### Prototype

        typedef enum {
            MCO_BTREE_HOLD_LOCKS = 1  /* Hold B-Tree cursor locks until the end of traversal */
        } MCO_TRANS_OPTIONS;

        MCO_RET mco_trans_set_options(
            /*IN*/ mco_trans_h t,
            /*IN*/ int options_mask
        );

### Arguments

`t`
Active transaction handle.
`options_mask`
Bitmask of options from the `MCO_TRANS_OPTIONS` enum. Multiple options can be combined using bitwise OR (`|`). Set to `0` to disable all options.

### Description

> This function configures runtime options that affect the behavior of the current transaction. The settings are valid only until the transaction is committed or rolled back; they do not persist across transactions.

> Currently, the only supported option is:

> - `MCO_BTREE_HOLD_LOCKS` — when set, B-Tree cursor locks are held until the end of the cursor traversal (instead of being released after each step). This can improve consistency during complex traversals but may increase lock contention.

> Options must be set after the transaction is started and before performing operations that depend on them.

### Return Codes

`MCO_S_OK`
Transaction options successfully applied.
`MCO_E_INVALID_HANDLE`
The provided transaction handle is invalid or null.
`MCO_E_TRANS_NOT_ACTIVE`
The transaction is not active (already committed or rolled back).

### Files

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