# mco_class_stat_get
RT

> Return the statistics that are maintained for the class.

### Prototype

        MCO_RET	mco_class_stat_get(	/*IN*/ mco_trans_h t,
                        /*IN*/ uint2 * class_code,
                        /*OUT*/ mco_class_stat_h stat);

### Arguments

t | The `mco_trans_h` transaction handle returned by `mco_trans_start()`.
class_code | A 2-byte unsigned integer representing the class for which statistics are desired. Normally, this value would be retrieved by `mco_cursor_get_class_code()` or by examining the generated schema header file.
stat | The address of a mco_class_stat_t structure to receive the class statistics

### Description

> This function returns statistics that are maintained for the class.

### Return Codes

MCO_S_OK | The class statistics were returned successfully.
MCO_E_INVALID_HANDLE | Database handle not opened.
MCO_E_ILLEGAL_PARAM | Invalid class code or statistics not available.
MCO_E_UNSUPPORTED | The build of the library you are using has option `MCO_CFG_COLLECT_STATISTICS` compiled out .

### 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;
            uint2 ccode = 1;
            mco_class_stat_t st;

            ...
            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_class_stat_get( t, ccode, &st);

                    ...
                }
             ...

            }
        }

### Files

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