# mco_disk_confirm_transaction

> Recover and commit a database transaction left in an “incomplete” state.

### Prototype

        MCO_RET	mco_disk_confirm_transaction(	/*IN*/ char const* log_file_path,
                              /*IN*/ MCO_LOG_TYPE log_type);

### Arguments

log_file_path | Path to the database transaction log file
log_type | The Transaction log type used for this database

### Description

> This function recovers and commits a database transaction left in an “incomplete” state. It is used to process two-phase commit for persistent databases. The two-phase commit is intended to coordinate multiple external eXtremeDB transactions or an eXtremeDB transaction with some other external transaction processing system (such as another DBMS). If the application running a persistent eXtremeDB database has failed in between the first and the second phase of the commit, upon restart the eXtremeDB application needs to receive instructions from an external transaction coordinator to either commit or roll back the last uncommitted transaction. This function does exactly this: it commits the last (uncompleted) transaction. It is important to note that this function must be called before opening the database.

### Return Codes

MCO_S_OK | The transaction was committed successfully

### Example

        Application snippet:

        const char * dbname = "SimpleDb";

        int main(int argc, char* argv[])
        {
            mco_db_h db;
            MCO_RET rc;
            mco_device_t       dev;
            mco_db_params_t    db_params;
            bool recover = true;

            ...
            if ( recover )
            {
                rc = mco_disk_confirm_transaction("ph2disk.log", REDO_LOG );

            }
            else
            {
                rc = mco_disk_reject_transaction("ph2disk.log", REDO_LOG );
            }
            ...

            rc = mco_db_open_dev( dbname, simple_get_dictionary(), &dev, 1, &db_params );
            if ( MCO_S_OK != rc )
            {
                rc = mco_db_connect(  dbname, &db );
                ...
            }
            ...
        }

### Files

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