# mco_trans_iterable
RT

> Enable or disable transaction iteration support for a database connection.

### Prototype

        void mco_trans_iterable(
            /*IN*/ mco_db_h db,
            /*IN*/ mco_bool enable
        );

### Arguments

`db`
Database connection handle.
`enable`
Flag to control iteration support:

- `MCO_YES` — enable transaction iteration (allows `mco_trans_iterate()` to function),
- `MCO_NO` — disable transaction iteration (may improve performance if iteration is not needed).

### Description

> This function controls whether the database connection maintains internal metadata required for iterating over transaction modifications using `mco_trans_iterate()`.

> When iteration is enabled, the transaction manager tracks additional information about modified objects, which allows applications to inspect or process all changes made during a transaction. Disabling iteration reduces memory overhead and may improve performance for transactions that do not require this capability.

> By default, iteration support is typically disabled. Call this function with `enable = MCO_YES` before starting a transaction if you intend to use `mco_trans_iterate()`.

### Return Value

None
This function does not return a value.

### Example

        mco_db_h db;
        mco_trans_h t;
        MCO_RET rc;

        rc = mco_db_connect("mydb", &db);
        if (rc != MCO_S_OK) { /* handle error */ }
            /* Enable transaction iteration */
            mco_trans_iterable(db, MCO_YES);
            ...
            rc = mco_trans_start(db, MCO_READ_WRITE, MCO_TRANS_FOREGROUND, &t);
            if (rc == MCO_S_OK) {
                /* Perform database operations */

                    if ( MCO_S_OK == rc ) {
                        rc = mco_trans_commit(t);
                    } else {
                        printf ("\tIteration proc return code %d. Rollback transaction\n", rc);
                        rc = mco_trans_rollback(t);
                    }
            }

### Files

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