# mco_cursor_store
RT

> Store the cursor for possible use by another transaction.

### Prototype

        MCO_RET	mco_cursor_store(	/*IN*/ mco_trans_h t, /*IN*/ mco_cursor_h c);

### Arguments

t | The `mco_trans_h` transaction handle returned by `mco_trans_start()`
c | A cursor handle returned from a cursor or index search function

### Description

> This function stores the cursor so that applications using the MVCC Transaction Manager can pass its handle between transacitons. For example, an application can search for an object, remember the found object’s position, and use it in the next transaction to avoid an additional lookup.

### Return Codes

MCO_S_OK | The cursor is valid
MCO_E_INVALID_HANDLE | Cursor not opened
MCO_ERR_TRN | Transaction not open
MCO_E_CURSOR_CLOSED | Cursor has been closed

### 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_cursor_t c;
            MCO_CURSOR_TYPE ctype;

            ...
            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 )
                {
                    ...
                    A_list_cursor( t, &c);
                    ...
                    rc = mco_cursor_store( t, &c );

                    ...
                }
            }
            ...
        }

### Files

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