Start a database transaction with an isolation level.
MCO_RET mco_trans_start_ex(
/*IN*/ mco_db_h db,
/*IN*/ MCO_TRANS_TYPE trans_type,
/*IN*/ MCO_TRANS_PRIORITY priority,
/*IN*/ MCO_TRANS_ISOLATION_LEVEL level,
/*OUT*/ mco_trans_h * t
);
db
trans_type
priority
level
t
mco_trans_h to receive the transaction handle.This function starts a transaction. It is an extended version of the function
mco_trans_start()that allows setting the transaction isolation level only for the current transaction. This is in contrast with the method of callingmco_trans_set_default_isolation_level()that sets the isolation level for all transactions initiated from the current connection.
MCO_S_OK
MCO_ERR_TRN
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_ex( db, MCO_READ_WRITE, MCO_TRANS_FOREGROUND, MCO_SERIALIZABLE, &t );
if ( MCO_S_OK == rc )
{
...
rc = mco_trans_commit( t );
...
}
}
...
}