Connect to a database 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 | The database handle for a database connection |
trans_type | A one-byte unsigned value, taken from the enum MCO_TRANS_TYPE |
priority |
A two-byte unsigned value, taken from the enum MCO_TRANS_PRIORITY |
level |
An Isolation Level for MVCC Transaction Manager, taken from enum MCO_TRANS_ISOLATION_LEVEL |
t |
The address of a |
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 calling mco_trans_set_default_isolation_level() that sets the isolation level for all transactions initiated from the current connection.
MCO_S_OK | The database was created successfully |
MCO_ERR_TRN | A database transaction error occurred |
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 ); ... } } ... }