mco_trans_type

Return the type of a transaction referenced by the handle.

Prototype

    MCO_RET	mco_trans_type(	/*IN*/ mco_trans_h t, /*OUT*/ MCO_TRANS_TYPE * type );

Arguments

t
The mco_trans_h transaction handle returned by mco_trans_start().
type
The address of the MCO_TRANS_TYPE value (an unsigned integer) to receive the result.

Description

This function returns the type of a transaction referenced by the handle. Upon successful return, type will be one of MCO_READ_ONLY, MCO_UPDATE or MCO_READ_WRITE.

Return Codes

MCO_S_OK
The transaction type was returned successfully.
MCO_E_INVALID_HANDLE
Invalid transaction handle in the trans argument.

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;
        mco_trans_h t;
        MCO_TRANS_TYPE ttype;

        ...
        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_type( t, &ttype );

                ...
            }
        }
        ...
    }

Files

Header file:
mco.h
Source file:
mcotrans.c
Library:
libmcolib.a