Commit a transaction.
MCO_RET mco_trans_commit( /*IN*/ mco_trans_h t );
t
mco_trans_h transaction handle returned by
mco_trans_start().This function completes a transaction, committing any changes to the database. Any object handles scoped to the transaction become invalid. However, calling
mco_trans_commit()when the transaction is in an error state will cause a rollback.In eXtremeDB/rt, this function behaves differently: it does not automatically roll back the transaction in case of an error. For more information, see the description of
mco_trans_end().
MCO_S_OK
MCO_S_NOTFOUND
MCO_E_NOMEM
MCO_S_DUPLICATE
MCO_E_TRANSACT
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;
mco_trans_h t;
...
rc = mco_db_open_dev( dbname, simple_get_dictionary(), &dev, 1, &db_params );
if ( MCO_S_OK != rc )
{
rc = mco_db_connect( dbname, &db );
...
rc = mco_trans_start(db, MCO_READ_ONLY, MCO_TRANS_FOREGROUND, &t);
if ( MCO_S_OK == rc )
{
...
rc = mco_trans_commit( t );
...
}
}
...
}