# mco_disk_transaction_policy

> Set the default transaction commit policy for this connection.

### Prototype

        MCO_COMMIT_POLICY mco_disk_transaction_policy(	/*IN*/ mco_db_h db, /*IN*/ MCO_COMMIT_POLICY policy);

### Arguments

db | The database handle that was established by `mco_db_connect()`
policy | The transaction commit policy to set for this connection

### Description

> This function sets the default transaction commit policy for this connection and returns the previous policy.

### Return Codes

MCO_COMMIT_POLICY | The transaction policy was successfully set and the previous policy is returned

### Example

        Application snippet:

        const char * dbname = "SimpleDb";

        int main(int argc, char* argv[])
        {
            mco_db_h db;
            MCO_RET rc;
            mco_device_t       dev[4];
            mco_db_params_t    db_params;
            MCO_COMMIT_POLICY  commit_policy = MCO_COMMIT_SYNC_FLUSH;

            ...
            rc = mco_db_open_dev( dbname, simple_get_dictionary(), dev, 4, &db_params );

            if ( MCO_S_OK != rc )
            {
                ...
                // Explicitly set the commit policy to SYNC_FLUSH
                commit_policy = mco_disk_transaction_policy(db, commit_policy);

                ...
            }
        }

### Files

Header file:
mco.h
Source file:
mcodisk.c
Library:
libmcovtdsk.a
Header file:
mco.h
Source file:
mcovtmem.c
Library:
libmcovtmem.a